Page MenuHomePhabricator

Add label kubernetes.io/metadata.name to all namespaces
Open, MediumPublic

Description

kubernetes.io/metadata.name

Example: kubernetes.io/metadata.name=mynamespace

Used on: Namespaces

When the NamespaceDefaultLabelName feature gate is enabled, the Kubernetes API server sets this label on all namespaces. The label value is set to the name of the namespace.

This is useful if you want to target a specific namespace with a label selector.

This comes in handy when writing Calico rules as well as potentially Ingress rules. The NamespaceDefaultLabelName landed in 1.21 with being GA in 1.22 but as as we have full control over namespace creation, we can easily add the label already ourselves already.

Event Timeline

JMeybohm triaged this task as Medium priority.Tue, Sep 7, 10:24 AM
JMeybohm created this task.

Change 720997 had a related patch set uploaded (by Elukey; author: Elukey):

[operations/deployment-charts@master] helmfile: add the ability to inject labels to Namespaces

https://gerrit.wikimedia.org/r/720997

Change 720997 merged by Elukey:

[operations/deployment-charts@master] helmfile: add the ability to inject labels to Namespaces

https://gerrit.wikimedia.org/r/720997

@JMeybohm the code is deployed, feel free to take over and turn on NamespaceDefaultLabelName :)

Change 723215 had a related patch set uploaded (by Elukey; author: Elukey):

[operations/deployment-charts@master] helmfile.d: force quotation to namaspace label values

https://gerrit.wikimedia.org/r/723215

Change 723215 merged by Elukey:

[operations/deployment-charts@master] helmfile.d: force quotation to namaspace label values

https://gerrit.wikimedia.org/r/723215