How to Helm -set an array of objects (array of maps)?

9/23/2019

I am trying to install Jenkins with Helm unto an Kubernetes cluster, but with tls (cert-manager, lets encrypt).

The difficulty is that the key, master.ingress.tls, takes an array, an array of objects.

helm install --name jenkins --namespace jenkins --set
master.serviceType=ClusterIP,master.ingress.enabled=true,
master.ingress.hostName=jenkins.mydomain.com,
master.ingress.annotations."certmanager\.k8s\.io\/cluster-issuer"=letsencrypt-prod,
master.ingress.tls={hosts[0]=jenkins.mydomain.com,
secretName=jenkins-cert} stable/jenkins

The relevant part is:

master.ingress.tls={hosts[0]=jenkins.mydomain.com,secretName=jenkins-cert}

Different errors arise with this and also if I try changing it:

no matches found: master.serviceType=ClusterIP,master.ingress.enabled=true,master.ingress.hostName=jenkins.mydomain.com,master.ingress.annotations.certmanager.k8s.io/cluster-issuer=letsencrypt-prod,master.ingress.tls={master.ingress.tls[0].secretName=jenkins-cert}

or

release jenkins failed: Ingress in version "v1beta1" cannot be handled as a Ingress: v1beta1.Ingress.Spec: v1beta1.IngressSpec.TLS: []v1beta1.IngressTLS: readObjectStart: expect { or n, but found ", error found in #10 byte of ...|],"tls":["secretName|..., bigger context ...|eName":"jenkins","servicePort":8080}}]}}],"tls":["secretName:jenkins-cert"]}}

Trying this does returns the first error above.

Different solutions tried:

- {hosts[0]=jenkins.mydomain.com,secretName=jenkins-cert}
- {"hosts[0]=jenkins.mydomain.com","secretName=jenkins-cert"}
- {hosts[0]:jenkins.mydomain.com,secretName:jenkins-cert}
- "{hosts[0]=jenkins.mydomain.com,secretName=jenkins-cert}"
- master.ingress.tls[0].secretName=jenkins-cert
- {master.ingress.tls[0].hosts[0]=jenkins.mydomain.com,master.ingress.tls[0].secretName=jenkins-cert}

How to Helm -set this correctly?

-- Espen Finnesand
jenkins
kubernetes-helm
kubernetes-ingress

1 Answer

9/23/2019

This was solved adding a custom my-values.yaml

my-values.yaml:

master:
  jenkinsUrlProtocol: "https"
  ingress:
    enabled: true
    apiVersion: "extensions/v1beta1"
    labels: {}
    annotations: 
      kubernetes.io/ingress.class: nginx
      kubernetes.io/tls-acme: "true"
      kubernetes.io/ssl-redirect: "true"
    hostName: jenkins.mydomain.com
    tls:
      - hosts:
        - jenkins.mydomain.com
        secretName: cert-name

Install command:

helm install --name jenkins -f my-values.yaml stable/jenkins

-- Espen Finnesand
Source: StackOverflow