Repository navigation
Wait for scanner-v4-db PVC cleanup - #324
Conversation
There was a problem hiding this comment.
🔇 Additional comments: 1
internal/deployer/deployer.go-124-124: 1
124-124:Major · Functional Correctness · Quick win
⚠️ Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.Stop redeployment when PVC cleanup cannot be verified.
If the owner lookup fails, the existing loop skips this PVC. If deletion fails,
deployCentralanddeploySecuredClusterlog the teardown error and continue. Either path can recreate the CR while the stale PVC remains, causing the owner-reference conflict this change targets. Return lookup errors and prevent redeployment when cleanup fails. (raw.githubusercontent.com)Also applies to: 187-187

Review info
-
Run configuration-
- Source mode: Auto
- Repository: stackrox/roxie
- Branch: mc/scanner-v4-db-pvc-cleanup
- File: .coderabbit.yml
- Commit: ff5656c
- Layers: Repository YAML
- Review profile: CHILL
- Plan: Advanced
- Run ID:
7d449a87-86eb-4142-91c3-42a85f9af86d
Files selected for processing: 1-
internal/deployer/deployer.go
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.
-
|
@coderabbitai, this (#324 (review)) is in some sense a pre-existing issue. Since the kubectl call involved here implements retries, I think the chances of this posing a problem in practice is quite low. |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain
Retries do not eliminate failures, but the remaining risk does not justify my “Major” classification or requiring broader error-handling changes in this PR. I retract that recommendation. You are interacting with an AI system. |
Summary
Delete
scanner-v4-dbPVC during both Central and SecuredCluster teardown to prevent stale ownerReference conflicts on redeployUnlike
central-db, thescanner-v4-dbPVC is not managed by the operator'sReconcilePVCExtension— its ownerReference cleanup currently relies solely on K8s garbage collection. On quick redeploy (e.g. in CI), asynchronously executing GC may not haev finished before the new CR is created, leaving a stale ownerReference. The operator then tries to add a secondcontroller: truereference, which K8s rejects, causing an error loop (#291).Owner-name guards ensure the PVC is only deleted if owned by the component being torn down, so shared-namespace deployments remain safe.
Fixes #291, fixes #321.
Test plan
TestSecuredClusterWithOLMSwitchpasses on OpenShift CI