Skip to content
You're viewing docs for v1.2.Go to the latest

Allow exemptions in all namespaces

You’ll configure UDS Core to accept Exemption CRs in any namespace instead of only the default uds-policy-exemptions namespace, and verify the configuration works.

By default, Exemption CRs are only accepted in the uds-policy-exemptions namespace. This provides a single, controlled location where platform engineers manage all policy exemptions. Enabling all-namespace exemptions allows teams to manage their own exemptions in their application namespaces.

  1. Enable all-namespace exemptions

    Set the ALLOW_ALL_NS_EXEMPTIONS variable in your uds-config.yaml:

    uds-config.yaml
    variables:
    core:
    ALLOW_ALL_NS_EXEMPTIONS: "true"
  2. Create and deploy your bundle

    Terminal window
    uds create --confirm && uds deploy uds-bundle-*.tar.zst --confirm

Create a test Exemption CR in an application namespace to confirm the configuration is working:

test-exemption.yaml
apiVersion: uds.dev/v1alpha1
kind: Exemption
metadata:
name: test-exemption
namespace: my-app
spec:
exemptions:
- policies:
- RequireNonRootUser
matcher:
namespace: my-app
name: "^test-pod.*"
title: "Test exemption"
description: "Verifying all-namespace exemptions are working"
Terminal window
uds zarf tools kubectl apply -f test-exemption.yaml

Confirm the exemption was created and processed:

Terminal window
# Verify the `Exemption` CR exists in the application namespace
uds zarf tools kubectl get exemptions -n my-app
# Check Pepr logs for processing
uds zarf tools kubectl logs -n pepr-system deploy/pepr-uds-core --tail=50 | grep "Processing exemption"

Clean up the test exemption:

Terminal window
uds zarf tools kubectl delete exemption test-exemption -n my-app

Problem: Exemption rejected in application namespace

Section titled “Problem: Exemption rejected in application namespace”

Symptom: Creating an Exemption CR outside uds-policy-exemptions returns a validation error.

Solution: Verify that ALLOW_ALL_NS_EXEMPTIONS is set to "true" and that the Core bundle was redeployed after the change. Check the UDS Operator config:

Terminal window
uds zarf tools kubectl get clusterconfig uds-cluster-config -o jsonpath='{.spec.policy}'