Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Ask for confirmation before uninstalling a chart #8981

Closed
InsOpDe opened this issue Nov 4, 2020 · 7 comments
Closed

Feature: Ask for confirmation before uninstalling a chart #8981

InsOpDe opened this issue Nov 4, 2020 · 7 comments

Comments

@InsOpDe
Copy link

InsOpDe commented Nov 4, 2020

I live in a constant fear of accidentally uninstalling a chart.

I would suggest that the cli asks for confirmation before uninstalling.
As this would break pipelines which are relying on deleting charts without being asked, it would be necessary to enable this setting with either a config file or an environment variable like HELM_UNINSTALL_SAFEGUARD which has to be set.

One could then overwrite these settings with helm uninstall some-chart -y

As a workaround I use this in my .zshrc (which is not that robust)

#helm
alias hi='helm install'
#alias hun='helm uninstall'
function helm {
        if [[ "${@:1:1}" == "uninstall" ]]; then
                hun "${@:2}"
        else
                command helm "$@"
        fi
}
function hun {
        read "?Are you sure ?"
        if [[ $REPLY =~ ^[Yy]$ ]]
        then
            command helm uninstall "$@"
        fi
}
alias hug='helm upgrade'

@bacongobbler
Copy link
Member

bacongobbler commented Nov 5, 2020

A similar request was made for helm install back for Helm 2 via #2269. In short, we debated whether adding a confirmation prompt in front of helm install would break backwards compatibility, and we agreed that it would indeed break compatibility and therefore could not be introduced during Helm 2's development cycle. Instead we shared a workaround by writing a wrapper script around Helm. So your zsh script isn't all that odd. :)

As this would break pipelines which are relying on deleting charts without being asked, it would be necessary to enable this setting with either a config file or an environment variable like HELM_UNINSTALL_SAFEGUARD which has to be set.

I agree. Because of the precedent mentioned earlier in #2269, we cannot introduce a confirmation prompt in front of helm uninstall without breaking backwards compatibility. Once Helm 4 development begins, we can remove this safeguard and make prompting for confirmation the default.

Is this something you're willing to work on? There's some code around prompting for user input for helm registry login --password-stdin which would be a good place to start looking.

@bacongobbler
Copy link
Member

Is this something you're willing to work on?

ping.

@wawa0210
Copy link
Contributor

@bacongobbler

Is anyone else following up on this issue? If not, I am willing to mention a pr. If I am developing now, which branch should I merge to? You mentioned that this feature is best in the helm 4 version

@github-actions
Copy link

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.

@jwenjian
Copy link

Any update on this feature?

@luk-sam
Copy link

luk-sam commented Mar 16, 2023

Any update?

p.s.
this thread is a sad place of those, who removed something from prod and got task to find a way to prevent it in the future.. I'm one of you guys.

@nchicong
Copy link

nchicong commented Aug 25, 2023

Such important feature has not been having enough attention.

I made minor adjustments to @InsOpDe workaround in my version.

function helm {
  if [[ "${@:1:1}" == "uninstall" ]]; then
          helm_uninstall "${@:2}"
  else
          command helm "$@"
  fi
}
function helm_uninstall {
  echo "[>] Current kubectl context: $(kubectl config current-context)"
  read "? Are you sure to uninstall '$@'?"
  if [[ $REPLY =~ ^[Yy]$ ]]
  then
      command helm uninstall "$@"
  fi
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants