From c9bf091b30c28e3ec382e4b323ad46db791ae2f8 Mon Sep 17 00:00:00 2001 From: OrangeBao Date: Tue, 5 Mar 2024 17:20:29 +0800 Subject: [PATCH] fix: kosmos node address throw duplicate value error Signed-off-by: OrangeBao --- .../cluster-manager/utils/leaf_model_handler.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/pkg/clustertree/cluster-manager/utils/leaf_model_handler.go b/pkg/clustertree/cluster-manager/utils/leaf_model_handler.go index b3ab0a27d..acc8b6fdf 100644 --- a/pkg/clustertree/cluster-manager/utils/leaf_model_handler.go +++ b/pkg/clustertree/cluster-manager/utils/leaf_model_handler.go @@ -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 })