Skip to content

Commit ed20a43

Browse files
committed
fix(objectstorage-controller): propagate Bucket readiness to BucketClaim
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]>
1 parent 26da871 commit ed20a43

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
diff --git a/controller/pkg/bucketclaim/bucketclaim.go b/controller/pkg/bucketclaim/bucketclaim.go
2+
index 2b55c49..038cf28 100644
3+
--- a/controller/pkg/bucketclaim/bucketclaim.go
4+
+++ b/controller/pkg/bucketclaim/bucketclaim.go
5+
@@ -213,8 +213,23 @@ func (b *BucketClaimListener) provisionBucketClaimOperation(ctx context.Context,
6+
return b.recordError(inputBucketClaim, v1.EventTypeWarning, v1alpha1.FailedCreateBucket, err)
7+
}
8+
9+
+ // The Bucket for this claim may already exist from an earlier reconcile,
10+
+ // in which case the sidecar may have provisioned the backend and flipped
11+
+ // the Bucket to ready in the meantime. The controller does not watch
12+
+ // Buckets, so re-read the live object and propagate its readiness here;
13+
+ // otherwise the BucketClaim stays BucketReady=false forever (each resync
14+
+ // re-enters this branch, Create returns AlreadyExists, and the readiness
15+
+ // transition is never reflected), so BucketAccess can never be granted.
16+
+ createdBucket, getErr := b.buckets().Get(ctx, bucketName, metav1.GetOptions{})
17+
+ if getErr != nil {
18+
+ klog.V(3).ErrorS(getErr, "Error reading bucket after create",
19+
+ "bucket", bucketName,
20+
+ "bucketClaim", bucketClaim.ObjectMeta.Name)
21+
+ return b.recordError(inputBucketClaim, v1.EventTypeWarning, v1alpha1.FailedCreateBucket, getErr)
22+
+ }
23+
+
24+
bucketClaim.Status.BucketName = bucketName
25+
- bucketClaim.Status.BucketReady = false
26+
+ bucketClaim.Status.BucketReady = createdBucket.Status.BucketReady
27+
}
28+
29+
// Update status with retry logic for conflict errors

0 commit comments

Comments
 (0)