Skip to content

Commit 78b8792

Browse files
committed
cosi: add 1:many access:bucket design to kep
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]>
1 parent e17381a commit 78b8792

File tree

1 file changed

+54
-23
lines changed
  • keps/sig-storage/1979-object-storage-support

1 file changed

+54
-23
lines changed

Diff for: keps/sig-storage/1979-object-storage-support/README.md

+54-23
Original file line numberDiff line numberDiff line change
@@ -413,24 +413,24 @@ If a BucketClaim is in deleting state, no new BucketAccesses can be created for
413413
3. COSI Sidecar detects the BucketAccess resource
414414
1. Initially, corresponding Bucket in BucketAccess status is unknown, so sidecar exits with no action
415415
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
418418
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)
420420
(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
425425
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
428428
2. If the BucketAccess's driver matches the sidecar's driver, continue
429429
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)
434434
7. If OSP returns provision fail, Sidecar reports error to BucketAccess status and retries gRPC call
435435
8. When OSP returns provision success, COSI sidecar:
436436
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
474474

475475
### COSI API Reference
476476

477-
<!-- TODO: clarify how to reuse access for multiple buckets -->
478-
479477
#### Annotations and finalizers
480478

481479
Annotations:
@@ -641,14 +639,39 @@ COSI end Users should generally expect that BucketAccess-BucketClaim pairings sh
641639
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.
642640
643641
```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+
644666
BucketAccess {
645667
TypeMeta
646668
ObjectMeta
647669

648670
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.
650673
// +required
651-
BucketClaimName string
674+
BucketClaims []BucketClaimReference
652675

653676
// BucketAccessClassName is the name of the BucketAccessClass.
654677
// +required
@@ -673,11 +696,10 @@ BucketAccess {
673696
// sidecar once access has been successfully granted.
674697
AccountID string
675698

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
681703

682704
// DriverName holds a copy of the BucketAccessClass driver name at the time of BucketAccess
683705
// 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
699721
700722
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.
701723
724+
In the future, [sharing buckets](#sharing-buckets) across namespaces can be allowed by adding a namespace field to BucketClaimReference.
725+
702726
#### BucketAccessClass
703727
704728
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.
@@ -882,7 +906,14 @@ DriverGrantBucketAccess(DriverGrantBucketAccessRequest) DriverGrantBucketAccessR
882906
883907
DriverGrantBucketAccessRequest{
884908
"bucketID": "<Bucket.status.bucketID>", // e.g., "ba-<BucketClaim.UID>", "my-static-bucket"
885-
"accountName": "ba-<BucketAccess.UID>"
909+
"buckets": [
910+
{
911+
"bucketID": "<Bucket.status.bucketID>", // e.g., "ba-<BucketClaim.UID>", "my-static-bucket"
912+
"accessMode": "<accessMode>", // ReadWrite, ReadOnly, WriteOnly
913+
},
914+
// optional additional buckets the access should have permissions for
915+
],
916+
"accountName": "ba-<BucketAccess.UID>",
886917
"protocol": "<protocol>", // e.g., "S3", copied from BucketAccess.spec.protocol
887918
"parameters": { // copied from BucketAccess.status.parameters
888919
"key": "value",

0 commit comments

Comments
 (0)