Understand helm upgrade flags — reset-values & reuse-values

Harry Cao
3 min readFeb 14, 2019

--

I don’t know about you guys but the behavior of reset-values and reuse-values flags wasn’t that straightforward to me when I started using helm.

The story goes like this, I deployed an app using helm and everything worked as expected. Several days went by and I wanted to make changes to my app. I modified charts and updated using helm upgrade myapp my/charts/(1). This time, helm left me with confusion for hours because nothing changed in deployment release until I found out that I need to apply reset-values flag.

I got it! If I update the charts and want to apply it, I need to use reset-values flag

— reset-values: when upgrading, reset the values to the ones built into the chart

Several days later, I want to update my app again. This time, I don’t modify the charts but use set-string flag: helm upgrade myapp my/charts/ --set-string mykey1=newvalue1. In deployment release, mykey1 is set to newvalue1. In the charts inside my local machine (my/charts/), however, mykey1 is still set to oldvalue1 since I never changed it.

Days after that, I wanted to update my app one more time. I ran helm upgrade myapp my/charts/ --set-string mykey2=newvalue2 (2). Notice this time I updated mykey2 and not mykey1. Inside my/charts/, mykey1 was still set to oldvalue1.

Here, because I didn’t use reset-values flag, I expected that mykey2 would be updated to have the value of newvalue2 and mykey1 still had the value of newvalue1 as set above, instead of being reset to oldvalue1 as in the provided charts.

However, it came to my surprise that mykey1 was reset to oldvalue1 as if I was using reset-values flag. Here, if I want to only update mykey2 and keep the value of other keys, I need to apply reuse-values flag: helm upgrade myapp my/charts/ --set-string mykey2=newvalue2 --reuse-values.

— reuse-values: when upgrading, reuse the last release’s values and merge in any overrides from the command line via — set and -f. If ‘ — reset-values’ is specified, this is ignored.

So, in scenario (1), nothing got changed in deployment release as if I used reuse-values flag, although I never used it. And in scenario (2), values get reset to provided charts although I never used reset-values flags.

So what’s going here?

After days of exploring, I finally figured out the truth behind reset-values and reuse-values flags. I put it in a diagram as below:

reset-values and reuse-values flags in helm upgrade command

So, in helm upgrade command, if there doesn’t exist --set/--set-file/--set-string/--values/-f, the reuse-values flag will be used by default. If the provided charts have been updated and we want to apply it to deployment, we need to use reset-values flag. This explains scenario (1) where I ran helm upgrade myapp my/charts/, because the charts were updated, I need to apply reset-values flag.

And if there exists --set/--set-file/--set-string/--values/-f, the reset-values flag will be used by default. This explains scenario (2) where I ran helm upgrade myapp my/charts/ --set-string mykey2=newvalue2, value of mykey1 was reset to the one inside provided charts (oldvalue1). I had to explicitly use reuse-values flag to only update mykey2 and ignore(reuse) others.

I hope you have enjoyed the article and learned something new today! If you have, please consider give it a clap 👏 and follow me to never miss future tutorials. Happy coding! 🖥

--

--