diff --git a/pkg/webhookconfig/common.go b/pkg/webhookconfig/common.go index 00cfa79ef3..d73fcafb13 100644 --- a/pkg/webhookconfig/common.go +++ b/pkg/webhookconfig/common.go @@ -63,6 +63,7 @@ func (wrc *WebhookRegistrationClient) constructOwner() v1.OwnerReference { func generateDebugWebhook(name, url string, caData []byte, validate bool, timeoutSeconds int32, resource, apiGroups, apiVersions string, operationTypes []admregapi.OperationType) admregapi.Webhook { sideEffect := admregapi.SideEffectClassNoneOnDryRun + failurePolicy := admregapi.Ignore return admregapi.Webhook{ Name: name, ClientConfig: admregapi.WebhookClientConfig{ @@ -88,11 +89,13 @@ func generateDebugWebhook(name, url string, caData []byte, validate bool, timeou }, AdmissionReviewVersions: []string{"v1beta1"}, TimeoutSeconds: &timeoutSeconds, + FailurePolicy: &failurePolicy, } } func generateWebhook(name, servicePath string, caData []byte, validation bool, timeoutSeconds int32, resource, apiGroups, apiVersions string, operationTypes []admregapi.OperationType) admregapi.Webhook { sideEffect := admregapi.SideEffectClassNoneOnDryRun + failurePolicy := admregapi.Ignore return admregapi.Webhook{ Name: name, ClientConfig: admregapi.WebhookClientConfig{ @@ -122,5 +125,6 @@ func generateWebhook(name, servicePath string, caData []byte, validation bool, t }, AdmissionReviewVersions: []string{"v1beta1"}, TimeoutSeconds: &timeoutSeconds, + FailurePolicy: &failurePolicy, } } diff --git a/samples/best_practices/disallow_default_namespace.yaml b/samples/best_practices/disallow_default_namespace.yaml index 64b1fe8844..0f579f4d49 100644 --- a/samples/best_practices/disallow_default_namespace.yaml +++ b/samples/best_practices/disallow_default_namespace.yaml @@ -3,6 +3,7 @@ kind: ClusterPolicy metadata: name: disallow-default-namespace annotations: + pod-policies.kyverno.io/autogen-controllers: none policies.kyverno.io/category: Workload Isolation policies.kyverno.io/description: Kubernetes namespaces are an optional feature that provide a way to segment and isolate cluster resources across multiple