Skip to content

Commit

Permalink
feat: don't create globalnodes for master
Browse files Browse the repository at this point in the history
Signed-off-by: baoyinghai_yewu <[email protected]>
  • Loading branch information
OrangeBao committed Feb 19, 2025
1 parent 39edf31 commit e369bb0
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,16 @@ var CustomPredicateForGlobalNode = predicate.Funcs{
},
}

func isMasterNode(node *v1.Node) bool {
roles := []string{utils.LabelNodeRoleOldControlPlane, utils.LabelNodeRoleControlPlane}
for _, role := range roles {
if _, exists := node.Labels[role]; exists {
return true
}
}
return false
}

func (r *GlobalNodeController) SetupWithManager(mgr manager.Manager) error {
if r.Client == nil {
r.Client = mgr.GetClient()
Expand Down Expand Up @@ -253,6 +263,10 @@ func (r *GlobalNodeController) Reconcile(ctx context.Context, request reconcile.
klog.Errorf("global-node-controller: can not found root node: %s", request.Name)
return reconcile.Result{RequeueAfter: utils.DefaultRequeueTime}, nil
}
if isMasterNode(rootNode) {
klog.V(4).Infof("skip the master node: %s", request.Name)
return reconcile.Result{}, nil
}
globalNode.Name = request.Name
globalNode.Spec.State = v1alpha1.NodeReserved
firstNodeIP, err := utils.FindFirstNodeIPAddress(*rootNode, constants.PreferredAddressType)
Expand Down

0 comments on commit e369bb0

Please sign in to comment.