Likewise, given an existing namespace, how can I a...
# general
o
Likewise, given an existing namespace, how can I apply a label to it?
g
Can you elaborate? Namespace created by pulumi, or out of band?
o
Either, but for a namespace created by pulumi, can I later label it, or does the labeling have to be declared at creation time?
g
The properties are set when you instantiate the resource and run an update. However, you could change the labels later and then run another update. Not sure if that answers your question. Did you have a specific use case in mind?
o
@gorgeous-egg-16927 ah, okay, I'm thinking that we might want to manage a label on a namespace as its own "resource", because certain cross-cutting infrastructure jobs might make requirements
e.g.: for a networkpolicy for the
app
namespace, we need to label the
nginx-ingress
namespace, like so:
Copy code
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: NetworkPolicy
metadata:
  name: foo
spec:
  podSelector:
    matchLabels:
      app: foolts
      release: {{ .Release.Name }}
  ingress:
  - from:
    - namespaceSelector:
        matchLabels:
          name: foo-nginx-ingress
The namespace might have other labels, but it needs the
foo-nginx-ingress
. So it might be nice to be able to say, "Hey, this namespace needs a label", without affecting anything other labels already on it. Effectively a "label set membership" resource.