From 687cbcb65450c552edd178847b7a8544a4af770e Mon Sep 17 00:00:00 2001 From: Ivan Kolodyazhny Date: Tue, 25 Jan 2022 09:04:37 +0200 Subject: [PATCH] Annotate node only if there is no existing annotation Signed-off-by: Ivan Kolodyazhny --- pkg/daemon/daemon.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go index 6e36833c78..ca167bb796 100644 --- a/pkg/daemon/daemon.go +++ b/pkg/daemon/daemon.go @@ -721,6 +721,11 @@ func (a GlogLogger) Logf(format string, v ...interface{}) { func (dn *Daemon) annotateNode(node, value string) error { glog.Infof("annotateNode(): Annotate node %s with: %s", node, value) + // Check if node already contains annotation + if anno, ok := dn.node.Annotations[value]; ok && (anno == value) { + return nil + } + oldNode, err := dn.kubeClient.CoreV1().Nodes().Get(context.Background(), dn.name, metav1.GetOptions{}) if err != nil { glog.Infof("annotateNode(): Failed to get node %s %v, retrying", node, err)