pulumi-kubernetes
pulumi-kubernetes copied to clipboard
Cannot override Helm values.yaml file reference
Problem description
Some charts provide several values.yaml
files. For instance in the bitnami repository you often see a separate file for production:
https://github.com/bitnami/charts/blob/master/bitnami/prometheus-operator/values-production.yaml
The default values for charts is always taken from values.yaml
which is hardcoded.
Currently there is no way to reference another file to set default values as far as I can see.
Is it intentional that the file reference is hardcoded? It seems useful to allow selecting another one as the default values.yaml
.
dotnet: https://github.com/pulumi/pulumi-kubernetes/blob/aa85b8bccb47f9a85f9c779fb68fa6c9b7ed2a55/sdk/dotnet/Helm/ChartBase.cs#L90
nodejs: https://github.com/pulumi/pulumi-kubernetes/blob/2bf17bb5f89fa0edda750c06485a452e0197d3d8/sdk/nodejs/helm/v2/helm.ts#L185 https://github.com/pulumi/pulumi-kubernetes/blob/2bf17bb5f89fa0edda750c06485a452e0197d3d8/sdk/nodejs/helm/v3/helm.ts#L185
go https://github.com/pulumi/pulumi-kubernetes/blob/5971a9ec1bc933cbce733eaadbf0e504db0e678d/sdk/go/kubernetes/helm/v2/chart.go#L316 https://github.com/pulumi/pulumi-kubernetes/blob/5971a9ec1bc933cbce733eaadbf0e504db0e678d/sdk/go/kubernetes/helm/v3/chart.go#L316
python https://github.com/pulumi/pulumi-kubernetes/blob/52a81693075af74c31d925e69af7af62b2f444b1/sdk/python/pulumi_kubernetes/helm/v2/helm.py#L536 https://github.com/pulumi/pulumi-kubernetes/blob/52a81693075af74c31d925e69af7af62b2f444b1/sdk/python/pulumi_kubernetes/helm/v3/helm.py#L536
Suggestions for a fix
I would suggest we make values.yaml
overridable through BaseChart(Arg/Opts)
(depending on language).
If that's ok, what would be the preferred approach here? I'm happy to provide a PR.
This is also somewhat related to #659
@leezen , do you have some update of this requirement? because there are so many helm values.yaml file in existing legancy environment. It is quite hard to rewrite into code. It is a really useful function to imgrate existing helm system smoothly.
IIUC, the Helm spec has it that the values.yaml
file provides defaults -- that's why it will be hard-coded in the library.
Vendors sometimes include values-xyz.yaml
files as examples of non-default configuration you might want to use, but they have no status other than providing an example. The way you'd use an example like that would be to download the file from the repo, or copy its contents into a local file, then refer to it when you invoke Helm:
helm install [...] --values ./values-production.yaml
Bitnami removed all of the values_production.yaml
files from charts there, on the basis that people were getting the wrong idea (!): https://github.com/bitnami/charts/issues/5095
@leezen , do you have some update of this requirement? because there are so many helm values.yaml file in existing legancy environment. It is quite hard to rewrite into code. It is a really useful function to imgrate existing helm system smoothly.
I can't agree with you more,any update?
I don't think this will be addressed as it's formulated -- the values.yaml file is part of the chart, not something you supply when you install the chart. When values-*.yaml
files are included with the chart, they are as examples, or for overlaying on the defaults. To use them with the Helm command line tool, you would either refer to them with the flag -f
to combine them with the defaults, or build you own chart which adapts the values.yaml file to your chosen defaults.
That said, helm.Chart
does not support referring to a file for overlay values (https://www.pulumi.com/registry/packages/kubernetes/api-docs/helm/v3/chart/#inputs), the equivalent of -f
, so there is certainly a lack here. The issue https://github.com/pulumi/pulumi-kubernetes/issues/659 covers that lack.
helm.Release
does let you refer to files for values (https://www.pulumi.com/registry/packages/kubernetes/api-docs/helm/v3/release/#valueyamlfiles_go). If you can use a helm.Release
instead of a helm.Chart
, that will avoid the limitation of helm.Chart not supporting values from files.
I'm going to close this issue as "by design", since #659 addresses the problem given here, in line with how the Helm tooling itself works. (If anyone has a reason #659 cannot solve their problem in the way this issue would, we can always reopen this one.)