Conversation
| } | ||
|
|
||
| return updatePVC(ctx, rclient, &existingObj, newObj, prevObj, owner) | ||
| func waitForPVCBound(ctx context.Context, rclient client.Client, nsn types.NamespacedName, generation int64) error { |
There was a problem hiding this comment.
Lets add unit tests for this function
There was a problem hiding this comment.
4 issues found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="internal/controller/operator/factory/reconcile/reconcile.go">
<violation number="1" location="internal/controller/operator/factory/reconcile/reconcile.go:27">
P1: The new PVC wait uses a hardcoded 5s timeout, so PVC binding can fail much earlier than the operator's configured readiness deadlines.</violation>
</file>
<file name="internal/controller/operator/factory/reconcile/statefulset_pvc_expand.go">
<violation number="1" location="internal/controller/operator/factory/reconcile/statefulset_pvc_expand.go:124">
P1: `waitForPVCBound` is called with the StatefulSet name instead of the PVC name, so it polls a non-existent PVC and times out.</violation>
</file>
<file name="internal/controller/operator/factory/reconcile/pvc.go">
<violation number="1" location="internal/controller/operator/factory/reconcile/pvc.go:51">
P1: Terminating PVCs no longer short-circuit successfully; this unconditional wait turns the previous skip path into a reconcile error.</violation>
<violation number="2" location="internal/controller/operator/factory/reconcile/pvc.go:51">
P1: Waiting for PVCs to reach `Bound` here can block valid `WaitForFirstConsumer` claims before their Deployment is created.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
internal/controller/operator/factory/reconcile/statefulset_pvc_expand.go
Outdated
Show resolved
Hide resolved
83d01f0 to
d9fd316
Compare
|
@AndrewChubatiuk I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
3 issues found across 15 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="internal/controller/operator/factory/reconcile/deploy.go">
<violation number="1" location="internal/controller/operator/factory/reconcile/deploy.go:102">
P1: `ProgressTimeoutExceeded` is not the Deployment condition reason Kubernetes sets here; use `ProgressDeadlineExceeded` or rollout timeout failures will be missed.</violation>
</file>
<file name="internal/controller/operator/factory/reconcile/statefulset_pvc_expand.go">
<violation number="1" location="internal/controller/operator/factory/reconcile/statefulset_pvc_expand.go:127">
P1: This waits on a stale PVC generation, so a just-updated PVC can be treated as ready before the resize spec is observed.</violation>
</file>
<file name="internal/controller/operator/factory/k8stools/interceptors.go">
<violation number="1" location="internal/controller/operator/factory/k8stools/interceptors.go:82">
P2: This now calls `Status().Update` for StatefulSet, Deployment, and PVC too, but the fake client is not configured with status subresources for those types, so intercepted updates will fail in tests.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
internal/controller/operator/factory/reconcile/statefulset_pvc_expand.go
Outdated
Show resolved
Hide resolved
f58e467 to
e137c63
Compare
aec1218 to
e330290
Compare
| if !existingObj.CreationTimestamp.IsZero() { | ||
| size = existingObj.Spec.Resources.Requests[corev1.ResourceStorage] | ||
| } | ||
| if err = waitForPVCReady(ctx, rclient, nsn, size); err != nil { |
There was a problem hiding this comment.
We should be waiting for ready PVC only after DeletionTimestamp check? If VMCluster is being delete we don't need to wait for bound PVC
There was a problem hiding this comment.
there are two loops: one for creation/update, another one - waiting for PVC readiness. deletion may happen in each of these loops, that's why checking deletion timestamp in both, exiting without error and showing a warning. No further reconciliation is needed till user performs manual actions
internal/controller/operator/factory/reconcile/statefulset_pvc_expand.go
Show resolved
Hide resolved
e330290 to
1dbeca6
Compare
|
@vrutkovs could you please take a look? |
fixes #1970
Summary by cubic
Wait for PVCs to be fully ready (Bound with requested capacity and not Resizing) before continuing reconcile and during StatefulSet PVC expansion. This pauses pod rollouts until storage is actually usable.
waitForPVCReadywith polling viaVM_PVC_WAIT_READY_INTERVALandVM_PVC_WAIT_READY_TIMEOUT; waits for requested capacity, PVC to be Bound, and not Resizing; skips if PVC is deleting.reconcile.Initnow takesBaseOperatorConf; addedVM_WAIT_READY_INTERVALfor VM CRs; renamed internals toAppWaitReadyTimeoutandPodWaitReadyInterval, env names unchanged).Written for commit 1dbeca6. Summary will update on new commits.