You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add 'helm install --app-version' command/versioning a chart against an app version #3555
As far as I'm aware, helm install currently only supports specifying the --version flag to specify a chart version to install.
I'm unsure how the 'appVersion' field in a Chart.yaml is supposed to be used, but it seems generally useful to add support for versioning your application against a specific version (or version set) of a Chart.
Am I mis-using the appVersion field here? Should I instead be constantly building my chart to be backward compatible with previous version, or otherwise how can I infer to my users which chart version to specify when running helm install if they want a particular version (this becomes even more complex when you consider a user can also change the version deployed with something like --set image.tag, which often results in a version change of an application).
Reacted by Golo Roden, Cornelius Bock, Nick Phillips, Timur Seitosmanov, Jared Allard, cosmopetrich, Kyle Hodgetts, Andrey Moor, Jan, Mukesh Gupta and 168 more
Reacted by Michael L. Abramovich, Amit Matsil, tal, Juan Pablo Aguirre, Will Salt and Abhijeet Sharma
I just ran into this as well. I normally want the image tag to be specified at time of packaging the chart, but for debugging the app wanted to do an install with a different tag.
Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close.
Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
We specifically choose to keep the minor version of our chart aligned with the minor application version (although patch version numbers can, and do drift apart).
This is because we may add a new flag to a new release of cert-manager, and by adding support for it into the Helm chart would break compatibility with older releases of cert-manager, as they do not support the flag. This is a pretty fundamental question around Helm chart versioning in general IMO, and one we don't have a good story for.
I know it isn't recommended to try and align appVersion with chart version, but this way, a user knows they can use Helm chart version 0.3.x with any of cert-manager 0.3.x, and chart version 0.4.x with cert-manager 0.4.x. Compatibility is defined within the minor version.
Reacted by Sébastien Allamand, Alexey Sychev, Jan Mareš, Mikey, Eldad Assis, Bartłomiej Tomala, Eugene Taranov, Ana Maria Franco, Roman Dahm, Maël Valais and 2 more
Overall we haven't seen much compelling in favor of versioning the charts for our internal apps when all that is changing is the image tag used by some components. When upgrading a release, the appVersion field seems like the right place for this information.
Copying over my original proposal referenced above:
Our current workflow for deploying helm charts involves ansible tasks that call the helm upgrade CLI command and it would be nice to be able to pass a flag to set the appVersion when revising a release for the same chart version.
It may be a little weird conceptually because an appVersion is associated with a chart rather than release, but in our case we are just updating the image tag used for some containers and our workflow hasn't come to incorporate chart version and/or chart repositories yet. This may change in the future, but for now I don't see any issue with adding a flag for --app-version on install and upgrade as the field is purely informational.
Reacted by Darren Gruber, luca-tiozzo-ict, Martin Loy, n4nn31355, Elliot Wright, Huy Tran, Tomasz Żyłka, Ronald MacMaster , Bartłomiej Tomala, Toby and 5 more
when developing our own internal applications the app itself changes a lot more than the chart that deploys it. Typically our Continuous Deployment command is a helm upgrade with nothing more than --set imageTag=<new_version> (obviously, used elsewhere in the chart to set the container version) If we replace that with --app-version it would give us another visual point in helm ls to see what versions of code are deployed along with the version of the chart that is deployed.
To make this more visible otherwise I have standardized on setting a metadata tag of imageTag that gets set to the imageTag passed on install/upgrade. This allows me to use the K8s dashboard or easily create Graphana dashboards with imageTag displayed, but requires me to leave the command line and go mousey clicky.
Reacted by Labesse Kévin, Ben Langfeld, Bhaarat Sharma, Martin Loy, n4nn31355, Shaun Lodder, Bernardo García , Fernando Antivero, Alesso, weirdgiraffe and 42 more
Reacted by René Filip, Stanislav Vitkovskiy, Josiah Purtlebaugh, Labesse Kévin, Alexey Sychev, Bhaarat Sharma, Alexzander thunder Shevchenko, Martin Loy, Julien Groselle, n4nn31355 and 23 more
Reacted by Alexey Sychev, Martin Loy, RicoToothless and Mohsen
Any update on this. It seems PR from @eraac does what is requested. As @TD-4242 mentioned, we also run helm upgrade --set imageTag=<imagetag>, however this doesn't update the APP VERSION listed in output of helm ls. Being able to --set app-version or --set version will allow us to run helm upgrade such that helm ls correctly shows the version that is deployed.
Reacted by Labesse Kévin, Alex Roman, Arthur, Alexzander thunder Shevchenko, René Filip, Martin Loy, Gorakh Nath Gupta, Julien Groselle, Nikita, Yaniv Paz and 61 more
Reacted by Tomasz Żyłka, Justin Keller, Anatole Beuzon, Morteza Omidian, F, Pavel Solovyenko, michelefa1988 and syerm
Reacted by Chris Cooney, Martin Loy, Gorakh Nath Gupta, Julien Groselle, Nikita, Alexzander thunder Shevchenko, Yaniv Paz, Labesse Kévin, n4nn31355, Tamas Jambor and 16 more
So - what now?
Drop all our versions' support and flow?
Drop using Secrets?
Any ideas?
We build two packages: a helm package with just the charts, sans the env values and secrets file. We rename this package to chart-{app-version}.tgz since chart-version means nothing for us, nor does chart-version support our app-version syntax. Our app updates include any potential chart updates (same repo, using git tagging).
Then we have a second tgz that's environment specific, chart-{app-version}-{env}.tgz that includes the chart tgz, values yaml, and encrypted secrets file. This file also includes a "package.yaml" that contains values such as tag, app, and environment name for our automated scripts to deploy using helm-secrets.
We are used to identify our applications versions, or most of them, with a semantic version number. Then use use this number in the APP VERSION to identify it easily in the helm history list for rollbacks or other operations.
As the system does not allow to inject it automatically in deploy time we execute this simple command automatically on our CI/CD pipeline before the deploy command:
sed -i -E "s/^appVersion: (.*)/appVersion: ${deploy.project.version}/" ${chartPath}/Chart.yaml
It's tricky, but it works as expected.
Reacted by Dennis Peper, Tommy Falgout, Logan Mzz, Vincent, Nicolai Skogheim, eugene-shuvaev, Dave Druska, Constantin Bugneac, Christophe Blin and Eduardo Portet
@bvis
The issue with your workaround is that you have to edit the chart in your CI/CD pipeline.
If you use a centralized chart repo, then you're forced into helm pull repo/chart --untar
@jakovistuk as far as I can tell, charts that use appVersion to show the container version do this directly via Chart.yaml, as seen in nginx-ingress/Chart.yaml for example...
I haven't given much thought to this issue for quite some time, so this may be a really dumb question, but is there a way to use Helm CLI to override appVersion?
It seems like a lot of people here are asking for a way to override the ‘appVersion’ field. The original intent/request in this issue is to allow —app-version as a replacement for —version, so a user could run ‘helm fetch —app-version=v0.15.0’ and Helm would work out what the latest chart version last specified v0.15.0 as an appVersion and fetch that.
In our project/chart (cert-manager) we want to make it as clear to end users as possible which version they are installing, so allowing them to install by app version instead of chart version would be a far more natural installation experience.
That said, this issue was opened 2y ago now, and since then we have opted to just keep both of these version numbers in sync/lock-step. After a couple of years doing this, it’s been surprisingly easy and pain free, albeit users sometimes have to wait a couple of weeks for a new official release if there are changes made to our deployment manifests.
Given the age of this issue, it’s length, the huge variety of slightly different feature gates, and the changes in the Helm project since then (Helm 3, OCI charts etc), I don’t think this issue is in a good state to be driven forward as a feature request in its current form. I’m going to close this issue, but anyone else who has a similar feature request Is best to open a new issue and link to any other relevant comments in this issue to provide evidence. Hopefully that’ll work better for the Helm team’s triage process so your requests can get the visibility they need!
I also think this sort of functionality could be, and probably is best, implemented as an external tool or wrapper around
Helm, especially when taking account of the OCI changes which I think would make this trickier to implement.
Reacted by rimusz, René Filip, Elan Ruusamäe, Brodie Kurczynski and Samuel Isola
Reacted by Timothy Clarke, Chris Cooney, dron-alterpost, Evgeniy Shubin, TheNotary, Ilya, Adam Michał Małecki, Tommy Falgout, Vitor, Anis Khan and 16 more
Until this is solved (or not) Here is how i solved this in my CI/CD (GitLab):
package the chart with the app-version, then deploy it.
I know that the Chart version is not meant to be the same as the appVersion, but in our case it is fine as a workaround.
Reacted by Barhanov Artem, Steven Rosato, bitmacs, Pavel <Ven> Gulbin, Constantin Bugneac, Carol Valencia, Kal Abdi, jaroli, solawish, Pan Teparak and 2 more
If you default your image.tag to {{ .Chart.AppVersion }} then you won't need to --set it during the install, it'll already be correct. This works nicely for auto-builds as well, when your Docker images are tagged with SHA1 so the AppVersion matches the Docker image tag, and the Version is an auto-build SemVer.
There's no problem with Version being the same as AppVersion if your AppVersion happens to be SemVer.
For packages produced by my team, we're moving towards things that look for AppVersion, e.g. image.tag, defaulting to Version if AppVersion is unset. It's not a huge difference, just one less argument to helm package for tagged releases, but only makes sense if your chart is built from the same SCM as the thing you're packaging.
Charts should be independently isolated/usable units, not relying on parent-chart behaviours to function. The subchart has its own version, that's the one that its images should be using, otherwise, why is it a subchart?
In Open Match's case, the subcharts appear to be used so that XXX.enable can be used as a shortcut in the values.yaml to disable a bunch of stuff at once, but then it introduces a bunch of structural issues like this. Open Match's subcharts all make heavy use of the parent chart named templates, and also have a local version of 0.0.0-dev, so there's already two code-smells that something is not structured well.
Or perhaps I've misunderstood the observation you're making.
I think @haimari 's solution as-is only works because they use semver-compatible tags in their CI pipeline (i.e. this will be an example for a job run for tagged releases, not run on every-commit)
And then have your container image tag value be something like {{ Values.image.tag | default .Chart.AppVersion | default .Chart.Version, so that you don't need to change it on-the-fly, as @haimari does.
In your examples you have what appear to be two different git versions, is that right? Is one for the container image, and one for the chart?
With SemVer, you can't really put a git commit SHA into the meaningful part of the semver, because semver implies ordering, and git commit SHAs are not sortable.
So you'll want to use a version something like 0.0.1-alpha.<build-id>+g<gitcommitsha> where <build-id> is somelike like the pipeline or job ID from your CI system, so it's always going up you commit to your project. That way you always get the latest build when you ask for it.
In SemVer, using a - means it's a pre-release for that version, so 0.0.1-<anything> falls between the 0.0.0 and 0.0.1 releases. The part after + is the build-info, and it's ignored for sorting, hence a good place to put git SHAs or branch names or other non-sortable tracking information.
So with what you have used here, 0-3454e5 will appear to be newer than the next commit, if its SHA happens to start with a 2, e.g., 0-2764e1.
In your examples you have what appear to be two different git versions, is that right? Is one for the container image, and one for the chart?
Yes, the app and the chart - there are two independent pieces of software.
That way you always get the latest build when you ask for it.
What if i don't want (and even can't imagine) ask for the latest.
0.0.1-alpha.<build-id>+g<gitcommitsha>
This string (after interpolation) seems too long to fit into one column of standard helm list output :)
I always know what version (sha hash) of the app i want to install (pass it with --set args). And i always know what version of the chart i use (as @haimari described, i will always use git checkout chart && helm pack && helm upgrade .tar.gz locally in my ci/cd)
What could go wrong?
An error during regular helm upgrade. Ok, i will fix the error and try again (with another sha commit of the app - 99%) (or using --atomic instead)
Manual rolling back: helm rollback <RELEASE_NAME> or deployment previous sha commit through CI/CD.
What am i missed?
PS To be honestly, i want to use short sha part in version and app-version for information purpose only (during helm list)
If it's just for information purposes, then it goes after the + in a SemVer, not -. If you never care about ordering of releases, or distributing Helm charts to anyone, and your chart or app aren't already SemVer'd, then 0+g<commitsha> is a valid SemVer (equivalent to 0.0.0).
This is what Open Match's Helm auto-built charts do, for example; they are all currently 0.0.0-dev, and we've started looking at making that 0.0.0-dev+g<commitsha> so that if you're looking at what you have installed, you can at least tell which master build you have.
Reacted by Anton Osenenko and Vasco Figueira (iov42)
Activity
johngmyers commentedon Feb 27, 2018
I just ran into this as well. I normally want the image tag to be specified at time of packaging the chart, but for debugging the app wanted to do an install with a different tag.
fejta-bot commentedon May 29, 2018
Issues go stale after 90d of inactivity.
Mark the issue as fresh with
/remove-lifecycle stale.Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with
/close.Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale
munnerz commentedon Jun 6, 2018
Bringing this up again as it was raised in helm/charts#5919
Copying over parts of my recent comment:
We specifically choose to keep the minor version of our chart aligned with the minor application version (although patch version numbers can, and do drift apart).
This is because we may add a new flag to a new release of cert-manager, and by adding support for it into the Helm chart would break compatibility with older releases of cert-manager, as they do not support the flag. This is a pretty fundamental question around Helm chart versioning in general IMO, and one we don't have a good story for.
I know it isn't recommended to try and align appVersion with chart version, but this way, a user knows they can use Helm chart version 0.3.x with any of cert-manager 0.3.x, and chart version 0.4.x with cert-manager 0.4.x. Compatibility is defined within the minor version.
munnerz commentedon Jun 6, 2018
/remove-lifecycle stale
asetty commentedon Oct 24, 2018
I'd like to bring this back up for discussion.
Overall we haven't seen much compelling in favor of versioning the charts for our internal apps when all that is changing is the image tag used by some components. When upgrading a release, the appVersion field seems like the right place for this information.
Copying over my original proposal referenced above:
Our current workflow for deploying helm charts involves ansible tasks that call the helm upgrade CLI command and it would be nice to be able to pass a flag to set the appVersion when revising a release for the same chart version.
It may be a little weird conceptually because an appVersion is associated with a chart rather than release, but in our case we are just updating the image tag used for some containers and our workflow hasn't come to incorporate chart version and/or chart repositories yet. This may change in the future, but for now I don't see any issue with adding a flag for --app-version on install and upgrade as the field is purely informational.
TD-4242 commentedon Nov 5, 2018
when developing our own internal applications the app itself changes a lot more than the chart that deploys it. Typically our Continuous Deployment command is a
helm upgradewith nothing more than--set imageTag=<new_version>(obviously, used elsewhere in the chart to set the container version) If we replace that with --app-version it would give us another visual point inhelm lsto see what versions of code are deployed along with the version of the chart that is deployed.To make this more visible otherwise I have standardized on setting a metadata tag of
imageTagthat gets set to the imageTag passed on install/upgrade. This allows me to use the K8s dashboard or easily create Graphana dashboards with imageTag displayed, but requires me to leave the command line and go mousey clicky.FedeBev commentedon Nov 9, 2018
Any news about this?
Thanks
feat(helm): add --app-version flag to 'helm install/upgrade'
feat(helm): add --app-version flag to 'helm install/upgrade'
omnipresent07 commentedon Jan 5, 2019
Any update on this. It seems PR from @eraac does what is requested. As @TD-4242 mentioned, we also run
helm upgrade --set imageTag=<imagetag>, however this doesn't update the APP VERSION listed in output ofhelm ls. Being able to--set app-versionor--set versionwill allow us to runhelm upgradesuch thathelm lscorrectly shows the version that is deployed.thunder-spb commentedon Jan 11, 2019
Any updates?
ChrisCooney commentedon Jan 15, 2019
Aaaaany time soon would be lovely!
96 remaining items
guice commentedon May 15, 2020
We build two packages: a helm package with just the charts, sans the env values and secrets file. We rename this package to
chart-{app-version}.tgzsince chart-version means nothing for us, nor does chart-version support our app-version syntax. Our app updates include any potential chart updates (same repo, using git tagging).Then we have a second tgz that's environment specific,
chart-{app-version}-{env}.tgzthat includes the chart tgz, values yaml, and encrypted secrets file. This file also includes a "package.yaml" that contains values such as tag, app, and environment name for our automated scripts to deploy usinghelm-secrets.bvis commentedon May 20, 2020
We are used to identify our applications versions, or most of them, with a semantic version number. Then use use this number in the APP VERSION to identify it easily in the
helm historylist for rollbacks or other operations.As the system does not allow to inject it automatically in deploy time we execute this simple command automatically on our CI/CD pipeline before the deploy command:
It's tricky, but it works as expected.
timothyclarke commentedon May 20, 2020
@bvis
The issue with your workaround is that you have to edit the chart in your CI/CD pipeline.
If you use a centralized chart repo, then you're forced into
helm pull repo/chart --untarjakovistuk commentedon May 23, 2020
Any further progress with programatically injecting Chart.yaml/appVersion ? Are there workarounds? It would give a tremendous boost in CI/CD Helm .
davi5e commentedon May 23, 2020
@jakovistuk as far as I can tell, charts that use appVersion to show the container version do this directly via Chart.yaml, as seen in nginx-ingress/Chart.yaml for example...
I haven't given much thought to this issue for quite some time, so this may be a really dumb question, but is there a way to use Helm CLI to override appVersion?
munnerz commentedon May 24, 2020
It seems like a lot of people here are asking for a way to override the ‘appVersion’ field. The original intent/request in this issue is to allow —app-version as a replacement for —version, so a user could run ‘helm fetch —app-version=v0.15.0’ and Helm would work out what the latest chart version last specified v0.15.0 as an appVersion and fetch that.
In our project/chart (cert-manager) we want to make it as clear to end users as possible which version they are installing, so allowing them to install by app version instead of chart version would be a far more natural installation experience.
That said, this issue was opened 2y ago now, and since then we have opted to just keep both of these version numbers in sync/lock-step. After a couple of years doing this, it’s been surprisingly easy and pain free, albeit users sometimes have to wait a couple of weeks for a new official release if there are changes made to our deployment manifests.
Given the age of this issue, it’s length, the huge variety of slightly different feature gates, and the changes in the Helm project since then (Helm 3, OCI charts etc), I don’t think this issue is in a good state to be driven forward as a feature request in its current form. I’m going to close this issue, but anyone else who has a similar feature request Is best to open a new issue and link to any other relevant comments in this issue to provide evidence. Hopefully that’ll work better for the Helm team’s triage process so your requests can get the visibility they need!
I also think this sort of functionality could be, and probably is best, implemented as an external tool or wrapper around
Helm, especially when taking account of the OCI changes which I think would make this trickier to implement.
haimari commentedon Aug 10, 2020
Until this is solved (or not) Here is how i solved this in my CI/CD (GitLab):
package the chart with the app-version, then deploy it.
I know that the Chart version is not meant to be the same as the appVersion, but in our case it is fine as a workaround.
TBBle commentedon Aug 10, 2020
If you default your
image.tagto{{ .Chart.AppVersion }}then you won't need to--setit during the install, it'll already be correct. This works nicely for auto-builds as well, when your Docker images are tagged with SHA1 so the AppVersion matches the Docker image tag, and the Version is an auto-build SemVer.There's no problem with Version being the same as AppVersion if your AppVersion happens to be SemVer.
For packages produced by my team, we're moving towards things that look for AppVersion, e.g. image.tag, defaulting to Version if AppVersion is unset. It's not a huge difference, just one less argument to
helm packagefor tagged releases, but only makes sense if your chart is built from the same SCM as the thing you're packaging.woodcockjosh commentedon Aug 10, 2020
@TBBle that won't work if you are using a sub-chart to set your image tag
TBBle commentedon Aug 10, 2020
Do you mean the image.tag is in a subchart, but you're trying to use the version of a parent chart? If so, yes, that's very awkward, and won't be easy to manage. I just bounced off exactly this layout in https://github.com/googleforgames/open-match/'s Helm charts. I suggest rolling the sub-charts in question back up into the main chart in this case.
Charts should be independently isolated/usable units, not relying on parent-chart behaviours to function. The subchart has its own version, that's the one that its images should be using, otherwise, why is it a subchart?
In Open Match's case, the subcharts appear to be used so that
XXX.enablecan be used as a shortcut in the values.yaml to disable a bunch of stuff at once, but then it introduces a bunch of structural issues like this. Open Match's subcharts all make heavy use of the parent chart named templates, and also have a local version of0.0.0-dev, so there's already two code-smells that something is not structured well.Or perhaps I've misunderstood the observation you're making.
a0s commentedon Dec 6, 2020
@haimari Unfortunately, its not working (relate to #6921 ?):
But, this works:
and even this (but seems dirty):
helm version version.BuildInfo{Version:"v3.4.0", GitCommit:"7090a89efc8a18f3d8178bf47d2462450349a004", GitTreeState:"dirty", GoVersion:"go1.15.3"}
TBBle commentedon Dec 6, 2020
I think @haimari 's solution as-is only works because they use semver-compatible tags in their CI pipeline (i.e. this will be an example for a job run for tagged releases, not run on every-commit)
@a0s: I generally suggest:
And then have your container image tag value be something like
{{ Values.image.tag | default .Chart.AppVersion | default .Chart.Version, so that you don't need to change it on-the-fly, as @haimari does.In your examples you have what appear to be two different git versions, is that right? Is one for the container image, and one for the chart?
With SemVer, you can't really put a git commit SHA into the meaningful part of the semver, because semver implies ordering, and git commit SHAs are not sortable.
So you'll want to use a version something like
0.0.1-alpha.<build-id>+g<gitcommitsha>where<build-id>is somelike like the pipeline or job ID from your CI system, so it's always going up you commit to your project. That way you always get the latest build when you ask for it.In SemVer, using a
-means it's a pre-release for that version, so0.0.1-<anything>falls between the 0.0.0 and 0.0.1 releases. The part after+is the build-info, and it's ignored for sorting, hence a good place to put git SHAs or branch names or other non-sortable tracking information.So with what you have used here,
0-3454e5will appear to be newer than the next commit, if its SHA happens to start with a2, e.g.,0-2764e1.a0s commentedon Dec 6, 2020
Yes, the app and the chart - there are two independent pieces of software.
What if i don't want (and even can't imagine) ask for the latest.
This string (after interpolation) seems too long to fit into one column of standard
helm listoutput :)I always know what version (sha hash) of the app i want to install (pass it with
--setargs). And i always know what version of the chart i use (as @haimari described, i will always usegit checkout chart && helm pack && helm upgrade .tar.gzlocally in my ci/cd)What could go wrong?
helm upgrade. Ok, i will fix the error and try again (with another sha commit of the app - 99%) (or using--atomicinstead)helm rollback <RELEASE_NAME>or deployment previous sha commit through CI/CD.What am i missed?
PS To be honestly, i want to use short sha part in version and app-version for information purpose only (during
helm list)TBBle commentedon Dec 7, 2020
If it's just for information purposes, then it goes after the
+in a SemVer, not-. If you never care about ordering of releases, or distributing Helm charts to anyone, and your chart or app aren't already SemVer'd, then0+g<commitsha>is a valid SemVer (equivalent to 0.0.0).This is what Open Match's Helm auto-built charts do, for example; they are all currently
0.0.0-dev, and we've started looking at making that0.0.0-dev+g<commitsha>so that if you're looking at what you have installed, you can at least tell which master build you have.