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.
Your approach won't work, because the template engine ({{ .Values.myvar }}) works only in the template folder.
# Chart.yaml
dependencies:
- name: bitnami/postgresql
version: "{{.Values.postgresql.version}}" # Won't be replaced
repository: "https://charts.bitnami.com/bitnami"
I am afraid that the helm team won't change this behaviour according to this discussion:
https://github.com/helm/helm/issues/2492
Apperantly the only way I can think of, is to replace the version with a shell script and afterwards calling the helm commando.
sed -i 's/version: "[0-9].[0-9].[0-9]"/version: "9.9.9"/' Chart.yaml
helm install ....
Related
I have a repo, where I develop 2 charts. Root chart and a sub-chart.
This is a root chart's chart.lock
apiVersion: v2
name: tolgee
description: A Helm chart to deploy Tolgee
type: application
version: 0.1.0
appVersion: 1.16.0
dependencies:
- name: tolgee
version: 0.1.0
repository: "file://../tolgee"
alias: tolgee
I am using this chart to actually deploy the thing to my cluster.
While I am working on the project, I am often also changing the sub-chart stored in ../tolgee. Every time I make a change I need to run helm dep update. To get the updated version. I wonder, why the subchart has to be stored as .tgz, when it might simply be a link.
Am I doing something wrong?
If one chart depends on another, you can put an unpacked copy of the dependency into the parent chart's charts subdirectory.
This should work with a symlink, too. So if you're actively working on the subchart but need to install it via the parent, you should be able to
mkdir charts
cd charts
ln -s ../../tolgee tolgee
If you watch carefully what helm dep up does, it copies in an archive file charts/tolgee-0.1.0.tgz. While the dependency is in that compressed form, you do in fact need to run helm dep up if you make any change.
I'm trying to create my own helm chart package for prometheus and its components but I am trying to reuse parts of the kube-prometheus-stack helm chart on github : https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack
I've modified the templates to my liking but when I try to create a package for them which I can then upload it to my repo I get the following :
helm package prometheus-chart/
Error: found in Chart.yaml, but missing in charts/ directory: alertmanager, kube-state-metrics, prometheus-node-exporter, prometheus-pushgateway
How can I get the templates from that repo, and create a deployable package from my local machine which I can then share it?
These components alertmanager, kube-state-metrics, prometheus-node-exporter, prometheus-pushgateway are added as dependencies in the Chart.yaml. So the helm will check whether these dependencies are built or not.
So you need to build the dependencies as well by using this command
$ helm dependency build CHARTNAME
Example:
$ helm dependency build alertmanager
Once the dependencies are built you can update them using update command
$ helm dependency update CHARTNAME
For more detailed information refer to this official documents doc1 doc2
There are dependencies added in the Chart.yml file that are not downloaded, you need to run the command helm dependency build <CHART> in order to fetch them
I am trying to install memcached from helm charts stable repo
My requirements.yaml file looks like this
- name: stable/memcached
repository: https://charts.helm.sh/stable
version: 2.7.1
I am getting this error:
Error: stable/rabbitmq chart not found in repo https://charts.helm.sh/stable
I tried this on my computer
helm repo add stable https://charts.helm.sh/stable
helm search memcached --versions | grep 2.7.1
and I can see
stable/memcached 2.7.1 1.5.12 Free & open source, high-performance, distributed memory ...
Can someone advice why I am seeing this error?
I have just replaced the chart name in my requirements.yaml file
- name: memcached
repository: https://charts.helm.sh/stable
version: 2.7.1
In my parent chart Chart.yaml I have
dependencies:
- name: postgresql11
repository: "#myrepo"
version: 8.9.7
condition: postgresql11.enabled
- name: postgresql12
repository: "#myrepo"
version: 8.9.7
condition: postgresql12.enabled
In the same parent chart values.yaml I have:
postgresql11:
enabled: true
postgresql12:
enabled: false
My problem is that unless I run helm dep update neither subchart is downloaded and installed (I'm expecting the postgresql11 subchart to be installed). If I run helm dep update both subcharts are pulled, ignoring my ruleset which indicates that only postgresql11 should be installed.
Can anybody shed some light on what I'm doing wrong here, and what the relationship is between helm dependency build/update and the conditional rules in Chart.yaml? I'm also curious why there is an enabled field in Chart.yaml which seems redundant with the condition field? I'm running Helm 3.2.4.
Thanks in advance!
The command helm dep update does not use values.yaml and that is why your dependencies are updated even if you have them disabled in values.yaml.
To understand the enabled for dependencies, read the section "Tags and Condition fields in dependencies" in the Helm: Charts documentation.
helm dependency update command will download all the subchart specified in the dependencies option and download it to the charts/ directory, even you have them disabled in values.yaml. However, only enabled charts will be installed.
To release the new changes/version you need to run the command helm upgrade <chart-name> <chart-dir-location>.
Please refer https://helm.sh/docs/helm/helm_upgrade/
Helm Dependency Update:
Update the on-disk dependencies to mirror Chart.yaml.
This command verifies that the required charts, as expressed in 'Chart.yaml', are present in 'charts/' and are at an acceptable version. It will pull down the latest charts that satisfy the dependencies, and clean up old dependencies.
On successful update, this will generate a lock file that can be used to rebuild the dependencies to an exact version.
Helm Dependency Build:
Build out the charts/ directory from the Chart.lock file.
Build is used to reconstruct a chart's dependencies to the state specified in the lock file. This will not re-negotiate dependencies, as 'helm dependency update' does.
If no lock file is found, 'helm dependency build' will mirror the behavior of 'helm dependency update'.
I have installed a helm chart with subcharts and I want to find out which version of the subchart is installed. Is there any possible way in helm 3?
Following official Helm documentation:
Helm.sh: Subcharts and globals
Helm.sh: Charts
Helm.sh: Helm dependency
You can get the version of a subchart used by a chart by following below example:
Download the chart with $ helm pull repo/name --untar
Go inside the chart directory
Invoke command: $ helm dependency list
You can get a message that there are no dependencies:
WARNING: no dependencies at gce-ingress/charts
You can also get a message with dependencies and their versions:
NAME VERSION REPOSITORY STATUS
kube-state-metrics 2.7.* https://kubernetes-charts.storage.googleapis.com/ unpacked
Additionally you can check the content of the prometheus/charts/kube-state-metrics/Chart.yaml for additional information.
Please let me know if that helped you.