-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to update varreference #2704
Comments
In your kustomization.yaml, add field:
And in my_variables.yaml file, which should be in the same directory as the kustomization.yaml, you can reference different fields like so:
The above example would allow you to add your vars to the volumeMounts name for a Deployment, or the configMap name for a Deployment. This logic can be used to point at and add your envs to different fields in any k8s resource. To answer your question of why a list of fields is required in the first place, I can't answer that. I do also wonder why this is necessary. I don't see why having to create a separate list in order to use your vars is a good idea personally. |
@neilharris123 provided a good example for customizing Another method to customize the fieldSpecs is using You can choose the way you prefer. |
Hi,
I am kind of lost here. I need to reference a field from custom object in one of my variables and obviously, it is not in the default list of of "referenceable" fields/objects allowed by kustomize.
The documentation here https://kubernetes-sigs.github.io/kustomize/faq/#some-field-is-not-transformed-by-kustomize mentions adding a configurations field. But the example there https://github.com/kubernetes-sigs/kustomize/blob/master/examples/configureBuiltinPlugin.md#the-old-way-to-do-this talk about it being the "old way" of doing it.
What is the simplest and recommended way of adding a field to the list of fields that can be referenced by variables?
As a bonus point question, why is there a list of fields that are allowed in the first place? Is there any risk in simply letting people reference any object field containing a string?
The text was updated successfully, but these errors were encountered: