Issue
I have a task, to get jenkins variables to apply to Helm chart value.
As I googled I recognized that I have to use secret part in k8s. We can not put variable's value into value.yaml
file.
But for secret we have to put value into yaml file.
So how to get variable which we define in Jenkins job and put it to value of helm chart .
I think we have a solution for this but I didnot find out.
Appriciated your help .
Solution
You can first use is to --set
export USERNAME=hello_user
this way you can overwrite the values.yaml
helm install --set username=$USERNAME [chart name] [chart path]
Option : 2
Inject file to Jenkin job
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-auth
stringData::
{{ .Files.Get "<chart_base_directory>/secrets" | indent 2 }}
You can also checkout this : How to pull environment variables with Helm charts
Answered By - Harsh Manvar