Regarding <https://github.com/pulumi/examples/blob...
# general
c
Regarding https://github.com/pulumi/examples/blob/master/kubernetes-ts-exposed-deployment/index.ts, is there a way to get the unique hash from to the deployment name added to the pod labels? if i make two of these deployments to a namespace there is no unique label tying the pods back to their deployment.
b
Maybe the section on Outputs will be helpful here https://pulumi.io/reference/programming-model.html#output
c
@calm-greece-42329 our behavior here is precisely the same as Kubernetes. The
.metadata.ownerReference
will be set for supported versions of the API server.
c
Can I use the output of a resource, from inside that resource? 🤔
OK @creamy-potato-29402, maybe its just a bug in the tectonic pod filtering. It definitely gets the count right on one page but the list of pods on the other page shows me everything that matches the label selector
c
cc @breezy-hamburger-69619 who worked at CoreOS, I’m actually not sure of their behavior here.
It seems like a strange thing to put in the labels, though, since there is a dedicated field for this.
the pod count probably comes from the deployment itself.
c
fair, i think i am succumbing to a tectonic ui bug more than anything else at this point.
i think it might be nice to have the stack name in my resource names? i am not 100% sure here either. I know the hashes keep things from colliding but if i have a bunch of people with stacks deployed, it may become chaos
c
that’s reasonable, that actually seems liek a good fit for labels though
c
actually having the stack name may be needed in those label selectors to prevent two different stacks from getting picked up in the same service
jinx
c
indeed.
b
@calm-greece-42329 you’re in good hands with @creamy-potato-29402 🙂
b
I personally use a prefix for all my resources. I defined the prefix in my pulumi config
c
sometimes people predictable prefixes, but this is more common in AWS where there aren’t namespaces.
let me think for a second about the labels referencing the name though…
this is an interesting use case that I don’t think we have super good support for.
c
we shove product codes into our names in AWS, i was even thinking we may need some kind of policy enforcing module
@brainy-magician-83981 the prefix is a good idea. is that something you are manually prepending to all names or is there some special variable?
c
basically for some
Copy code
const foo = new Deployment("...", { ... })
somehow you’d need to get
foo.metadata.name
into the labels of the second argument, which is semantically strange, because
foo.metadata.name
is basically a
Promise<string>
that is computed after the resource has finished initializing.
er,
c
i kind of had that problem getting the name of a configmap into a volume
c
not really, pulumi adds the suffix, but we have no way to do this sort of multi-step passing of computed fields around in our model.
c
Copy code
name: envoyConfigMap.id.apply(function(t) {
                return t.split("/")[1];
              })
b
Yes, I manually prepend the prefix to all my resource names
c
we’re working on that sort of thing, btw