skip Helm uninstall interactive request

2/2/2022

i want to automate a bit helm install/uninstall but during helm uninstall command it will become user interactiv asking:

Do you want to continue to delete suite-helm? (yY|nN):

Is any flag or way to skip this part? Thanks in advance

-- Alin-Bogdan Zirbo
helm3
kubernetes
kubernetes-helm

2 Answers

2/2/2022

You would have to wrap in a shell script or function.

Something like (just spitballing here, not even syntax checking)

helm-delete() {

helm status $1

echo "Do you want to continue to delete suite-helm? (yY|nN):"
read -rs -k 1 ans

    case "${ans}" in
    y|Y|$'\n')
        printf "Yes\n"

          helm delete %1
        ;;

    *)  # This is the default
        printf "No\n"
            return 0

    esac
}
-- Josh Beauregard
Source: StackOverflow

2/2/2022

finaly i found a way using expect and here it is: expect -c ' spawn ./helm_remove.sh; expect (yY|nN); send "y\n"; interact'

into sh file i will have helm uninstall suite-helm -n suite-helm and some other commands to remove pvs deployment...

-- Alin-Bogdan Zirbo
Source: StackOverflow