You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support to the COSI KEP for a single BucketAccess to reference
multiple BucketClaims. This is a highly requested feature that allows
COSI to support legacy applications that don't support buckets with
independent users/accesses.
Signed-off-by: Blaine Gardner <[email protected]>
Copy file name to clipboardExpand all lines: keps/sig-storage/1979-object-storage-support/README.md
+54-23
Original file line number
Diff line number
Diff line change
@@ -413,24 +413,24 @@ If a BucketClaim is in deleting state, no new BucketAccesses can be created for
413
413
3. COSI Sidecar detects the BucketAccess resource
414
414
1. Initially, corresponding Bucket in BucketAccess status is unknown, so sidecar exits with no action
415
415
4. COSI Controller detects the BucketAccess resource
416
-
1. Controller looks up corresponding BucketClaim
417
-
2. If BucketClaim is being deleted, error without retry
416
+
1. Controller looks up corresponding BucketClaim(s)
417
+
2. If any BucketClaim is being deleted, error without retry
418
418
3. Controller sets `objectstorage.k8s.io/bucketaccess-protection` finalizer on BucketAccess
419
-
4. Controller sets `objectstorage.k8s.io/has-bucketaccess-references` annotation on corresponding BucketClaim
419
+
4. Controller sets `objectstorage.k8s.io/has-bucketaccess-references` annotation on corresponding BucketClaim(s)
420
420
(block claim from being deleted until access is deleted)
421
-
5. If BucketClaim not ready, exit with retry
422
-
6. If Bucket-BucketClaim binding is not valid, exit and retry when Bucket/Claim updated
423
-
7. Once everything looks good on Bucket+Claim:
424
-
1. Set corresponding Bucket name on BucketAccess status
421
+
5. If BucketClaim(s) not ready, exit with retry
422
+
6. If any Bucket-BucketClaim binding is not valid, exit and retry when Bucket/Claim updated
423
+
7. Once everything looks good on Bucket+Claim(s):
424
+
1. Set corresponding Bucket references on BucketAccess status
425
425
2. Copy BucketAccessClass specs and parameters to BucketAccess status
426
-
5. COSI Sidecar detects the BucketAccess resource
427
-
1. BucketAccess status now shows corresponding Bucket name and BucketAccessClass info, so sidecar can provision
426
+
5. COSI Sidecar detects the BucketAccess resource update
427
+
1. BucketAccess status now shows corresponding Bucket(s) BucketAccessClass info, so sidecar can provision
428
428
2. If the BucketAccess's driver matches the sidecar's driver, continue
429
429
3. Sidecar applies `objectstorage.k8s.io/bucketaccess-protection` finalizer to the BucketAccess if needed
430
-
4. Sidecar looks up the Bucket to get necessary info
431
-
5. If Bucket has `objectstorage.k8.io/bucketclaim-being-deleted` annotation or deletion timestamp, error without retry
432
-
(this indicates the claim is being deleted, possibly race condition missed in Controller)
433
-
6. Sidecar calls the COSI driver via gRPC to generate unique access credentials for the Bucket
430
+
4. Sidecar looks up the Bucket(s) to get necessary info
431
+
5. If any Bucket has `objectstorage.k8.io/bucketclaim-being-deleted` annotation or deletion timestamp, error without retry
432
+
(this indicates one or more claims are being deleted, possibly race condition missed in Controller)
433
+
6. Sidecar calls the COSI driver via gRPC to generate unique access credentials for the Bucket(s)
434
434
7. If OSP returns provision fail, Sidecar reports error to BucketAccess status and retries gRPC call
435
435
8. When OSP returns provision success, COSI sidecar:
436
436
1. Applies `objectstorage.k8s.io/bucketaccess-protection` finalizer to the Secret
@@ -474,8 +474,6 @@ This section describes the current design for sharing buckets with other namespa
474
474
475
475
### COSI API Reference
476
476
477
-
<!-- TODO: clarify how to reuse access for multiple buckets -->
478
-
479
477
#### Annotations and finalizers
480
478
481
479
Annotations:
@@ -641,14 +639,39 @@ COSI end Users should generally expect that BucketAccess-BucketClaim pairings sh
641
639
COSI does not support static provisioning for BucketAccesses. Portability is still maintained because object storage accesses do not hold critical application data. Any BucketClaim can have a new, valid BucketAccess created for it at any time to provide access to the data. Because of this, it follows that it is possible to reclaim access to a Bucket that was ported without need for static access provisioning.
642
640
643
641
```go
642
+
// BucketAccessMode is the read/write mode a BucketAccess should have for a BucketClaim
643
+
// Supported values:
644
+
// - ReadWrite - read and write access allowed
645
+
// - WriteOnly - only write access allowed
646
+
// - ReadOnly - only read access allowed
647
+
BucketAccessMode string
648
+
649
+
BucketClaimReference {
650
+
// The name of the BucketClaim this BucketAccess should have permissions for.
651
+
// The BucketClaim must be in the same namespace as the BucketAccess.
652
+
BucketClaimName string
653
+
654
+
// AccessMode is the Read/Write access mode that this BucketAccess should have for the BucketClaim
655
+
AccessMode BucketAccessMode
656
+
}
657
+
658
+
BucketReference {
659
+
// The name of the Bucket this BucketAccess should have permissions for.
660
+
BucketName string
661
+
662
+
// AccessMode is the Read/Write access mode that this BucketAccess should have for the Bucket.
663
+
AccessMode BucketAccessMode
664
+
}
665
+
644
666
BucketAccess {
645
667
TypeMeta
646
668
ObjectMeta
647
669
648
670
Spec BucketAccessSpec {
649
-
// BucketClaimName is the name of the BucketClaim.
671
+
// BucketClaims is the list of BucketClaims this access should have permissions for.
672
+
// Multiple references to the same BucketClaim are not permitted.
650
673
// +required
651
-
BucketClaimName string
674
+
BucketClaims []BucketClaimReference
652
675
653
676
// BucketAccessClassName is the name of the BucketAccessClass.
654
677
// +required
@@ -673,11 +696,10 @@ BucketAccess {
673
696
// sidecar once access has been successfully granted.
674
697
AccountID string
675
698
676
-
// AccessedBucketName is the name of the Bucket resource that the access corresponds to. This is
677
-
// filled in by the Controller based on the BucketClaim so that the Sidecar knows what Bucket
678
-
// to allow access to for this BucketAccess.
679
-
// TODO: will have to update this to a list when 1-access:many-buckets support is added
680
-
AccessedBucketName string
699
+
// AccessedBuckets is the list of Buckets the access corresponds to, each with its related
700
+
// access mode. This is filled in by the Controller based on the BucketClaim so that the Sidecar
701
+
// knows what Buckets to allow access to for this BucketAccess.
702
+
AccessedBuckets []BucketReference
681
703
682
704
// DriverName holds a copy of the BucketAccessClass driver name at the time of BucketAccess
683
705
// provisioning. This is kept to ensure the BucketAccess can be modified/deleted even after
@@ -699,6 +721,8 @@ The `credentialsSecretName` is the name of the Kubernetes Secret that COSI will
699
721
700
722
A User or Administrator who needs to make modifications to an OSP access underlying a BucketAccess likely needs to do so because the OSP driver is missing features for managing a desired configuration and not because static access provisioning is intrinsically necessary. Static BucketAccess provisioning would be possible to implement, but doing so would be complicated. COSI, OSP drivers, Admins, and/or Users could (and probably would) each have different expectations and desires about how to handle corner cases in static access policies, and COSI couldn't reasonably enforce consistent handling of those expectations. Design and dev work would be large, and risk for bugs would be high. Because of this COSI design decision, some Admins will undoubtedly make modifications to OSP accesses using manual OSP access tools. These manual modifications will be done at the Admin's risk. The OSP driver is not guaranteed to preserve such modifications, and the OSP driver may get stuck in a position where it doesn't know how to continue managing the BucketAccess.
701
723
724
+
In the future, [sharing buckets](#sharing-buckets) across namespaces can be allowed by adding a namespace field to BucketClaimReference.
725
+
702
726
#### BucketAccessClass
703
727
704
728
The BucketAccessClass represents a set of common properties shared by multiple BucketAccesses. It is used to specify policies for creating access credentials, and also for configuring driver-specific access parameters.
0 commit comments