From 25e58688a75f822ffb4967779b2578380b986db7 Mon Sep 17 00:00:00 2001 From: Jeff Peeler Date: Thu, 6 Apr 2017 10:55:17 -0400 Subject: [PATCH] Allow pods to opt out of PodPreset mutation An annotation in the pod spec of the form: podpreset.admission.kubernetes.io/exclude: "true" Will cause the admission controller to skip manipulating the pod spec, no matter the labelling. The annotation for a podpreset acting on a pod has also been slightly modified to contain a podpreset prefix: podpreset.admission.kubernetes.io/podpreset-{name} = resource version Fixes #44161 Kubernetes-commit: 08a59530e196ab9b30d306fb0fac5979b07298a1 --- pkg/api/annotation_key_constants.go | 3 +++ pkg/api/v1/annotation_key_constants.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/pkg/api/annotation_key_constants.go b/pkg/api/annotation_key_constants.go index 55bf20f9..e1080a34 100644 --- a/pkg/api/annotation_key_constants.go +++ b/pkg/api/annotation_key_constants.go @@ -23,6 +23,9 @@ const ( // webhook backend fails. ImagePolicyFailedOpenKey string = "alpha.image-policy.k8s.io/failed-open" + // PodPresetOptOutAnnotationKey represents the annotation key for a pod to exempt itself from pod preset manipulation + PodPresetOptOutAnnotationKey string = "podpreset.admission.kubernetes.io/exclude" + // MirrorAnnotationKey represents the annotation key set by kubelets when creating mirror pods MirrorPodAnnotationKey string = "kubernetes.io/config.mirror" diff --git a/pkg/api/v1/annotation_key_constants.go b/pkg/api/v1/annotation_key_constants.go index 8591f08b..bb458855 100644 --- a/pkg/api/v1/annotation_key_constants.go +++ b/pkg/api/v1/annotation_key_constants.go @@ -23,6 +23,9 @@ const ( // webhook backend fails. ImagePolicyFailedOpenKey string = "alpha.image-policy.k8s.io/failed-open" + // PodPresetOptOutAnnotationKey represents the annotation key for a pod to exempt itself from pod preset manipulation + PodPresetOptOutAnnotationKey string = "podpreset.admission.kubernetes.io/exclude" + // MirrorAnnotationKey represents the annotation key set by kubelets when creating mirror pods MirrorPodAnnotationKey string = "kubernetes.io/config.mirror"