Skip to content

Commit

Permalink
Merge pull request #4593 from djoshy/custom-multi-exit
Browse files Browse the repository at this point in the history
OCPBUGS-41920: MCPs report wrong number of nodes when we move nodes from one custom MCP to another custom MCP
  • Loading branch information
openshift-merge-bot[bot] authored Sep 19, 2024
2 parents 4b8894a + acb2262 commit 7e9d9a5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions pkg/controller/node/node_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ func (ctrl *Controller) logPoolNode(pool *mcfgv1.MachineConfigPool, node *corev1
klog.Infof("Pool %s%s: node %s: %s", pool.Name, zonemsg, node.Name, msg)
}

//nolint:gocyclo
func (ctrl *Controller) updateNode(old, cur interface{}) {
oldNode := old.(*corev1.Node)
curNode := cur.(*corev1.Node)
Expand Down Expand Up @@ -586,6 +587,26 @@ func (ctrl *Controller) updateNode(old, cur interface{}) {
ctrl.logPoolNode(pool, curNode, "changed from pool %s", oldPool.Name)
// Let's also make sure the old pool node counts/status get updated
ctrl.enqueueMachineConfigPool(oldPool)
} else if err != nil {
// getPrimaryPoolForNode may error due to multiple custom pools. In this scenario, let's
// queue all of them so that when the node attempts to exit from this error state, the MCP
// statuses are updated correctly.
klog.Errorf("error fetching old primary pool for node %s, attempting to sync all old pools", oldNode.Name)
masterPool, workerPool, customPools, listErr := helpers.ListPools(oldNode, ctrl.mcpLister)
if listErr == nil {
for _, pool := range customPools {
ctrl.enqueueMachineConfigPool(pool)
}
if masterPool != nil {
ctrl.enqueueMachineConfigPool(masterPool)
}
if workerPool != nil {
ctrl.enqueueMachineConfigPool(workerPool)
}
} else {
klog.Errorf("error listing old pools %v for node %s", listErr, oldNode.Name)
}

}

var changed bool
Expand Down

0 comments on commit 7e9d9a5

Please sign in to comment.