How to update image tag in helm values.yaml with Kustomize and GitHub actions?

2/15/2022

I am applying the app-of-apps with Argo CD on my application deployments, where I have a directory with the applications definitions, and then a directory with resource definitions and a kustomization.yaml file. When a new version is released, all I do is run kustomize set image ... in a pipeline that will issue an autocommit and Argo will pick it up.

I currently have the following structure of files and it is repeated for other environments, like staging and dev.

deployments
├── production
│   ├── app-1
│   │   ├── kustomization.yaml
|   |   └── deployment.yaml
│   ├── app-2
│   │   ├── kustomization.yaml
|   |   └── deployment.yaml
└───└── apps
        ├── app1.yaml
        └── app2.yaml 

I know decided to throw myself in the Helm world and create charts for each application with the required resource definitions. Then, in each environment folder I will keep an appropriate values.yaml file to override the proper values for each environment application deployment.

I would like to have the same flow as before, where the pipeline updates the new image tag (this time in the values.yaml file), creates the autocommit and Argo will sync it.

Is it possible to somehow do a kustomize set image... in each of the values.yaml file accordingly? Or what would be a smarter approach here?

-- everspader
argocd
kubernetes
kubernetes-helm
kustomize

1 Answer

2/15/2022

Step 1:

  • name: image-tag

value: "{{ .Values.image_tag }}"

Step 2:

kustomize helmfile -i values.

-- Kelly A Smith
Source: StackOverflow