How can I pass the correct parameters to Helm, using Ansible to install GitLab?

Viewed 1478

I'm writing an Ansible task to deploy GitLab in my k3s environment.

According to the doc, I need to execute this to install GitLab using Helm:

$ helm install gitlab gitlab/gitlab \
  --set global.hosts.domain=DOMAIN \
  --set certmanager-issuer.email=me@example.com

But the community.kubernetes.helm doesn't handle --set parameters and only call helm with the --values parameter.

So my Ansible task looks like this:

- name: Deploy GitLab
  community.kubernetes.helm:
    update_repo_cache: yes
    release_name: gitlab
    chart_ref: gitlab/gitlab
    release_namespace: git
    release_values:
      global.hosts.domain: example.com
      certmanager-issuer.email: info@example.com

But the helm chart still return the error You must provide an email to associate with your TLS certificates. Please set certmanager-issuer.email.

I've tried manually in a terminal, and it seems that the GitLab helm chart requires --set parameters and fail with --values. But community.kubernetes.helm doesn't.

What can I do?
Is there a bug on GitLab helm chart side?

1 Answers

it seems that the GitLab helm chart requires --set parameters and fail with --values

That is an erroneous assumption; what you are running into is that --set splits on . because otherwise providing fully-formed YAML on the command line would be painful

The correct values are using sub-objects where the . occurs:

- name: Deploy GitLab
  community.kubernetes.helm:
    update_repo_cache: yes
    release_name: gitlab
    chart_ref: gitlab/gitlab
    release_namespace: git
    release_values:
      global:
        hosts:
          # https://gitlab.com/gitlab-org/charts/gitlab/-/blob/v4.4.5/values.yaml#L47
          domain: example.com
      # https://gitlab.com/gitlab-org/charts/gitlab/-/blob/v4.4.5/values.yaml#L592-595
      certmanager-issuer:
        email: info@example.com
Related