besson3c
besson3c

Reputation: 148

Confused with Helm dependency management

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!

Upvotes: 2

Views: 7134

Answers (3)

Aditya Bhuyan
Aditya Bhuyan

Reputation: 458

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'.

Upvotes: 3

redInk
redInk

Reputation: 725

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/

Upvotes: 2

Rafał Leszko
Rafał Leszko

Reputation: 5541

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.

Upvotes: 2

Related Questions