Repository navigation
Description
Reading through #3353 there was an interesting suggestion by @whereisaaron #3353 (comment) and #3353 (comment):
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 ☁️ 💤 😄
Via text reply and emoji-analysis the suggestion received solid support. Discussion in the thread indicated it would be an interesting addition to helm 3.
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
The option of helm upgrade --install --force is 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... open_mouth zap boom
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.
After a short while working with helm myself, I agree a deploy sub-command that attempts to achieve the desired state declared by the helm chart makes a lot of sense. Philosophically, sure, but also simply by virtue of supporting a super simple operator/developer workflow where you've got a helm chart and you just want to helm deploy it into whatever cluster you're pointed at pointed at rather than having to do helm upgrade --install . Imagine a dev working on a chart needing to constantly deploy changes as they're made. And, as someone new to helm, I am not even aware of all the nuances of when to use which helm command depending on the state of a deployment. I'm a little worried after reading this that I may have been overlooking something important since I've been more or less operating under the assumption that I can just use helm upgrade --install whenever and helm takes care of the rest (more so how it sounds like people expect a deploy sub-command would work).
I asked and @hickeyma suggested that I open an issue to pick up discussion. Thoughts?
Activity
bacongobbler commentedon Jul 8, 2020
What would be the difference of implementing this in core vs someone from the community taking what’s already in helm and writing a plugin? If this is just a command alias for features that already exist in helm as feature flags, why should we re-package what’s already been shipped?
hickeyma commentedon Jul 8, 2020
@dcow I think it could be useful but I tend to agree with @bacongobbler that is is essentially just a wrapper around
helm upgrade --installin core. I therefore think that a plugin is the best approach and something you could do easily enough if you want.dcow commentedon Jul 8, 2020
I guess my main question is, "why are there two commands in the first place?" Is there not an opportunity to merge the two into one and simplify the workflow? Or is it simply that the UI as implemented is rather flexible and it would take a lot of effort to collapse the two commands into one since doing so may ultimately remove access to functionality people depend upon?
Jokero commentedon Jul 9, 2020
I'd agree with @dcow. First time I worked with helm I was confused a little bit about what should I use to deploy a chart especially taking into account that I was just experimenting with k8s and different providers of it and created/updated a cluster multiple times a day. Of course instead of using both
helm installandhelm upgradeI switched just tohelm upgrade --installas it required fewer lines in my shell file and worked for both creation and update of a cluster. From my perspectivehelm installis quite useless andhelm upgrade --installlooks a bit awkward and cumbersome and can be replaced to something more intuitive likehelm deploybacongobbler commentedon Jul 9, 2020
There are flags in
helm installthat are not present inhelm upgradethat does not make it useless for many users. Many users rely on--create-namespace, for example.bacongobbler commentedon Jul 9, 2020
Bingo. Collapsing the two into one command will ultimately result in the removal of functionality, or at the very least an incredibly confusing user story. Consider how flags like
--reset-values,--force,--atomicand--reuse-valueswould work in these scenarios. They won't work on the first deploy (they arehelm upgradefeatures), leading to confusion. Some users may want the namespace to be automatically created with--create-namespace, but then will be confused when an upgrade does not recreate the namespace, as it is ahelm installfeature.The simple answer is that the Helm user base is absolutely huge. The Helm client is downloaded over a million times a month. Some of the user base will want features enabled. Some will not.
Our goal here is to remain as flexible as possible to a large user base. That does result in us taking a less opinionated stance than some may wish for us to take, but it does give us and the community some flexibility over how Helm manages its own state.
That being said, this is where Helm plugins and the Helm Go SDK shine best. Users can take advantage of what's already in Helm and craft their own opinions and write their own tools based on those opinions.
Hope that helps explain the situation.
github-actions commentedon Oct 8, 2020
This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.
abdennour commentedon Jan 19, 2021
Idempotency is critical for ci/cd.
We understood that release engineering science differentiates between first install & subsequent upgrade(s).
However, this is not an excuse to not provide a such feature.
squillace commentedon Jan 19, 2021
uh, yeah it is. Release science says it's so. But, hey, you're free to knock out a plugin that does this. It'll work fine. If everyone starts using it, that would be the very best argument it should be a core feature.