apecloud / kubeblocks

KubeBlocks is an open-source control plane software that runs and manages databases, message queues and other stateful applications on K8s.
https://kubeblocks.io
GNU Affero General Public License v3.0
2.1k stars 170 forks source link

[BUG]opengauss cm leftovers should be cleaned after kb uninstalled #6184

Open ahjing99 opened 10 months ago

ahjing99 commented 10 months ago

➜ ~ kbcli version Kubernetes: v1.27.3-gke.100 kbcli: 0.8.0-beta.13

The following leftovers should be cleaned along with kb uninstall

➜  ~ kbcli kubeblocks install
KubeBlocks will be installed to namespace "kb-system"
error: there are resources left by previous KubeBlocks version, try to run "kbcli kubeblocks uninstall" to clean up
  configmaps: opengauss-agamotto-configuration,opengauss-configuration,opengauss-custom-metrics,opengauss-scripts
➜  ~ k get cm
NAME                               DATA   AGE
kube-root-ca.crt                   1      17h
opengauss-agamotto-configuration   1      16h
opengauss-configuration            2      16h
opengauss-custom-metrics           1      16h
opengauss-scripts                  1      16h
1aal commented 10 months ago

The 0.8 release has decoupled the addon from KubeBlocks, requiring many addons to be installed using helm install. However, an issue arises during the helm install process if the --namespace kb-system flag is not specified. Currently, there are two methods to address this:

  1. Execute kbcli kb uninstall --auto-approveagain.
  2. Install the XX-addon using helm install with the --namespace kb-system flag.

Such as:

➜  ~ helm install opengauss ./opengauss --namespace kb-system
NAME: opengauss
LAST DEPLOYED: Thu Dec 21 09:43:15 2023
NAMESPACE: kb-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
Standalone OpenGauss cluster-definition and cluster-version in Kubeblocks

Using `kbcli cluster create --cluster-definition opengauss` to create a OpenGauss cluster
➜  ~ k get cd
NAME               MAIN-COMPONENT-NAME   STATUS      AGE
mongodb-sharding   mongos                Available   3m38s
pulsar-zookeeper   zookeeper             Available   3m38s
mongodb            mongodb               Available   3m38s
redis              redis-proxy           Available   3m37s
postgresql         postgresql            Available   3m36s
apecloud-mysql     mysql                 Available   3m37s
kafka              kafka-server          Available   3m37s
pulsar             pulsar-broker         Available   3m38s
opengauss          opengauss             Available   5s
➜  ~ kbcli kb uninstall --auto-approve
Uninstall KubeBlocks in namespace "kb-system"
Wait for addons to be disabled
  apecloud-mysql                                   OK
  kafka                                            OK
  mongodb                                          OK
  postgresql                                       OK
  pulsar                                           OK
  redis                                            OK
  snapshot-controller                              OK
Uninstall helm release kubeblocks 0.8.0-beta.11    OK
Remove helm repo kubeblocks                        OK
Remove built-in custom resources                   OK
Remove addons                                      OK
Remove clusterdefinitions                          OK
Remove clusterversions                             OK
Remove configconstraints                           OK
Remove configmaps                                  OK
Remove customresourcedefinitions                   OK
Remove storageproviders                            OK
Uninstall KubeBlocks done.
➜  ~ kbcli kb install --version 0.8.0-beta.11
KubeBlocks will be installed to namespace "kb-system"
Kubernetes version 1.26.4+k3s1
kbcli version 0.9.0-alpha.0
Collecting data from cluster                       OK
Kubernetes cluster preflight                       OK
  Warn
  - This application requires at least 3 nodes
Add and update repo kubeblocks                     OK
Install KubeBlocks 0.8.0-beta.11                   OK
Wait for addons to be enabled
  apecloud-mysql                                   OK
  kafka                                            OK
  mongodb                                          OK
  postgresql                                       OK
  pulsar                                           OK
  redis                                            OK
  snapshot-controller                              OK

KubeBlocks 0.8.0-beta.11 installed to namespace kb-system SUCCESSFULLY!

-> Basic commands for cluster:
    kbcli cluster create -h     # help information about creating a database cluster
    kbcli cluster list          # list all database clusters
    kbcli cluster describe <cluster name>  # get cluster information

-> Uninstall KubeBlocks:
    kbcli kubeblocks uninstall
➜  ~