Skip to content
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

Pass values to template action in addition yaml file #96

Open
MatiasNMont opened this issue Jul 11, 2022 · 3 comments
Open

Pass values to template action in addition yaml file #96

MatiasNMont opened this issue Jul 11, 2022 · 3 comments

Comments

@MatiasNMont
Copy link

Hi! I have a brief question. Are there some way to pass additional values to template action? i.e : I want to replicate command helm template <my-template> . --set value="myvalue".

If you use function func (helmclient.Client).TemplateChart(spec *helmclient.ChartSpec) , Type *helmclient.ChartSpec doesn't include something as "values", It only include ValuesYaml.

@chaehni
Copy link

chaehni commented Jul 12, 2022

I think the documentation for ChartSpec is wrong. The ValuesYaml field is not the values.yaml content. It's just an additional values file that you would normally set via -f flag, i.e. template <my-template> . -f some_values.yaml.
So what you can do in your case is setting the ValuesYaml field to value: myvalue. The rest of the default values will be taken from the actual values.yaml file contained in the chart.

@MatiasNMont
Copy link
Author

MatiasNMont commented Jul 12, 2022

I solved it doing string concatenation. It means, as ValuesYaml is a String I could concatenate my custom values to ValuesYml. However, I think it is not clean due to You need to consider indentation. In other side, If I need to set values such as --set myapp.mystruct.mykey=myvalue , The approach I used become complicated

@chaehni
Copy link

chaehni commented Jul 12, 2022

In that case suggest you use a struct to hold your values and use a Yaml marshaller to produce the corresponding yaml string. Then you don't need to worry about indentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants