Skip to content

cluster: don't wait for storage pods in a maintenance - #2717

Merged
Haleygo merged 5 commits into
masterfrom
skip-waiting-for-maintenance-pods
Oct 21, 2026
Merged

Haleygo merged 5 commits into
masterfrom
skip-waiting-for-maintenance-pods

Conversation

@AndrewChubatiuk

@AndrewChubatiuk AndrewChubatiuk commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

fixes #2665

Operator leaves a pod listed in both vmstorage.maintenanceInsertNodeIDs and vmstorage.maintenanceSelectNodeIDs fields alone during reconciliation, since it receives no reads and no writes:

  • it doesn't wait for the pod to become ready, so a pod stuck Pending or Terminating no longer blocks
    reconciliation of vminsert and vmselect;
  • it doesn't apply vmstorage spec changes to the pod or its volumes, e.g. a new image or a bigger volume size.

A pod listed in only one of the two fields still receives the other kind of traffic, so the Operator handles it as usual.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 issue found across 11 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="internal/controller/operator/factory/vtcluster/storage.go">

<violation number="1" location="internal/controller/operator/factory/vtcluster/storage.go:189">
P2: With the `RollingUpdate` wait path, out-of-range maintenance IDs still reduce the required Ready replicas because reconciliation subtracts the set length. Filter these IDs to the active replica range; stale IDs can otherwise let the StatefulSet reconcile while live pods remain unready.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread internal/controller/operator/factory/vmcluster/vmcluster.go
Comment thread internal/controller/operator/factory/vlcluster/vlstorage.go
cr.Spec.Storage.ReplicaCount = existingSpec.Replicas
}
},
IgnoreNotReadyPodOrdinals: cr.StorageNodeIDsUnderMaintenance(),

@cubic-dev-ai cubic-dev-ai Bot Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: With the RollingUpdate wait path, out-of-range maintenance IDs still reduce the required Ready replicas because reconciliation subtracts the set length. Filter these IDs to the active replica range; stale IDs can otherwise let the StatefulSet reconcile while live pods remain unready.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At internal/controller/operator/factory/vtcluster/storage.go, line 189:

<comment>With the `RollingUpdate` wait path, out-of-range maintenance IDs still reduce the required Ready replicas because reconciliation subtracts the set length. Filter these IDs to the active replica range; stale IDs can otherwise let the StatefulSet reconcile while live pods remain unready.</comment>

<file context>
@@ -186,6 +186,7 @@ func createOrUpdateVTStorageSTS(ctx context.Context, rclient client.Client, cr,
 				cr.Spec.Storage.ReplicaCount = existingSpec.Replicas
 			}
 		},
+		IgnoreNotReadyPodOrdinals: cr.StorageNodeIDsUnderMaintenance(),
 	}
 	owner := cr.AsOwner()
</file context>
Fix with cubic

Comment thread internal/controller/operator/factory/reconcile/statefulset.go Outdated
Comment thread docs/CHANGELOG.md Outdated
@AndrewChubatiuk
AndrewChubatiuk force-pushed the skip-waiting-for-maintenance-pods branch from bf24ed7 to 4874def Compare October 9, 2026 08:43
@AndrewChubatiuk

Copy link
Copy Markdown
Contributor Author

@cubic-ai-dev

@cubic-dev-ai

cubic-dev-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

@cubic-ai-dev

@AndrewChubatiuk I have started the AI code review. It will take a few minutes to complete.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 12 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread internal/controller/operator/factory/reconcile/statefulset.go
return true, nil
}
if *targetReplicas != existingObj.Status.ReadyReplicas || *targetReplicas != existingObj.Status.UpdatedReplicas {
if *targetReplicas != existingObj.Status.UpdatedReplicas {

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.

Would UpdatedReplicas have expected value? When some pods are on maintenance and replicaCount has changed it would probably get stuck?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch — only an issue under rollingUpdateStrategy: RollingUpdate. The default OnDelete path already defers maintenance pods. Under RollingUpdate, Kubernetes' own controller won't advance past a not-Ready pod, regardless of replica changes — that's native OrderedReady behavior and can't be bypassed without replacing it with our own maintenance-aware update path. Documented the limitation in the meantime.

@Haleygo

Haleygo commented Oct 20, 2026

Copy link
Copy Markdown
Member

Could you please add a new section to all relevant docs about this new behavior, including all the limitations?

@AndrewChubatiuk
AndrewChubatiuk force-pushed the skip-waiting-for-maintenance-pods branch from 8b14dc0 to 18c28f7 Compare October 20, 2026 10:42
@Haleygo

Haleygo commented Oct 21, 2026

Copy link
Copy Markdown
Member

I added two more things in 4bc910b

  1. RollingUpdate wait no longer blocks on a pod stuck Terminating as k8s leaves terminating pods out of status.updatedReplicas
  2. PVC resize no longer blocks on maintenance pods, the same as pod update.

Please let me know if you see any issue.

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 15 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread internal/controller/operator/factory/reconcile/statefulset_test.go Outdated
Comment thread api/operator/v1/vlcluster_types.go Outdated
Comment thread docs/resources/vlcluster.md Outdated
Comment thread docs/resources/vlcluster.md Outdated
Comment thread docs/resources/vmcluster.md Outdated
Comment thread docs/resources/vmcluster.md

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 9 files (changes from recent commits).

Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.

Turn on auto-fix | Re-trigger cubic

Comment thread docs/resources/vlcluster.md Outdated
Comment thread docs/resources/vtcluster.md Outdated
@Haleygo
Haleygo force-pushed the skip-waiting-for-maintenance-pods branch from 8d83c34 to 385cd3b Compare October 21, 2026 05:41

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 19 files

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread docs/CHANGELOG.md Outdated
@Haleygo
Haleygo force-pushed the skip-waiting-for-maintenance-pods branch from 385cd3b to 18e4506 Compare October 21, 2026 05:49

@cubic-dev-ai cubic-dev-ai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 1 file (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Turn on auto-fix | Re-trigger cubic

Comment thread docs/CHANGELOG.md
@Haleygo
Haleygo merged commit 05006d7 into master Oct 21, 2026
10 checks passed
@Haleygo
Haleygo deleted the skip-waiting-for-maintenance-pods branch October 21, 2026 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vmcluster: skip readiness check for vmstorage pods excluded by both maintenanceInsertNodeIDs and maintenanceSelectNodeIDs

3 participants