How to specify values for parent Helm chart

3/25/2019

I am trying to configure Prometheus, which is included in the Gitlab Helm chart according to https://gitlab.com/charts/gitlab/blob/master/requirements.yaml

My main issue is how to configure Prometheus, as the following values.yaml seems to be ignored:

global:
  registry:
    enabled: false
  # Disabling minio still requires to disable gitlab.minio or it will complain about "A valid backups.objectStorage.config.secret is needed"
  minio:
    enabled: false
  ingress:
    configureCertmanager: false
    class: "nginx"
 ...

prometheus:
  install: true
  rbac:
    create: true
  #kubeStateMetrics:
  #  enabled: true
  nodeExporter:
    enabled: true
  #pushgateway:
  #  enabled: true

  server:
    configMapOverrideName: prometheus-config
    configPath: /etc/prometheus/conf/prometheus.yml
    persistentVolume:
      enabled: true
      accessModes:
      - ReadWriteMany
      mountPath: /etc/prometheus/conf
      # Increase afterwards, this is for my tests
      size: 2Gi

  alertmanager:
    enabled: true
    # Overriding the default configuration with the existing one
    configMapOverrideName: "alertmanager"
    configFileName: config.yml
    persistentVolume:
      enabled: true
      accessModes:
        - ReadWriteMany
      mountPath: /prometheus
      # Increase afterwards, this is for my tests
      size: 2Gi
-- djuarez
gitlab
kubernetes
kubernetes-helm
openshift

1 Answer

3/25/2019

Checked the link you provided and it seems you are trying to add values into values.yaml of your parent chart, where prometheus is a dependent sub-chart.

Specifying values at parent values.yaml file is done exactly in the same way you provided above.

Values for sub-chart should go into a property named exactly as the sub-chart.

parentProp1: value
parentProp2: value
global:
  globalProp1: value
  globalProp2: value
subchart1:
  subchartProp1: value
  subchartProp2: value

Now in the above set of values, let's assume there is a parentchart and it has a sub-chart named subchart1. You need to understand the following points:

  • parentProp1 and parentProp2 can only be accessed in parentchart and not in subchart1 as Values.parentProp1 and Values.parentProp2
  • global properties can be accessed from both parent and subchart1 as Values.global.globalProp1
  • subchartProp1 and subchartProp2 can be accessed as Values.subchart1.subchartProp1 and Values.subchart1.subchartProp2 in parentchart
  • subchartProp1 and subchartProp2 can be accessed as Values.subchartProp1 and Values.subchartProp2 in subchart1

Also please don't forget to use proper syntax of double curly-braces {{ Values.xyz }}

I hope it helps. :)

-- Vikas Tawniya
Source: StackOverflow