Create Helm chart extending an existing chart

3/29/2019

I am using https://gitlab.com/charts/gitlab to deploy certain components included in the chart on an Openshift cluster. For now I just want to deploy the included Prometheus chart. I accomplished this, having an specific values.yaml configuration.

I want to extend the Gitlab helm chart, to do so I am adding it as a requirement of my own chart. The problem comes whenever I add the previous values.yaml as subpart of my values.

Deploying upstream Gitlab chart works with:

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:
    enabled: false
    configureCertmanager: false

nginx-ingress:
  enabled: false
registry:
  enabled: false
certmanager:
  install: false
  rbac:
    create: false
...

Deploying my chart including configuration as a subchart does not work:

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:
    enabled: false
    configureCertmanager: false


test:
  nginx-ingress:
    enabled: false

  registry:
    enabled: false
  certmanager:
    install: false
    rbac:
      create: false
  ...

I added the Gitlab upstream chart as a requirement:

dependencies:
- name: gitlab
  # Upgrade manually. Check https://gitlab.com/charts/gitlab/blob/master/requirements.yaml for the new Prometheus chart version.
  version: 1.7.1
  repository: https://charts.gitlab.io/
  alias: test

It seems that it is not fully checking my configuration, so this creates objects that the serviceAccount does not have permissions to, failing in the process. It still tries to create objects related to certmanager even if it is disabled and was correctly disabled when deploying Gitlab chart directly.

-- djuarez
gitlab
kubernetes
kubernetes-helm

1 Answer

3/29/2019

Found it. Requirements conditions for a subchart have to be specified on the first level of values.yaml.

If A has B as a subchart requirement, in order to specify the B requirement conditions, you have to set them at A level:

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:
    enabled: false
    configureCertmanager: false


test:
  nginx-ingress:
    enabled: false

  registry:
    enabled: false
  ...

certmanager:
  install: false
  rbac:
    create: false
  ...
-- djuarez
Source: StackOverflow