I am wondering and apparently have not yet found anywhere if there is a way via which I can specifically override the value of "version" key's value from the dependencies chart in Helm
# Chart.yaml
dependencies:
- name: bitnami/postgresql
version: **"8.10.5"**
repository: "https://charts.bitnami.com/bitnami"
I tried something like below:
# Chart.yaml
dependencies:
- name: bitnami/postgresql
version: "{{.Values.postgresql.version}}"
repository: "https://charts.bitnami.com/bitnami"
and
# Values.yaml
postgreSQL:
version: "8.10.5"
But I am getting below error:
Error: cannot load Chart.yaml: error converting YAML to JSON: yaml: invalid map key: map[interface {}]interface {}{".Values.postgresql.version":interface {}(nil)}
If this is currently not possible then can someone advise how do you update the "version" of dependencies in Charts.yaml whenever new version is available of them?
It's not super well documented in the Helm documentation – the generic helm dependency
command documentation mentions it, but not the main discussion of chart dependencies – but the version:
field is optional, and it uses semantic versioning if it is present. Helm maintains a separate Chart.lock
file that lists precise versions of chart dependencies, and the helm dependency update
command will update that file.
So for your uses you might say:
dependencies:
- name: bitnami/postgresql
version: '^8' # Any 8.x.x version, but not version 7 or 9
repository: "https://charts.bitnami.com/bitnami"
Or, if you're not configuring the dependency chart at all, just leave out the version:
line entirely and use whatever the latest version is.
# Install the chart using the specific Chart.lock version
helm install myservice .
# Get a newer version in Chart.lock and upgrade the database
rm Chart.lock
helm dependency update
helm upgrade myservice .
Do check the Chart.lock
file into source control, so you have reproducible deployments.
All of this is also true if you're using the older, Helm v2-compatible layout that lists dependencies in a separate requirements.yaml
file. In this case the lock file is requirements.lock
, but version:
is still a semantic version constraint and the same helm dependency
commands update the lock file.