Skip to content

Commit c9a2400

Browse files
jiukercndoit18
authored andcommitted
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.
1 parent bf0e383 commit c9a2400

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pkg/controller/node/node_controller.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,8 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error {
120120

121121
// Watch for changes to MysqlCluster
122122
err = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForObject{}, predicate.Funcs{
123-
// no need to init nodes when are created
124123
CreateFunc: func(evt event.CreateEvent) bool {
125-
return false
124+
return isOwnedByMySQL(evt.Object) && isRunning(evt.Object) && !isReady(evt.Object)
126125
},
127126

128127
// trigger node initialization only on pod update, after pod is created for a while

0 commit comments

Comments
 (0)