Helm: How to Override Value with Periods in Name

pnovotnak picture pnovotnak · Mar 27, 2018 · Viewed 7.5k times · Source

I am trying to script setup of Jenkins so that I can create and tear down Jenkins clusters programmatically with helm. I've hit an annoying snag where I cannot set a key with dots in the name. My helm values.yaml file looks like this:

---
rbac:
  install: true

Master:
  HostName: jenkins.mycompany.com
  ServiceType: ClusterIP
  ImageTag: lts
  InstallPlugins:
    - kubernetes
    - workflow-aggregator
    - workflow-job
    - credentials-binding
    - git
    - blueocean
    - github
    - github-oauth

  ScriptApproval:
    - "method groovy.json.JsonSlurperClassic parseText java.lang.String"
    - "new groovy.json.JsonSlurperClassic"
    - "staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods leftShift java.util.Map java.util.Map"
    - "staticMethod org.codehaus.groovy.runtime.DefaultGroovyMethods split java.lang.String"
    - "method java.util.Collection toArray"
    - "staticMethod org.kohsuke.groovy.sandbox.impl.Checker checkedCall java.lang.Object boolean boolean java.lang.String java.lang.Object[]"
    - "staticMethod org.kohsuke.groovy.sandbox.impl.Checker checkedGetProperty java.lang.Object boolean boolean java.lang.Object"

  Ingress:
    Annotations:
      kubernetes.io/ingress.class: nginx
      kubernetes.io/tls-acme: "true"
    TLS:
      - secretName: jenkins-mycompany-com
        hosts:
          - jenkins.mycompany.com

  Memory: "2Gi"
  # This breaks the init container
  # RunAsUser: 1000
  # FSGroup: 1000

Agent:
  Enabled: false
  ImageTag: latest

After installing cert-manager, external-dns, nginx-ingress (for now via a bash script) I install it like so:

helm install --values helm/jenkins.yml stable/jenkins

I failed to read the letsencrypt docs at all, so throughout the course of testing I used my production quota. I want to be able to add an annotation to the Ingress: certmanager.k8s.io/cluster-issuer: letsencrypt-staging so that I can continue testing (and set this as the default in the future, overriding when I'm ready for production).

The trouble is... I can't figure out how to pass this via the --set flag, since there are periods in the key name. I've tried:

helm install --values helm/jenkins.yml stable/jenkins --set Master.Ingress.Annotations.certmanager.k8s.io/cluster-issuer=letsencrypt-staging

and

helm install --values helm/jenkins.yml stable/jenkins --set Master.Ingress.Annotations.certmanager\.k8s\.io/cluster-issuer=letsencrypt-staging

I can of course solve this by adding a value that I use as a flag, but it's less explicit. Is there any way to set it directly?

Answer

sk14j picture sk14j · May 17, 2018

You need to enclose the key with quotations and then escape the dots

helm install --values helm/jenkins.yml stable/jenkins --set Master.Ingress.Annotations."certmanager\.k8s\.io/cluster-issuer"=letsencrypt-staging