Override values.yaml in a dependency chart - MongoDb

3/13/2020

I have a requirements.yaml file:

dependencies:
  - name: mongodb-replicaset
    # Can be found with "helm search <chart>"
    version: 3.13.0
    # This is the binaries repository, as documented in the GitHub repo
    repository: https://kubernetes-charts.storage.googleapis.com/

And i want to modify the values.yaml file of the mongodb-replicaset chart , espacialy this section:

auth:

  enabled: false
  existingKeySecret: ""
  existingAdminSecret: ""
  existingMetricsSecret: ""
  # adminUser: username
  # adminPassword: password
  # metricsUser: metrics
  # metricsPassword: password
  # key: keycontent

How can i override the values.yaml file on initialization in a dependency chart?

-- NyaSol
kubernetes
mongodb

2 Answers

3/13/2020

You put the values under a key matching the name of the upstream chart so

mongodb-replicaset:
  auth:
    enabled: true
    etc etc
-- coderanger
Source: StackOverflow

3/16/2020

I would say workflow can be next:

1) download everything locally using helm dependency update - When helm dependency update retrieves charts, it will store them as chart archives in the charts/ directory.

Example from official documentation

$ helm dep up foochart
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "local" chart repository
...Successfully got an update from the "stable" chart repository
...Successfully got an update from the "example" chart repository
...Successfully got an update from the "another" chart repository
Update Complete.
Saving 2 charts
Downloading apache from repo http://example.com/charts
Downloading mysql from repo http://another.example.com/charts

2) change values.yaml under mongodb-replicaset chart as was suggested by @coderanger

3)deploy helm chart using local downloded|\modified files

Another option is to check is: parent values.yaml charts config file. As per Subcharts and Global Values:

-A subchart is considered “stand-alone”, which means a subchart can never explicitly depend on its parent chart.

-For that reason, a subchart cannot access the values of its parent.

-A parent chart can override values for subcharts.

-Helm has a concept of global values that can be accessed by all charts.

Please look into "Overriding Values from a Parent Chart" section of Subcharts and Global Values documentation - it has an example how to override subcharts values using global one.

Hope it helps

-- VKR
Source: StackOverflow