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

calm-greece-42329

02/21/2019, 6:46 PM
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

brainy-magician-83981

02/21/2019, 6:50 PM
Maybe the section on Outputs will be helpful here https://pulumi.io/reference/programming-model.html#output
c

creamy-potato-29402

02/21/2019, 6:51 PM
@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

calm-greece-42329

02/21/2019, 6:51 PM
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

creamy-potato-29402

02/21/2019, 6:52 PM
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

calm-greece-42329

02/21/2019, 6:53 PM
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

creamy-potato-29402

02/21/2019, 6:55 PM
that’s reasonable, that actually seems liek a good fit for labels though
c

calm-greece-42329

02/21/2019, 6:55 PM
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

creamy-potato-29402

02/21/2019, 6:55 PM
indeed.
b

breezy-hamburger-69619

02/21/2019, 6:55 PM
@calm-greece-42329 you’re in good hands with @creamy-potato-29402 🙂
b

brainy-magician-83981

02/21/2019, 6:55 PM
I personally use a prefix for all my resources. I defined the prefix in my pulumi config
c

creamy-potato-29402

02/21/2019, 6:56 PM
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

calm-greece-42329

02/21/2019, 6:57 PM
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

creamy-potato-29402

02/21/2019, 6:58 PM
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

calm-greece-42329

02/21/2019, 6:59 PM
i kind of had that problem getting the name of a configmap into a volume
c

creamy-potato-29402

02/21/2019, 6:59 PM
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

calm-greece-42329

02/21/2019, 6:59 PM
Copy code
name: envoyConfigMap.id.apply(function(t) {
                return t.split("/")[1];
              })
b

brainy-magician-83981

02/21/2019, 6:59 PM
Yes, I manually prepend the prefix to all my resource names
c

creamy-potato-29402

02/21/2019, 6:59 PM
we’re working on that sort of thing, btw