From aedecad8de0f155ce6b4510639bd1daee02add54 Mon Sep 17 00:00:00 2001 From: OrangeBao Date: Thu, 1 Feb 2024 00:55:24 +0800 Subject: [PATCH] fix: don't update address of node in node-resources-controller Signed-off-by: OrangeBao --- .../controllers/node_resources_controller.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/clustertree/cluster-manager/controllers/node_resources_controller.go b/pkg/clustertree/cluster-manager/controllers/node_resources_controller.go index acfea97ab..a396ddd0a 100644 --- a/pkg/clustertree/cluster-manager/controllers/node_resources_controller.go +++ b/pkg/clustertree/cluster-manager/controllers/node_resources_controller.go @@ -149,7 +149,11 @@ func (c *NodeResourcesController) Reconcile(ctx context.Context, request reconci // Taints: rootNode.Spec.Taints, // } clone.Spec.Taints = rootNode.Spec.Taints + // node-lease-controller will modify the address, do not modify it here as there may be issues. + // relate to https://github.com/kosmos-io/kosmos/pull/338 + cloneAddress := clone.Status.Addresses clone.Status = node.Status + clone.Status.Addresses = cloneAddress } } // TODO ggregation Labels and Annotations for classificationModel @@ -166,13 +170,13 @@ func (c *NodeResourcesController) Reconcile(ctx context.Context, request reconci if _, err = c.RootClientset.CoreV1().Nodes().Patch(ctx, rootNode.Name, types.MergePatchType, patch, metav1.PatchOptions{}); err != nil { return reconcile.Result{ RequeueAfter: RequeueTime, - }, fmt.Errorf("failed to patch node resources: %v, will requeue", err) + }, fmt.Errorf("(patch) failed to patch node resources: %v, will requeue", err) } if _, err = c.RootClientset.CoreV1().Nodes().PatchStatus(ctx, rootNode.Name, patch); err != nil { return reconcile.Result{ RequeueAfter: RequeueTime, - }, fmt.Errorf("failed to patch node resources: %v, will requeue", err) + }, fmt.Errorf("(patch-status) failed to patch node resources: %v, will requeue", err) } } return reconcile.Result{}, nil