Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Build a policy to avoid deleting of "protected" namespaces

This example created a policy that fails attempts to delete a namespace annotated with protected: "yes"

  1. Create the policy: kubectl -n opa create configmap protected-namespaces --from-file=protected-namespaces.rego
  2. Create a namespace with the annotation: kubectl apply -f protected-namespace.yaml
  3. Check if the namespace has the annotation protected=yes: kubectl describe ns production
You can’t perform that action at this time.