Skip to content

Commit a5d7f01

Browse files
committed
use PATCH to update node labels instead of UPDATE
Signed-off-by: Tariq Ibrahim <[email protected]>
1 parent a761bfe commit a5d7f01

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

controllers/state_manager.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,8 @@ func (n *ClusterPolicyController) labelGPUNodes() (bool, int, error) {
492492
gpuNodesTotal := 0
493493
for _, node := range list.Items {
494494
node := node
495+
496+
nodeOriginal := node.DeepCopy()
495497
// get node labels
496498
labels := node.GetLabels()
497499
if !clusterHasNFDLabels {
@@ -566,7 +568,7 @@ func (n *ClusterPolicyController) labelGPUNodes() (bool, int, error) {
566568

567569
// update node with the latest labels
568570
if updateLabels {
569-
err = n.client.Update(ctx, &node)
571+
err := n.client.Patch(ctx, &node, client.StrategicMergeFrom(nodeOriginal))
570572
if err != nil {
571573
return false, 0, fmt.Errorf("unable to label node %s for the GPU Operator deployment, err %s",
572574
node.Name, err.Error())

0 commit comments

Comments
 (0)