From 00cc66beedd184d7bd7730a408720929611c2f38 Mon Sep 17 00:00:00 2001 From: Masayuki Ishii Date: Tue, 29 Aug 2023 07:21:48 +0000 Subject: [PATCH] Fix log message when detected demote annotation Signed-off-by: Masayuki Ishii --- controllers/pod_watcher.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/controllers/pod_watcher.go b/controllers/pod_watcher.go index 16ea94c85..c23401368 100644 --- a/controllers/pod_watcher.go +++ b/controllers/pod_watcher.go @@ -72,7 +72,11 @@ func (r *PodWatcher) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu return ctrl.Result{}, nil } - log.Info("detected mysql pod deletion", "name", pod.Name) + if pod.DeletionTimestamp != nil { + log.Info("detected mysql pod deletion", "name", pod.Name) + } else { + log.Info("detected demote annotation", "name", pod.Name) + } r.ClusterManager.UpdateNoStart(types.NamespacedName{Namespace: pod.Namespace, Name: ref.Name}, string(controller.ReconcileIDFromContext(ctx))) return ctrl.Result{}, nil }