Skip to content

Commit

Permalink
use the copied node obj to drain the node
Browse files Browse the repository at this point in the history
  • Loading branch information
Zihan Jiang committed Nov 14, 2023
1 parent d69fcbf commit f7602e9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/service/nodes.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ func drainNode(kubeClient kubernetes.Interface, node *v1.Node, timeout, retryInt
}

for retryAttempts > 0 {
err = drainNodeUtil(node, int(timeout), kubeClient)
// create a copy of the node obj, since RunCordonOrUncordon() modifies the node obj
nodeCopy := node.DeepCopy()
err = drainNodeUtil(nodeCopy, int(timeout), kubeClient)
if err == nil {
log.Info("drain suceeded")
return nil
Expand Down

0 comments on commit f7602e9

Please sign in to comment.