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
helm upgrade --install doesn't perform an install/upgrade if the first ever install fails #3353
Using helm upgrade --install is a nice way to install or upgrade depending on if the release exists. But it looks like there's a bug in the logic; its not handling failed installs. In my case the first install failed; then a subsequent attempt wasn't even made as it crashes out immediately.
Maybe if the last release failed then helm upgrade --install should delete it and install again?
$ helm list
NAME REVISION UPDATED STATUS CHART NAMESPACE
foo 2 Wed Jan 17 11:48:08 2018 FAILED something-0.0.1 default
$ helm upgrade "foo" . --install
Error: UPGRADE FAILED: "foo" has no deployed releases
Reacted by Andrey Klimentyev, Timofey Kirillov, Vitalii Sn, Zach Langbert, leigh capili, Aaron Roydhouse, Cornelius Bock, Simon Wydooghe, Josué Rodriguez, Junwei Zhao and 77 more
This was intentional by design of #3097. Basically, diffing against a failed deployment caused undesirable behaviour, most notably this long list of bugs:
If your initial release ends up in a failed state, we recommend purging the release via helm delete --purge foo and trying again. After a successful initial release, any subsequent failed releases will be ignored, and helm will do a diff against the last known successful release.
Now that being said, it might be valuable to not perform a diff when no successful releases have been deployed. The experience would be the same as if the user ran helm install for the very first time in the sense that there would be no "current" release to diff against. I'd be a little concerned about certain edge cases though. @adamreese do you have any opinions on this one?
Reacted by Roman Chernobelskiy, Nick DeCoursin, Luis Mirabal, Austin Heiman, George G, Andy Rudge, Georgios Keramidas, Matthieu Larcher and Dav1dPF
Reacted by Fernando Barbosa, Ahmed Kamel, Scott Shorkey, Grant Sherrick, zee.shen, Aaron Walker, JM, Bob Hall, Harry Lee, OlGe404 and 40 more
The suggested fix seems completely untenable in an automated system. I definitely don't want everything invoking helm to have to know about "if first release fails, delete and retry". For one, most of my tooling isn't aware if it's an install or upgrade, or if it's the first time or 100th time, it's almost always just running helm upgrade --install.
Reacted by Zach Langbert, Dominik Horb, leigh capili, Reinhard Nägele, Cornelius Bock, Peter Rifel, BurdenBear, Mauricio Scheffer, Damian Nowak, Kurt Rose and 161 more
The old behavior was better for this case.
I agree with @chancez. This makes upgrade --install non-idempotent for a common occurrence.
@bacongobbler
If we're worried about releases failing and leaving shrapnel due to failed hooks, I'd say that's a design issue the chart. ( Hooks work better when they are idempotent )
Users are free to build error handling and non-idempotent behavior around helm.
What other edge-cases are we concerned about?
Seems the #3097 takes care of a lot 👍
My local development would go much smoother if I could make helm upgrade -i be idempotent even against Failed releases for at least some combination of arguments. My use case is when I have a script of many releases that I know I want to get up to start a local development env.
This might be analogous to the --replace flag for helm install. Note that --replace is one of only two flags from helm install that is missing in helm upgrade, the other being --name-template .
Reacted by Sullivan S., Josh Giles, Yavin 5, Mamut3D and Kevin Durette
I am not sure why we need the install and upgrade commands, I only ever use the upgrade --install command and is seems like a lot of people do the same. I just need one command that does upgrade --install and doesn't trip over a failed run. Can we just rename upgrade --install to deploy, make it truly idempotent, and ditch the other two?
(I'm struggling with a new variant this problem behavior in 2.8.0. Since upgrading from 2.7.2 now if I have a failed install, and then delete --purge it, and the upgrade --install it, I can still get the Error: UPGRADE FAILED: "xyz" has no deployed releases error. Seems like --purge isn't full effective in 2.8.0 and tiller has some stuck state not showing in list --all. I have to then to a install to get tiller back to a state where I can do the usual upgrade --install again.)
Reacted by Damian Nowak, Lee Azzarello, Fatih Ulusoy, Damien Puig, Alexander Staubo, Julio Chana, Karl Skewes, rbq, Pavel Vaysberg, Sebastian Alvarado and 72 more
Reacted by Anthony Gauthier, Blaise Pabon, Smruti, L, David Cowden, Troy Knapp, Julian Bertram, Andrew Wood and JMSwag
I agree with @whereisaaron, I would be nice with a deploy command that worked more like kubectl apply. Makes automation of Helm much easier too, since you don't have to check for releases existing in some shell script madness :)
Reacted by Cornelius Bock, Krisztián Szabó , Damian Nowak, Junwei Zhao, Fred Cox, Karl Skewes, Marco Schmidlin, Dmitry Kirilyuk, Tim Hobbs, Ben Podoll and 22 more
Perhaps the solution is to have helm automatically run helm delete --purge?
Something like:
User executes helm upgrade --install
First release fails
User makes some changes to chart and executes again helm upgrade --install
Helm tries to run the command
It fails and there is precisely one prior release in failed state
Helm silently executes helm delete --purge
After purge, Helm auto-retries helm upgrade --install and shows output from that
Perhaps this behavior could be triggered via the --force flag which already has similar behavior for other scenarios
Reacted by anetbnd
Reacted by saplla, Maurizio Casimirri, Hank Turowski, leigh capili, Branden Carrier, chrisaige, Bob Bui, Justin Plute, Tom Klino, Ngoc Truong and 13 more
Good idea, but I don't think we should ever delete the release ledger without the user explicitly asking to remove that data. Operators of Helm will want to learn why the service failed to upgrade from previously failed releases, or deduce failures by collecting that data from the ledger.
I provided a comment earlier in the thread that describes a solution to the issue. It's similar to your solution in execution, but without the need to delete the entire release ledger. I believe #3437 is attempting to apply that solution as a patch.
Reacted by Roman Chernobelskiy, Gavin D'mello, Nate Ryall, Kevin Pullin, Tim Jones, Hank Turowski, Branden Carrier, Amiraj Dhawan and Marcus Windmark
@RickS-C137 I think this is supposed to be fixed by using helm upgrade --install --force which will 'delete' then 'install --replace' a failed release.
Reacted by Ebbe Elsborg, Michele Degges, Sipke Schoorstra, DK and Amadeusz Kryze
Still trying to fix this issue in a Jenkins Pipeline I am trying to use.
I am trying to deploy a new image of my application and I couldn't care less if the deployment already exists or not.
I want to run one command that either replaces the current deployment or just installs it if it does not exist.
I tried helm install --replace I often get Error: a released named xyz is in use, cannot re-use a name that is still in use Which obviously kills my pipeline and the build fails.
With helm currently, you don't know which helm command+options combination to use without inspecting the current state. And for a given helm command you don't know what you are going to get, because it depends on what the current state is. That's not really the declarative desired state dream ☁️ 💤 😄
In helm 3 we can potentially deprecate install / upgrade / --replace / --upgrade / --force and replace them all with an idempotent helm deploy that either achieves the desired state, or leaves the state unchanged. Maybe using an algorithm similar to above, which if helm deploy fails, rolls back (revision > 1) or deletes+purges (revision = 1), to leave the state as it was before. The failed manifest would still be available via helm history/get. And there could even be a '--no-rollback' option for people who want to preserve the deployment in a failed state for investigation
For right now we can use wrapper scripts or meta-tools like helmsman whose feature list is in part to employ helm but mitigate this issue:
Idempotency: As long your desired state file does not change, you can execute Helmsman several times and get the same result. [...regardless of the current state]
Continue from failures: In the case of partial deployment due to a specific chart deployment failure, fix your helm chart and execute Helmsman again without needing to rollback the partial successes first.
Reacted by Mario Kozjak, Heather Grant, Damian Nowak, Michael Dye, Brent, Josh Giles, Andrew Nazarov, minhnhupham, otakuma, Kyle Cordes and 23 more
Reacted by Pavel Sadikov, Mikhail Beliakov, Georgios Keramidas, Bohdan Yurov and James Lucktaylor
replace them all with an idempotent helm deploy that either achieves the desired state, or leaves the state unchanged
In retrospect, this is a breathtakingly obvious design goal.
Reacted by rbq, Aaron Roydhouse, Isaiah Snell-Feikema, Avi Kessner, Joe Blubaugh, Johnny Huynh, Oleg Yunin, David Jacobs, Fernando Barbosa, Alex Payne and 13 more
Reacted by Aaron Roydhouse, Paulo Peixoto, Brendan Weibrecht, Joydeep Roychowdhury, Adam Gardner and James Lucktaylor
Hi,
In our case the initial release did not really fail... It's just either that our application was not completely up when the install timeout elapsed or some other strange issue that was fixed. In any case, the application is running perfectly fine, and thus having to delete it would be a problem for us (we have some persistent storage attached that would be also removed!!) .
Is there any workaround to deploy a chart when the initial release 'apparently failed' but it's actually ok?
Reacted by Georgios Keramidas, Dmitri, Laurentiu Soica and Mihai Albert
Reacted by Brandon H, Dmitri and Albert Khoury Aouad
So is the conclusion that upgrade --force is too forceful, ie there are times when a delete+replace+retry_upgrade is not correct remedy to failed upgrade?
I am not sure why we need the install and upgrade commands, I only ever use the upgrade --install command and is seems like a lot of people do the same. I just need one command that does upgrade --install and doesn't trip over a failed run. Can we just rename upgrade --install to deploy, make it truly idempotent, and ditch the other two?
...
With helm currently, you don't know which helm command+options combination to use without inspecting the current state. And for a given helm command you don't know what you are going to get, because it depends on what the current state is. That's not really the declarative desired state dream cloud zzz smile
In helm 3 we can potentially deprecate install / upgrade / --replace / --upgrade / --force and replace them all with an idempotent helm deploy that either achieves the desired state, or leaves the state unchanged.
...
I generally agree that helm should work like kubectl apply and attempt to achieve the desired reality rather than needing to run different types of commands depending on the state of your cluster. Was hoping to add support to a dedicated issue if one existed or at least figure out what the resolution was since deploy is not currently implemented and we're on helm 3.2.
Reacted by Dmitry Kirilyuk, Oliver L Schoenborn, Amit Karpe, Artur Pietrzyk, Alexandr Zolotukhin and Annie
Activity
bacongobbler commentedon Jan 17, 2018
This was intentional by design of #3097. Basically, diffing against a failed deployment caused undesirable behaviour, most notably this long list of bugs:
If your initial release ends up in a failed state, we recommend purging the release via
helm delete --purge fooand trying again. After a successful initial release, any subsequent failed releases will be ignored, and helm will do a diff against the last known successful release.Now that being said, it might be valuable to not perform a diff when no successful releases have been deployed. The experience would be the same as if the user ran
helm installfor the very first time in the sense that there would be no "current" release to diff against. I'd be a little concerned about certain edge cases though. @adamreese do you have any opinions on this one?chancez commentedon Jan 22, 2018
The suggested fix seems completely untenable in an automated system. I definitely don't want everything invoking helm to have to know about "if first release fails, delete and retry". For one, most of my tooling isn't aware if it's an install or upgrade, or if it's the first time or 100th time, it's almost always just running
helm upgrade --install.chancez commentedon Jan 22, 2018
I'd also like to call out that I commented on the original PR #3097 (comment) asking specifically about this case.
stealthybox commentedon Jan 25, 2018
The old behavior was better for this case.
I agree with @chancez. This makes
upgrade --installnon-idempotent for a common occurrence.@bacongobbler
If we're worried about releases failing and leaving shrapnel due to failed hooks, I'd say that's a design issue the chart. ( Hooks work better when they are idempotent )
Users are free to build error handling and non-idempotent behavior around helm.
What other edge-cases are we concerned about?
Seems the #3097 takes care of a lot 👍
bmperrea commentedon Jan 31, 2018
My local development would go much smoother if I could make
helm upgrade -ibe idempotent even against Failed releases for at least some combination of arguments. My use case is when I have a script of many releases that I know I want to get up to start a local development env.This might be analogous to the
--replaceflag forhelm install. Note that--replaceis one of only two flags fromhelm installthat is missing inhelm upgrade, the other being--name-template.bacongobbler commentedon Feb 1, 2018
To be absolutely clear, yes this would be a good thing to fix. Anyone wanna take a crack at it while we've got our hands full with other work?
fix upgrade of broken install
sorenmat commentedon Feb 1, 2018
Hi,
I've created a PR #3437 that should fix this issue
whereisaaron commentedon Feb 2, 2018
I am not sure why we need the
installandupgradecommands, I only ever use theupgrade --installcommand and is seems like a lot of people do the same. I just need one command that doesupgrade --installand doesn't trip over a failed run. Can we just renameupgrade --installtodeploy, make it truly idempotent, and ditch the other two?(I'm struggling with a new variant this problem behavior in 2.8.0. Since upgrading from 2.7.2 now if I have a failed install, and then
delete --purgeit, and theupgrade --installit, I can still get theError: UPGRADE FAILED: "xyz" has no deployed releaseserror. Seems like--purgeisn't full effective in 2.8.0 and tiller has some stuck state not showing inlist --all. I have to then to ainstallto get tiller back to a state where I can do the usualupgrade --installagain.)sorenmat commentedon Feb 2, 2018
I agree with @whereisaaron, I would be nice with a
deploycommand that worked more likekubectl apply. Makes automation of Helm much easier too, since you don't have to check for releases existing in some shell script madness :)fix upgrade of broken install
rchernobelskiy commentedon Feb 15, 2018
Perhaps the solution is to have helm automatically run
helm delete --purge?Something like:
helm upgrade --installhelm upgrade --installhelm delete --purgehelm upgrade --installand shows output from thatPerhaps this behavior could be triggered via the
--forceflag which already has similar behavior for other scenariosbacongobbler commentedon Feb 15, 2018
Good idea, but I don't think we should ever delete the release ledger without the user explicitly asking to remove that data. Operators of Helm will want to learn why the service failed to upgrade from previously failed releases, or deduce failures by collecting that data from the ledger.
I provided a comment earlier in the thread that describes a solution to the issue. It's similar to your solution in execution, but without the need to delete the entire release ledger. I believe #3437 is attempting to apply that solution as a patch.
7 remaining items
RickS-C137 commentedon Jan 23, 2019
Hello there,
I'm using Helm 2.12.2 and still have the issue, that helm fails, when the first deployment is failed. Is this a regression maybe?
eyalzek commentedon Jan 30, 2019
I'm not sure it's a regression, but that it was never actually "fixed".
whereisaaron commentedon Feb 4, 2019
@RickS-C137 I think this is supposed to be fixed by using
helm upgrade --install --forcewhich will 'delete' then 'install --replace' a failed release.konokimo commentedon Feb 13, 2019
Still trying to fix this issue in a Jenkins Pipeline I am trying to use.
I am trying to deploy a new image of my application and I couldn't care less if the deployment already exists or not.
I want to run one command that either replaces the current deployment or just installs it if it does not exist.
I tried
helm install --replaceI often getError: a released named xyz is in use, cannot re-use a name that is still in useWhich obviously kills my pipeline and the build fails.walkafwalka commentedon Mar 2, 2019
@bacongobbler What do you think about #3353 (comment)?
I do not see how there would be downtime or data loss if we destroy and recreate the initial release if the initial release fails.
walkafwalka commentedon Mar 3, 2019
I implemented this in our build:
whereisaaron commentedon Mar 4, 2019
With helm currently, you don't know which helm command+options combination to use without inspecting the current state. And for a given helm command you don't know what you are going to get, because it depends on what the current state is. That's not really the declarative desired state dream ☁️ 💤 😄
In helm 3 we can potentially deprecate
install/upgrade/--replace/--upgrade/--forceand replace them all with an idempotenthelm deploythat either achieves the desired state, or leaves the state unchanged. Maybe using an algorithm similar to above, which ifhelm deployfails, rolls back (revision > 1) or deletes+purges (revision = 1), to leave the state as it was before. The failed manifest would still be available viahelm history/get. And there could even be a '--no-rollback' option for people who want to preserve the deployment in a failed state for investigationThe option of
helm upgrade --install --forceis getting close, except that rather than rolling back and upgrading, it deletes and replaces failed releases (even for revisions >1), which makes some people angry over on #3208... 😮 ⚡️ 💥For right now we can use wrapper scripts or meta-tools like
helmsmanwhose feature list is in part to employhelmbut mitigate this issue:kylecordes commentedon Apr 8, 2019
In retrospect, this is a breathtakingly obvious design goal.
dvlato commentedon Jul 11, 2019
Hi,
In our case the initial release did not really fail... It's just either that our application was not completely up when the install timeout elapsed or some other strange issue that was fixed. In any case, the application is running perfectly fine, and thus having to delete it would be a problem for us (we have some persistent storage attached that would be also removed!!) .
Is there any workaround to deploy a chart when the initial release 'apparently failed' but it's actually ok?
schollii commentedon Mar 23, 2020
So is the conclusion that
upgrade --forceis too forceful, ie there are times when a delete+replace+retry_upgrade is not correct remedy to failed upgrade?dcow commentedon Jul 7, 2020
Is there a separate issue tracking the idea of merging
install&upgradeinto adeploycommand?hickeyma commentedon Jul 7, 2020
Not that I know of @dcow. What is the use case over
helm upgrade --installcommand?dcow commentedon Jul 7, 2020
#3353 (comment)
and
#3353 (comment)
I generally agree that helm should work like
kubectl applyand attempt to achieve the desired reality rather than needing to run different types of commands depending on the state of your cluster. Was hoping to add support to a dedicated issue if one existed or at least figure out what the resolution was sincedeployis not currently implemented and we're on helm 3.2.hickeyma commentedon Jul 7, 2020
@dcow Ok, do you want to create an issue then with your proposal?
dcow commentedon Jul 8, 2020
@hickeyma done #8415!