Skip to content

Commit

Permalink
fix: 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 31d82f6 commit c9bf091
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 @@ -159,19 +159,9 @@ func (h ClassificationHandler) UpdateRootNodeStatus(ctx context.Context, nodesIn
return err
}

patch, err := utils.CreateMergePatch(nodeInRoot, rootCopy)
if err != nil {
return fmt.Errorf("failed to CreateMergePatch while update join node %s status, err: %v", nodeNameInRoot, err)
}

if latestNode, err := h.RootClientset.CoreV1().Nodes().PatchStatus(ctx, node.Name, patch); err != nil {
rootCopy.Status.Addresses = updateAddress
if _, err = h.RootClientset.CoreV1().Nodes().UpdateStatus(ctx, rootCopy, 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 c9bf091

Please sign in to comment.