You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
kubectl create namespace dev
Error from server (InternalError): Internal error occurred: failed calling webhook "check-ignore-label.gatekeeper.sh": failed to call webhook: Post "https://gatekeeper-webhook-service.gatekeeper-system.svc:443/v1/admitlabel?timeout=3s": context deadline exceeded
Anything else you would like to add:
I have check the deployment is success but i can't create namespace when validatingwebhook is enabled.
I have noticed that the DELETE operation did not add into namespace resource, i'm not sure if this is needed. Does ValidatingWebhook required when trying to prevent namespace deletion ?
@josephlim75 I think there is a bug in rego in the template. Try below template -
apiVersion: templates.gatekeeper.sh/v1beta1kind: ConstraintTemplatemetadata:
name: k8sdenynamespacedeletionspec:
crd:
spec:
names:
kind: K8sDenyNamespaceDeletiontargets:
- target: admission.k8s.gatekeeper.shrego: | package k8sdenynamespacedeletion violation[{"msg": msg, "details": {}}] { input.review.kind.kind == "Namespace" input.review.operation == "DELETE" msg := "Deletion of namespace is not allowed. It is in the list of prohibited namespaces." }
To enable validation of DELETE requests, just set enableDeleteOperations to true.
What steps did you take and what happened:
Not able to prevent namespace deletion. Below are my OPA Gatekeeper version and constrainttemplate.
What did you expect to happen:
I expect when trying to delete a namespace, the constraint should prevent me from deleting.
Rego Template
Policy enforcement
Test Scenario
Scenario 1
Resuilt
Scenario 2
Resuilt
Anything else you would like to add:
I have check the deployment is success but i can't create namespace when validatingwebhook is enabled.
I have noticed that the
DELETE
operation did not add into namespace resource, i'm not sure if this is needed. Does ValidatingWebhook required when trying to prevent namespace deletion ?https://github.com/open-policy-agent/gatekeeper/blob/master/charts/gatekeeper/templates/gatekeeper-validating-webhook-configuration-validatingwebhookconfiguration.yaml#L115
Some help would greatly appreciate because currently i couldn't get namespace delete operation prevented and it still allow namespace to be deleted.
Environment:
v3.15.1
kubectl version
):The text was updated successfully, but these errors were encountered: