Skip to content

fix: skip nodedrain coordination when cluster is unready to prevent p… - #315

Merged
noctarius merged 5 commits into
mainfrom
node_drain_monitor_active_cluster
Jul 13, 2026
Merged

fix: skip nodedrain coordination when cluster is unready to prevent p…#315
noctarius merged 5 commits into
mainfrom
node_drain_monitor_active_cluster

Conversation

@geoffrey1330

Copy link
Copy Markdown
Collaborator

…remature PDB creation

Summary

Skip nodedrain coordination and PDB pre-creation when the cluster is in unready state to prevent interference with the initial node provisioning flow.

Problem

During initial cluster setup the cluster status is unready until enough storage nodes join for the first activation. The nodedrain controller was running its full reconcile loop — including pre-creating blocking PDBs — before the cluster was ready. This caused:

  • Spurious timeout errors as pollNodeOnline timed out waiting for nodes that couldn't come online yet (cluster not activated)
  • PDBs being created prematurely, potentially blocking node reboots required to apply KubeletConfig/MachineConfig during the node-add flow

Changes

  • Added ClusterStatusUnready = "unready" to internal/utils/constants.go
  • Added an early-return guard in NodeDrainCoordinatorReconciler.Reconcile that requeues at 30s when clusterCR.Status.Status == "unready", skipping all drain coordination and PDB creation
  • Other non-active states (degraded, suspended) are intentionally unaffected — drain coordination should continue for those

Behaviour

Cluster status Drain coordinator PDBs
unready Skipped (requeue 30s) Not created
active Runs normally Created on first reconcile
degraded / suspended Runs normally Retained

@noctarius

Copy link
Copy Markdown
Collaborator

Let's start to add unit tests for all things :)

@noctarius noctarius left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

if clusterCR, err := utils.ResolveClusterCR(ctx, r.Client, snCR.Namespace, snCR.Spec.ClusterName); err == nil {
if clusterCR.Status.Status == utils.ClusterStatusUnready {
if activateErr := maybeActivateCluster(ctx, apiClient, clusterUUID, snCR, r); activateErr != nil {
log.Info("Activation conditions not yet met", "reason", activateErr.Error())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need to jump out and send a ctrl.Result?

@geoffrey1330 geoffrey1330 Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we would want this continue incase we have other operations.
sending ctrl.Result will block this reconcilation and other operation

@noctarius noctarius added this to the 26.3 milestone Jul 10, 2026
@noctarius
noctarius merged commit 12c90a7 into main Jul 13, 2026
5 checks passed
@noctarius
noctarius deleted the node_drain_monitor_active_cluster branch July 13, 2026 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants