From c9a240074e02a7f9f98a86855407407ac1cbedd3 Mon Sep 17 00:00:00 2001 From: jiuker <2818723467@qq.com> Date: Fri, 14 Oct 2022 13:11:30 +0800 Subject: [PATCH 1/3] update node_controller.go Reproduction steps: 1. Start mysql-operator. 2. Start the mysql instance. 3. Wait for all mysql instances to run successfully. 4. Close mysql-operator (to simulate network failure, node down, etc.). 5. Restart the node containing the mysql instance. 6. The mysql instances on these nodes will start automatically, but since init will set configfure to 0. 7. Wait for all these nodes to stop changing. 8. Start mysql-operator, which will not automatically repair the current cluster because it is listening to the updated pod. 9. and the mysql cluster is in an unhealthy state due to configfure=0. --- pkg/controller/node/node_controller.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/controller/node/node_controller.go b/pkg/controller/node/node_controller.go index e0f02a987..32b956e84 100644 --- a/pkg/controller/node/node_controller.go +++ b/pkg/controller/node/node_controller.go @@ -120,9 +120,8 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { // Watch for changes to MysqlCluster err = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForObject{}, predicate.Funcs{ - // no need to init nodes when are created CreateFunc: func(evt event.CreateEvent) bool { - return false + return isOwnedByMySQL(evt.Object) && isRunning(evt.Object) && !isReady(evt.Object) }, // trigger node initialization only on pod update, after pod is created for a while From 82de3af9545b1e00f6e25f0deb683e22ed5e9cc0 Mon Sep 17 00:00:00 2001 From: jiuker <2818723467@qq.com> Date: Tue, 25 Oct 2022 14:48:27 +0800 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c46a66af9..0b117e5f5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). * `orchestrator.secretName` is ignored in helm charts * Operator service account have no access to update mysqlbackups/status * Recurrent backup remote delete policy can not update according to the `cluster.Spec.BackupRemoteDeletePolicy` + * When operator restart,will handle podList. ## [0.6.1] - 2021-12-22 ### Changed From eadf620c66663169e37166ac5056ea24807a2ef4 Mon Sep 17 00:00:00 2001 From: jiuker <2818723467@qq.com> Date: Wed, 4 Jan 2023 10:07:06 +0800 Subject: [PATCH 3/3] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b117e5f5..4ade9f44f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). * `orchestrator.secretName` is ignored in helm charts * Operator service account have no access to update mysqlbackups/status * Recurrent backup remote delete policy can not update according to the `cluster.Spec.BackupRemoteDeletePolicy` - * When operator restart,will handle podList. + * When the operator is restarted, it will process the Pod list once to prevent the state of the pod from being changed automatically because it is not updated (especially if the pvc is full). ## [0.6.1] - 2021-12-22 ### Changed