Apply Governance Labels to a Namespace
A 3-step recipe with Kubernetes. We can help you get access.
Recipe · 3 steps
Apply Governance Labels to a Namespace
with Kubernetes · IT Infrastructure Management
Apply a set of governance labels and annotations to an existing namespace.
- Read the namespace to confirm it exists, capture the labels already in place, and take the resourceVersion for an optimistic-concurrency replace.
- Replace the namespace with the governance labels applied. The resourceVersion from the read makes the API server reject this write if another client changed the namespace in the meantime.
- Read the namespace back to confirm the governance labels persisted and that the namespace remains Active rather than Terminating.
What you'll need to have ready
- namespace: The namespace to label.
- labels: Governance labels to apply, such as pod-security.kubernetes.io/enforce, team, or cost-center.
- annotations: Annotations to apply alongside the labels, such as an owner contact.
For your developer
Arazzo workflow kubernetes:namespace-labeling, 3 operations: getNamespace → replaceNamespace → getNamespace. Specs on APIs.io.