I'm attempting to add some recommended labels to several k8s resources, and I can't see a good way to add labels for things that would change frequently, in this case "app.kubernetes.io/instance" and "app.kubernetes.io/version". Instance seems like a label that should change every time a resource is deployed, and version seems like it should change when a new version is released, by git release or similar. I know that I could write a script to generate these values and interpolate them, but that's a lot of overhead for what seems like a common task. I'm stuck using Kustomize, so I can't just use Helm and have whatever variables I want. Is there a more straightforward way to apply labels like these?
Asked
Active
Viewed 545 times
1 Answers
1
Kustomize's commonLabels
transformer is a common way to handle this, sometimes via a component. It really depends on your overall layout.

coderanger
- 52,400
- 4
- 52
- 75
-
Yes, I can't figure out a good way to have commonLabels (or a custom transformer) inject dynamic vars as labels. – EMC Aug 05 '21 at 17:10
-
Not sure what you mean by "dynamic". They are values like any other. – coderanger Aug 05 '21 at 19:13