https://pulumi.com logo
#general
Title
# general
o

orange-policeman-59119

02/26/2019, 7:23 PM
Likewise, given an existing namespace, how can I apply a label to it?
g

gorgeous-egg-16927

02/26/2019, 7:25 PM
Can you elaborate? Namespace created by pulumi, or out of band?
o

orange-policeman-59119

02/26/2019, 7:29 PM
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

gorgeous-egg-16927

02/26/2019, 8:00 PM
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

orange-policeman-59119

02/27/2019, 1:25 AM
@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.