potatopotato
potatopotato

Reputation: 1164

kube helm charts - multiple values files

it might be simple question but can't find anywhere if it's duable;

Is it possible to have values files for helm charts (stable/jenkins let's say) and have two different values files for it?

I would like in values_a.yaml have some values like these:

master:
  componentName: "jenkins-master"
  image: "jenkins/jenkins"
  tag: "lts"
...
  password: {{ .Values.secrets.masterPassword }}

and in the values_b.yaml - which will be encrypted with AWS KMS

secrets:
  masterPassword: xxx

the above code doesn't work and wanted to know, as you can put those vars in kube manifests like it

apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Values.config.name }}
  namespace: {{ .Values.config.namespace }}
...

can they be somehow passed to other values files


EDIT:

If it was possible I would just put the

master:
  password: xxx

in values_b.yaml but vars cannot be duplicated, and the official helm chart expects the master.password val from that file - so has to somehow pass it there but in encrypted way

Upvotes: 1

Views: 7884

Answers (2)

im7mortal
im7mortal

Reputation: 111

The valid answer is from David Maze in the comments of the response of Kamol Hasan.

You can use multiple -f or --values options: helm install ... -f values_a.yaml -f values_b.yaml. But you can't use templating in any Helm values file unless the chart specifically supports it (using the tpl function).

If you use multiple -f then latest value files override earlier ones.

Upvotes: 3

Kamol Hasan
Kamol Hasan

Reputation: 13456

I'm not quite sure but this feature of helm might help you.

Helm gives you the functionality to pass custom Values.yaml which have higher precedence over the fields of the main Values.yaml while performing helm install or helm upgrade.

For Helm 3

$ helm install <name> ./mychart -f myValues.yaml

For Helm 2

$ helm install --name <name> ./mychart --values myValues.yaml

Upvotes: 4

Related Questions