Restrict helm to update or install if there are no changes/modification to your charts

8/3/2021

Is there a way to restrict helm to install or update if there are no new changes or modifications detected in your charts?

-- Rishi
helmfile
kubernetes
kubernetes-helm

2 Answers

8/6/2021

I found a different way to do it. Wrote a small python script to list down files changed in the last 2 commits and then filtered out the apps which were modified.

-- Rishi
Source: StackOverflow

8/3/2021

One way of doing this - take helm template on old and new chart and do a diff. Then proceed with updates only if there are changes.

Essentially,

values_diff=$(diff work-values/values.yaml work-values/values-prev.yaml | wc -l)

Where values.yaml and values-prev.yaml are outputs of helm template command on latest and previous charts.

Then you do

if [ $values_diff -gt 0 ]
then
    ....

And your update logic goes where dots are.

See full working sample here (note it has few extra things that you may omit) - https://github.com/relizaio/reliza-hub-integrations/blob/master/Helm-cd-with-Reliza/helm_configmap.yaml, which is part of my bigger tutorial here - https://worklifenotes.com/2021/05/22/helm-cd-with-reliza-hub-tutorial/

-- taleodor
Source: StackOverflow