Skip to content

Commit

Permalink
Annotate node only if there is no existing annotation
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Kolodyazhny <[email protected]>
  • Loading branch information
e0ne committed Jan 25, 2022
1 parent 8f52b7c commit 687cbcb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/daemon/daemon.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 687cbcb

Please sign in to comment.