Summary I have custom variable in Values.yaml file of helm, i need to assign the value of this variable during build release stage. ... clientname: XYZ ...
Steps to reproduce the behavior I tried to use eskaffold to send the vaule through setEnv
apiVersion: skaffold/v1beta2
kind: Config
build:
artifacts:
- image: 'myimagename'
context: .
docker: {}
tagPolicy:
envTemplate:
template: '{{.DOCKER_REGISTRY}}/{{.IMAGE_NAME}}/{{.CLIENT_NAME}}:{{.VERSION}}'
local: {}
deploy:
kubectl: {}
profiles:
- name: dev
build:
tagPolicy:
envTemplate:
template: '{{.DOCKER_REGISTRY}}/{{.IMAGE_NAME}}/{{.CLIENT_NAME}}:{{.DIGEST_HEX}}'
local: {}
deploy:
helm:
releases:
- name: '{{.CLIENT_NAME}}'
chartPath: charts/'{{.CLIENT_NAME}}'
setValueTemplates:
image.repository: '{{.DOCKER_REGISTRY}}/{{.IMAGE_NAME}}/{{.CLIENT_NAME}}'
image.tag: '{{.DIGEST_HEX}}'
clientname: 'myclientname'
Expected behavior the value of client name Values.yaml set to myclientname
Actual behavior the value in Values.yaml not changed
Jx version
NAME VERSION
jx 2.0.743
jenkins x platform 2.0.1182
Kubernetes cluster v1.12.10-eks-825e5d
kubectl v1.13.7-eks-c57ff8
helm client Client: v2.14.3+g0e7f3b6
git 2.16.5
Operating System CentOS Linux release 7.6.1810 (Core)
Jenkins type Classic Jenkins
Kubernetes cluster EKS
As far as I know skaffold is no longer used by the pipeline. They have switched the builder to google kaniko. The best way to insert values into your template is via charts/myapp/templates/deployment.yaml
and charts/myapp/values.yaml
.
Try adding the following to values.yaml
env:
clientname: myclientname
Update deployment.yaml template to substitute value (other vars can be used than env, this was just shown for the purposes of demoing the substitution)
# ...
spec:
containers:
env:
- name: clientname
value: {{ .Values.env.clientname }}
# ...