Skip to content

fix(objectstorage-controller): propagate Bucket readiness to BucketClaim - #2792

Merged
Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
fix/cosi-bucketclaim-propagate-ready
Jun 5, 2026
Merged

Aleksei Sviridkin (lexfrei) merged 1 commit into
mainfrom
fix/cosi-bucketclaim-propagate-ready

Conversation

@lexfrei

@lexfrei Aleksei Sviridkin (lexfrei) commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does

The vendored COSI objectstorage-controller (built from upstream v0.2.2) leaves dynamically-provisioned buckets without credentials.

In the dynamic-provisioning path, provisionBucketClaimOperation sets BucketClaim.status.bucketName but hardcodes bucketReady=false and never re-reads the Bucket. The controller does not watch Bucket objects, so the readiness transition the sidecar performs after DriverCreateBucket (Bucket.status.bucketReady false→true) is never propagated back to the BucketClaim. Each periodic resync re-enters the same branch (Buckets().Create returns AlreadyExists, which is ignored) and re-sets bucketReady=false. As a result BucketClaim.status.bucketReady stays false forever, the sidecar refuses to grant the BucketAccess ("BucketAccess can't be granted to Bucket not in Ready state"), and the credentials secret is never created — even though the bucket exists in the backend and the Bucket CR already reports bucketReady: true.

This adds a vendored patch that re-reads the live Bucket after create and propagates its readiness onto the BucketClaim, so the existing periodic resync converges the claim to ready and access can be granted.

The fix mirrors what the rewritten upstream controller already does on main (claim.Status.ReadyToUse = bucket.Status.ReadyToUse). Upstream main is a v1alpha2 rewrite and the maintained release-0.2 branch still carries the bug, so this stays a vendored patch against v0.2.2 until the controller is bumped to a release that includes the fix.

Verified: reproduced the stuck-false claim with a unit test against the upstream v0.2.2 source and confirmed the patch resolves it, existing controller tests pass, the patch applies cleanly to v0.2.2, and the controller image builds.

Release note

fix(objectstorage-controller): propagate Bucket readiness to the BucketClaim so dynamically-provisioned buckets receive credentials instead of getting stuck without a granted BucketAccess

Summary by CodeRabbit

  • Bug Fixes
    • Fixed an issue where bucket readiness status was incorrectly reported when a bucket already existed. The status now accurately reflects the actual state of the existing bucket instead of being unconditionally set to not ready.

The vendored COSI controller (v0.2.2) sets only BucketClaim.status.bucketName
in the dynamic-provisioning path and hardcodes bucketReady=false, never
re-reading the Bucket afterwards. The controller does not watch Buckets, so the
readiness transition the sidecar performs (false->true) is never reflected on
the BucketClaim: bucketReady stays false forever and BucketAccess is never
granted, leaving provisioned buckets without credentials.

Re-read the live Bucket after create and propagate its readiness, so the
periodic resync converges the BucketClaim to ready. This matches the behavior
the rewritten upstream controller already has on its main branch.

Assisted-By: Claude <[email protected]>
Signed-off-by: Aleksei Sviridkin <[email protected]>
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

@github-actions github-actions Bot added area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review kind/bug Categorizes issue or PR as related to a bug size/S This PR changes 10-29 lines, ignoring generated files labels Jun 2, 2026
@coderabbitai

coderabbitai Bot commented Jun 2, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8cd85afa-bf1f-4f53-837c-5d5a54fd943d

📥 Commits

Reviewing files that changed from the base of the PR and between 26da871 and ed20a43.

📒 Files selected for processing (1)
  • packages/system/objectstorage-controller/images/objectstorage/patches/92-bucketclaim-propagate-ready.diff

📝 Walkthrough

Walkthrough

This PR updates the provisionBucketClaimOperation function to properly propagate the BucketReady status from an existing Bucket object to a BucketClaim, replacing the previous behavior of unconditionally setting it to false. The change includes error handling for API read failures.

Changes

BucketReady Status Propagation

Layer / File(s) Summary
Live bucket status propagation
packages/system/objectstorage-controller/images/objectstorage/patches/92-bucketclaim-propagate-ready.diff
When a bucket already exists, the controller fetches the current Bucket object from the Kubernetes API and copies its BucketReady status to the BucketClaim. If the read fails, a warning is recorded and the reconcile operation fails.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Poem

A bucket once silent now speaks its mind,
Its readiness shared with the claim behind,
No longer false, but truthfully known—
The status now grows from what's been shown. 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main fix: propagating Bucket readiness status to BucketClaim, which aligns with the primary objective of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/cosi-bucketclaim-propagate-ready

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@dosubot dosubot Bot added the area/storage Issues or PRs related to storage (linstor, seaweedfs, bucket, velero, harbor) label Jun 2, 2026

@kvaps Andrei Kvapil (kvaps) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Verified the patch against the actual upstream source: it applies cleanly to v0.2.2 on top of the existing 91-bucketaccess-conflict-retry.diff in the Dockerfile's glob order, and the semantics check out — the fresh-create path is unchanged (a just-created Bucket is bucketReady=false anyway), while the AlreadyExists path now picks up the readiness the sidecar set in the meantime. Convergence is fast: the controller runtime's default resync is 30s, and once the claim is ready provisionBucketClaimOperation early-returns, so there's no churn after convergence. The fix also mirrors what upstream main does (claim.Status.ReadyToUse = bucket.Status.ReadyToUse), so the vendored patch won't fight a future controller bump.

@lexfrei
Aleksei Sviridkin (lexfrei) merged commit 67b406f into main Jun 5, 2026
14 checks passed
@lexfrei
Aleksei Sviridkin (lexfrei) deleted the fix/cosi-bucketclaim-propagate-ready branch June 5, 2026 08:10
@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/storage Issues or PRs related to storage (linstor, seaweedfs, bucket, velero, harbor) area/uncategorized PR auto-labeler could not map title scope to a known area/*; please review kind/backport Categorizes issue or PR as requiring a backport to the current release line kind/bug Categorizes issue or PR as related to a bug size/S This PR changes 10-29 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants