diff --git a/pkg/webhooks/policy/handlers.go b/pkg/webhooks/policy/handlers.go index 9327c8675c..454a2e1b75 100644 --- a/pkg/webhooks/policy/handlers.go +++ b/pkg/webhooks/policy/handlers.go @@ -10,6 +10,7 @@ import ( "github.com/kyverno/kyverno/pkg/openapi" policyvalidate "github.com/kyverno/kyverno/pkg/policy" "github.com/kyverno/kyverno/pkg/policymutation" + "github.com/kyverno/kyverno/pkg/toggle" admissionutils "github.com/kyverno/kyverno/pkg/utils/admission" "github.com/kyverno/kyverno/pkg/webhooks" admissionv1 "k8s.io/api/admission/v1" @@ -52,6 +53,9 @@ func (h *handlers) Validate(logger logr.Logger, request *admissionv1.AdmissionRe } func (h *handlers) Mutate(logger logr.Logger, request *admissionv1.AdmissionRequest) *admissionv1.AdmissionResponse { + if toggle.AutogenInternals() { + return admissionutils.Response(true) + } if request.SubResource != "" { logger.V(4).Info("skip policy validation on status update") return admissionutils.Response(true)