I have used almost all possible ways to render the helm template. But now I am out of ideas and seeking help:
values.yaml:
rollout:
  namespace: xyz
  project: default
  baseDomain: "stage.danger.zone"
  clusterDomain: cluster.local
  
manifest.yaml
apps:
  certmanager:
    source:
      repoURL: 'https://artifactory.intern.example.io/artifactory/helm'
      targetRevision: 0.0.6
      chart: abc
    helm:
      releaseName: abc
    values:
      global:
        imagePullSecrets:
          - name: artifactory
      baseDomain: "{{ .Values.rollout.baseDomain }}"
When I try to render the template using the below command in my main.yaml file that will produce the final result:
values: {{- tpl (toYaml $appValue.values | indent 6) $ }}
Expected result:
baseDomain: stage.danger.zone (without quotes)
What I am getting is:
baseDomain: 'stage.danger.zone'
If I try to remove the double quotes from:  baseDomain: "{{ .Values.rollout.baseDomain }}", I get the following error:
[debug] error converting YAML to JSON: yaml: invalid map key: map[interface {}]interface {}{".Values.baseDomain":interface {}(nil)}
Any help or ideas to achieve the same?
This is an expected behaviour by YAML.
One dirty and bad hack would be
values: {{- tpl (toYaml $appValue.values | fromYaml | toYaml | indent 6) $ }}
and then you will not see the single quotes.
However, This is not a problem at all even if you have ' single quotes in your value. You can include this variable for example something like this below:
      hosts:
        - host: some-gateway.{{ .Values.rollout.baseDomain }}
          serviceName: gateway
          servicePort: 8080
          path: /
Then it will show you your variable value without ' single quotes.
Example rendered output:
        hosts:
        - host: some-gateway.stage.danger.zone
          path: /
          serviceName: gateway
          servicePort: 8080
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With