Helm uninstall commnad doesn't actually uninstall *-db-haxproxy and *-db-pxc

Hello everyone, I’m having problems uninstalling a chart deployment of Percona. Some context first:
I have this chart.yaml

apiVersion: v2
name: pxc-test
description: A Helm chart for Kubernetes
type: application
version: 1.0.0
appVersion: testing-1.0

dependencies:
  - name: pxc-db 
    version: "1.11.5"
    repository: "https://percona.github.io/percona-helm-charts/" 
  - name: pxc-operator 
    version: "1.11.1"
    repository: "https://percona.github.io/percona-helm-charts/"

And I’m installing it with:

helm install pxc helm/ --namespace pxc-test -f helm/values.yaml 

Inside the helm/ directory are the charts pxc-db-1.11.5.tgz and pxc-operator-1.11.1.tgz.
So everything is working without problems:

ubuntu@deployer:~$ kubectl get pods -n pxc-test 
NAME                              READY   STATUS    RESTARTS   AGE
mysql-operator-777586f549-vbg2x   1/1     Running   0          4h33m
percona-db-haproxy-0              2/2     Running   0          4h12m
percona-db-haproxy-1              2/2     Running   0          4h11m
percona-db-pxc-0                  1/1     Running   0          4h12m
percona-db-pxc-1                  1/1     Running   0          4h11m
percona-db-pxc-2                  1/1     Running   0          4h10m

But when I try to uninstall it:

ubuntu@deployer:~/percona-test$ helm uninstall pxc --namespace pxc-test
release "pxc" uninstalled
ubuntu@deployer:~/percona-test$ kubectl get pods -n pxc-test 
NAME                   READY   STATUS    RESTARTS   AGE
percona-db-haproxy-0   2/2     Running   0          15m
percona-db-haproxy-1   2/2     Running   0          14m
percona-db-pxc-0       1/1     Running   0          15m
percona-db-pxc-1       1/1     Running   0          14m
percona-db-pxc-2       1/1     Running   0          13m

The operator is the only pod that disappears and the *-db-haproxy and *-db-pxc stay till I do the installation process again:

ubuntu@deployer:~/percona-test$ helm install pxc helm/ --namespace pxc-test -f helm/values.yaml 
NAME: pxc
LAST DEPLOYED: Mon Aug  1 21:40:14 2022
NAMESPACE: pxc-test
STATUS: deployed
REVISION: 1
TEST SUITE: None
ubuntu@deployer:~/percona-test$ kubectl get pods -n pxc-test 
NAME                              READY   STATUS        RESTARTS   AGE
mysql-operator-777586f549-lk9rr   1/1     Running       0          32s
percona-db-haproxy-0              2/2     Running       0          16m
percona-db-haproxy-1              2/2     Running       0          15m
percona-db-pxc-0                  1/1     Terminating   0          16m
percona-db-pxc-1                  1/1     Terminating   0          15m
percona-db-pxc-2                  1/1     Terminating   0          14m
ubuntu@deployer:~/percona-test$ kubectl get pods -n pxc-test 
NAME                              READY   STATUS        RESTARTS   AGE
mysql-operator-777586f549-lk9rr   1/1     Running       0          61s
percona-db-haproxy-0              1/2     Terminating   0          16m
percona-db-haproxy-1              1/2     Terminating   0          15m
ubuntu@deployer:~/percona-test$ kubectl get pods -n pxc-test 
NAME                              READY   STATUS    RESTARTS   AGE
mysql-operator-777586f549-lk9rr   1/1     Running   0          76s

Then, the operator start to clean up what was left behind from the last installation.
I tried using the flag wait but no dice either:

ubuntu@deployer:~/percona-test$ helm uninstall pxc --namespace pxc-test --wait
Error: uninstallation completed with 1 error(s): timed out waiting for the condition
ubuntu@deployer:~/percona-test$ 

Hi @Luis_Ignacio_Vega !
The problem here is that pxc chart depends on the operator chart and from what I see you cannot specify dependency order for helm, there was some attempt here: Helm Resolving Dependencies First Option by protosam · Pull Request #212 · helm/community · GitHub but it was abandoned.

In this case for installation it is not a problem, because if pxc chart is installed first it will not do anything until the operator chart is installed and then the cluster will start to initialise. But as you have seen, for uninstall it is a problem because if operator is deleted first the cluster objects will stay since operator needs to do cluster cleanup.
Currently I don’t know if you can use it this way, maybe somebody else will have some ideas.

Also I would suggest you to ask further questions about helm/kubernetes operators in section “Percona Operator for MySQL” of the forum since there might be more users with this knowledge reading posts there.

3 Likes

Thanks for your time @Tomislav_Plavcic ! That’s sad to read because we need to use it as part of a bigger chart. I’ll see if I can find a work around

2 Likes