Skip to content

Commit

Permalink
cherry-pick: kosmos node address throw duplicate value error
Browse files Browse the repository at this point in the history
Signed-off-by: OrangeBao <[email protected]>
  • Loading branch information
OrangeBao committed Mar 5, 2024
1 parent f7cad2a commit 1fba238
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions pkg/clustertree/cluster-manager/utils/leaf_model_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,10 @@ func (h AggregationModelHandler) UpdateNodeStatus(ctx context.Context, n []*core
return err
}

patch, err := utils.CreateMergePatch(node, clone)
clone.Status.Addresses = updateAddress

if err != nil {
return fmt.Errorf("cannot get node while update node status %s, err: %v", node.Name, err)
}

if latestNode, err := h.RootClientset.CoreV1().Nodes().PatchStatus(ctx, node.Name, patch); err != nil {
if _, err = h.RootClientset.CoreV1().Nodes().UpdateStatus(ctx, clone, metav1.UpdateOptions{}); err != nil {
return err
} else {
latestNode.ResourceVersion = ""
latestNode.Status.Addresses = updateAddress
if _, err = h.RootClientset.CoreV1().Nodes().UpdateStatus(ctx, latestNode, metav1.UpdateOptions{}); err != nil {
return err
}
}
return nil
})
Expand Down

0 comments on commit 1fba238

Please sign in to comment.