diff --git a/pkg/webhooks/policymutation.go b/pkg/webhooks/policymutation.go index d7b5f6dda0..8e48f3d641 100644 --- a/pkg/webhooks/policymutation.go +++ b/pkg/webhooks/policymutation.go @@ -16,8 +16,8 @@ import ( ) const ( - podControllers = "DaemonSet,Deployment,Job,ReplicaSet,StatefulSet" - podControllersAnnotation = "policies.kyverno.io/podcontroller.list" + podControllers = "DaemonSet,Deployment,Job,StatefulSet" + podControllersAnnotation = "policies.kyverno.io/autogen-controllers" ) func (ws *WebhookServer) handlePolicyMutation(request *v1beta1.AdmissionRequest) *v1beta1.AdmissionResponse { @@ -276,7 +276,7 @@ func generateRuleForControllers(rule kyverno.Rule, controllers string) kyvernoRu return kyvernoRule{} } -// defaultPodControllerAnnotation generates annotation "policies.kyverno.io/podcontroller.list=all" +// defaultPodControllerAnnotation generates annotation "policies.kyverno.io/autogen-controllers=all" // ann passes in the annotation of the policy func defaultPodControllerAnnotation(ann map[string]string) ([]byte, error) { if ann == nil { @@ -304,7 +304,7 @@ func defaultPodControllerAnnotation(ann map[string]string) ([]byte, error) { Op string `json:"op"` Value interface{} `json:"value"` }{ - "/metadata/annotations/policies.kyverno.io~1podcontroller.list", + "/metadata/annotations/policies.kyverno.io~1autogen-controllers", "add", "all", } diff --git a/pkg/webhooks/policymutation_test.go b/pkg/webhooks/policymutation_test.go index c916d1d4e2..3ffca84d1c 100644 --- a/pkg/webhooks/policymutation_test.go +++ b/pkg/webhooks/policymutation_test.go @@ -40,7 +40,7 @@ func TestGeneratePodControllerRule_NilAnnotation(t *testing.T) { "metadata": { "name": "add-safe-to-evict", "annotations": { - "policies.kyverno.io/podcontroller.list": "all" + "policies.kyverno.io/autogen-controllers": "all" } } }`) @@ -54,7 +54,7 @@ func TestGeneratePodControllerRule_PredefinedAnnotation(t *testing.T) { "metadata": { "name": "add-safe-to-evict", "annotations": { - "policies.kyverno.io/podcontroller.list": "StatefulSet,Pod" + "policies.kyverno.io/autogen-controllers": "StatefulSet,Pod" } } }`) @@ -92,7 +92,7 @@ func TestGeneratePodControllerRule_ExistOtherAnnotation(t *testing.T) { "metadata": { "name": "add-safe-to-evict", "annotations": { - "policies.kyverno.io/podcontroller.list": "all", + "policies.kyverno.io/autogen-controllers": "all", "test": "annotation" } } @@ -243,7 +243,7 @@ func TestGeneratePodControllerRule(t *testing.T) { "name": "add-safe-to-evict", "annotations": { "a": "b", - "policies.kyverno.io/podcontroller.list": "all" + "policies.kyverno.io/autogen-controllers": "all" } }, "spec": { @@ -368,7 +368,6 @@ func TestGeneratePodControllerRule(t *testing.T) { "DaemonSet", "Deployment", "Job", - "ReplicaSet", "StatefulSet" ] } @@ -402,7 +401,6 @@ func TestGeneratePodControllerRule(t *testing.T) { "DaemonSet", "Deployment", "Job", - "ReplicaSet", "StatefulSet" ] } @@ -438,7 +436,6 @@ func TestGeneratePodControllerRule(t *testing.T) { "DaemonSet", "Deployment", "Job", - "ReplicaSet", "StatefulSet" ] } @@ -483,7 +480,6 @@ func TestGeneratePodControllerRule(t *testing.T) { "DaemonSet", "Deployment", "Job", - "ReplicaSet", "StatefulSet" ] }