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
Support for using {{ values }} within values.yaml #2133
Comments
We have talked about supporting these as environment variables (e.g. However, the file that is passed into the template engine as a source of data for templates is itself not passed through the template engine. We almost definitely will not do that because it gets very confusing for users. It also breaks both standard YAML compatibility and backward compatibility with all existing Helm versions. |
@DrEsteban Did you have anything else you wanted to discuss or anything that @technosophos didn't address? If not, we are going to close this |
@thomastaylor312 Apologies, yes one more question. @technosophos Makes sense, thanks for the reasoning. As for the "environment variables support", do you mean automatically including
Currently the templates of parent charts must adhere to/adopt the naming conventions of child charts, rather than allowing the parent templates to be independent of child naming conventions, and allowing Values.yaml to configure the entirety. If I decide to deploy serviceB separately from serviceA, I must edit the actual serviceA.yaml template to remove the Would the proposed "environment variables support" do anything to help with that? |
Oops, clicked the wrong button... |
Sharing variables between parent and child is bad enough, but it gets worse when you have a dependency tree with children that need to share variables between them as peers. e.g. for
|
I hit this problem trying to configure a default prometheus datasource for grafana using the charts under "stable". Grafana expects a url to the service, but I have no way of providing a release name prefix to the service name in the values yaml. |
@dsanders1234 I have exactly the same problem. In fact, this is a problem any time you try to build a meta-package with packages from other repositories as requirements, as they tend (rightly!) to use It would be really nice to at least be able to access the release name and namespace in |
I have similar issues as well. I am trying to pass in a k8s dns for cassandra child package which is dependent on {{ .Release.Name }} and {{ .Release.Namespace }}. |
We are also having this issue to create "fully qualified" names for subcharts that are known to the parent and child. We can workaround this by (re)creating all the charts ourselves, but this defeats the purpose of packaged and shared charts. |
This issue is also affecting me in a similar manner to those above. I am trying to create a meta-package and need to pass a base host name to all subcharts to use to define their Ingress resources. Looks like I will have to rewrite all the charts I want to use myself. |
Also affecting me. I am having nginx-ingress as a dependency for one of my charts and I want to set up tcp forwarding, but the nginx-ingress require to know the service name upfront which I am not able to provide in values.yaml. |
|
YAML also provides a handy feature called anchors, which let you easily duplicate
maps to:
Doesn't allow for concatenation or more advanced combinations, but in some cases even this limited functionality may help a lot. |
@szwed: I am aware of YAML anchors, and have used them in the past for repeated bits of config. However, they don't help you with the main reason for this issue which is to get things like the release name without having to hard code it. |
We actually hit the same limitation and ended up implementing our own layer around Helm to glue services together. You can traverse the entire service tree by using If you want to take a look, here is an example that brings up multiple instances kafka, spark, hdfs, zookeeper and twitter-based analytics around them. All from Helm charts:
|
Is there a suggestion for this besides having a hardcoded release name? I'm also running into this issue. |
I know that it is a bad solution, but as a workaround, we use gomplate (cli template processor) for values files and custom release name (in some cases it is even better - eg. when release name is as a partial hash of a commit). Might help someone. Also, gomplate supports vault and other good stuff. Still not ideal solution though. |
closing as a duplicate of #2492. |
Interesting that my issue, filed several months earlier, was the "duplicate" ;) I understand... #2492 is a lot better described. |
Thanks @MilanMasek that quote save my hours. |
For people still tracking this request, the current way forward appears to be #6876, which is apparently under review. |
This is the 3rd and last PR splitted from helm#6876, and should be merged after helm#8677 and helm#8679 There have been many requests for a way to use templates for `values.yaml` (helm#2492, helm#2133, ...). The main reason being that it's currently impossible to derive the values of the subcharts from templates. However, having templates in `values.yaml` make them unparsable and create a "chicken or the egg" problem when rendering them. This PR offers an intuitive solution without such a problem: an optional `values/` directory which templates are rendered using `values.yaml`, and then merge them with it. Those `values/` templates are only required for specific cases, work the same way as `templates/` templates, and `values.yaml` will remain the main parsable source of value. Values evaluation is now made in 2 step. First the `values.yaml` file is read. Then the `values/***.yaml` files are rendered using those values (`values/_***.tpl` files ara still allowed as helpers), and are used to update the values. For each chart and subchart, the following steps are performed: 1. If the chart has a parent, parent sub-values and global values are retrieved. 2. The chart values are coalesced with the retrieved value, the chart values are not authoritative. 3. The chart `values/` templates are rendered, the same way `templates/` templates are. The values are not updated during this step. 4. The values are updated with the rendered `values/` templates, sorted by name. The `values/` templates are authoritative and can replace values from the chart `values.yaml` or the previous `values/` templates. 5. The dependencies conditions and tags are evaluated over the updated values, and disabled dependencies are removed. 6. The same process is performed on enabled dependencies. Once values are recursively updated, and once import values are treated on the enabled dependencies, those values are used for templates rendering. Signed-off-by: Aurélien Lambert <aure@olli-ai.com>
This is the 3rd and last PR splitted from helm#6876, and should be merged after helm#8677 and helm#8679 There have been many requests for a way to use templates for `values.yaml` (helm#2492, helm#2133, ...). The main reason being that it's currently impossible to derive the values of the subcharts from templates. However, having templates in `values.yaml` make them unparsable and create a "chicken or the egg" problem when rendering them. This PR offers an intuitive solution without such a problem: an optional `values/` directory which templates are rendered using `values.yaml`, and then merge them with it. Those `values/` templates are only required for specific cases, work the same way as `templates/` templates, and `values.yaml` will remain the main parsable source of value. Values evaluation is now made in 2 step. First the `values.yaml` file is read. Then the `values/***.yaml` files are rendered using those values (`values/_***.tpl` files ara still allowed as helpers), and are used to update the values. For each chart and subchart, the following steps are performed: 1. If the chart has a parent, parent sub-values and global values are retrieved. 2. The chart values are coalesced with the retrieved value, the chart values are not authoritative. 3. The chart `values/` templates are rendered, the same way `templates/` templates are. The values are not updated during this step. 4. The values are updated with the rendered `values/` templates, sorted by name. The `values/` templates are authoritative and can replace values from the chart `values.yaml` or the previous `values/` templates. 5. The dependencies conditions and tags are evaluated over the updated values, and disabled dependencies are removed. 6. The same process is performed on enabled dependencies. Once values are recursively updated, and once import values are treated on the enabled dependencies, those values are used for templates rendering. Signed-off-by: Aurélien Lambert <aure@olli-ai.com>
I was facing the same issue i.e. passing a value set by user using --set to subchart. This came to my rescue: |
However, this will not work since Argo installs a Controller, and installing one per Release actually does not make much sense We would actually end up with multiple Controllers and PostgreSQL pods, which is actually useless. Another issue is [1], which prevents from using the Helm release name to customize the sub-charts. [1] helm/helm#2133
Can you do that with third party charts? I would assume this requires said third party to call tpl on the value you are using template syntax with, which is unlikely. If I am in control of the chart myself, I'd probably had a number of other fixes. |
Yes, that depends on the third party chart to be calling So if you find a third-party chart that doesn't call |
This won't work however when you try to pass value down to children charts #2133 (comment) |
any suggestion how we can handle "{{ .Values.images.abc-load-test }}" hyphen(-). it's failing. |
You'll have to use something like |
i am little confused here, can you give me some examples if possible? Thanks |
I'd suggest opening a new ticket if you need further help, since this is a closed ticket and not actually related to your question. In that ticket, you can post more details of what you're trying to do, including an example of what isn't working, and you should be able to get more-detailed help. |
For example:
values.yaml
It seems like it would be a common pattern to incorporate {{ .Chart.Name }} or {{ .Release.Name }} into some variables. I got the following when I tried this:
Edit
To better illustrate my issue, consider a Chart with the following structure:
serviceA Chart directory structure:
serviceB.yaml
Now, currently if I want
serviceA
to make calls toserviceB
, I would have to do something like this:serviceA.yaml
values.yaml
When I'd like to be able to do something like this:
serviceA.yaml
values.yaml
The text was updated successfully, but these errors were encountered: