clusterpedia-io / clusterpedia

The Encyclopedia of Kubernetes clusters
https://clusterpedia.io
Apache License 2.0
791 stars 122 forks source link

When the database or table is deleted, the program will not exit #251

Open cleverhu opened 2 years ago

cleverhu commented 2 years ago

What happened?

When the database is deleted, syncmanager will not exit which results in no data acquisition.

What did you expect to happen?

When the database does not exist, the program needs to restart the syncmanger to create a new table.

How can we reproduce it (as minimally and precisely as possible)?

delete the mysql table manually.

Anything else we need to know?

No response

Clusterpedia Version

```console # replace the pod name of clusterpedia apiserver $ kubectl -n kpanda-system exec clusterpedia-apiserver-5dfdb7b9fb-2bn97 -- apiserver --version=raw version.Info{GitVersion:"v0.3.0-14-g075447b", GitCommit:"075447b504cd42ee57bd12141567a582f9d0ab5d", GitTreeState:"clean", BuildDate:"2022-06-08T09:52:09Z", GoVersion:"go1.17.11", Compiler:"gc", Platform:"linux/amd64", KubeVersion:"v1.24.1"} # replace the pod name of clusterpedia clustersynchro-manager $ kubectl -n kpanda-system exec clusterpedia-clustersynchro-manager-8475496d9c-cf6f6 -- clustersynchro-manager --version=raw version.Info{GitVersion:"v0.3.0-60-g86ad680", GitCommit:"86ad68057bc7dca02e238ba55f70df66cc45f4ed", GitTreeState:"clean", BuildDate:"2022-06-24T09:53:25Z", GoVersion:"go1.17.11", Compiler:"gc", Platform:"linux/amd64", KubeVersion:"v1.24.1"} ```
image
$ kubectl logs -f clusterpedia-clustersynchro-manager-8475496d9c-cf6f6 -n kpanda-system
image

Host Kubernetes version

```console $ kubectl version Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.13", GitCommit:"80ec6572b15ee0ed2e6efa97a4dcd30f57e68224", GitTreeState:"clean", BuildDate:"2022-05-24T12:40:44Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.13", GitCommit:"80ec6572b15ee0ed2e6efa97a4dcd30f57e68224", GitTreeState:"clean", BuildDate:"2022-05-24T12:34:37Z", GoVersion:"go1.16.15", Compiler:"gc", Platform:"linux/amd64"} ```
Iceber commented 2 years ago

The database should actually be created by the user, clusterpedia may not have the privilege to create the database.

At startup, clusterpedia creates the tables in the database.

Iceber commented 2 years ago

Whether the database is deleted or the tables are deleted, we should stop all cluster synchro and restart until the database is recreated or the tables are recreated by clusterpedia.

@cleverhu Are you willing to fix this problem?

Be careful not to coupling clusterpedia with internalstorage

Iceber commented 2 years ago

It should be considered a feature rather than a bug, after all, the database/table being deleted manually at any time is already a production accident.