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

calm-greece-42329

02/04/2020, 12:40 AM
is there an example of using kubernetesx and setting annotations/custom labels?
g

gorgeous-egg-16927

02/04/2020, 1:32 AM
You can set metadata on the resource using the podBuilder (Deployment, etc).
Copy code
const deployment = new kx.Deployment("nginx", {
    metadata: {annotations: {foo: "bar"}},
    spec: pb.asDeploymentSpec()
}, {provider: provider});
If that doesn’t give you enough flexibility for your task, please file an issue with details.
c

calm-greece-42329

02/04/2020, 3:42 PM
thanks @gorgeous-egg-16927, how would i put an annotation on the pod itself, rather than the deployment? doesn’t that need to go into the deployment template metadata area?
g

gorgeous-egg-16927

02/04/2020, 4:59 PM
Ah, yes. That seems to be an oversight on the PodBuilder. Could you file an issue with details about what you were trying to do? In the meantime, you can still specify the PodTemplateSpec as usual with kx (skip the PodBuilder), which still gives the advantages of simpler syntax, easier volume/secret mounts, etc. It is still early days, so expect some rough edges.
c

calm-greece-42329

02/04/2020, 5:05 PM
👍
2 Views