Skip to content

Commit 192c36f

Browse files
committed
add initial BucketAccess controller reconciliation
Add initial implementation for BucketAccess reconciliation based on v1alpha2 KEP. This initial implementation covers only the first section of Controller reconciliation for a new BucketAccess. Coverage ends at the point where reconciliation is handed off to the Sidecar. Signed-off-by: Blaine Gardner <blaine.gardner@ibm.com>
1 parent 66761e6 commit 192c36f

File tree

13 files changed

+903
-34
lines changed

13 files changed

+903
-34
lines changed

client/apis/objectstorage/v1alpha2/bucketaccess_types.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,19 @@ type BucketClaimAccess struct {
167167
AccessSecretName string `json:"accessSecretName"`
168168
}
169169

170-
// AccessedBucket identifies a Bucket and corresponding access parameters.
170+
// AccessedBucket identifies a Bucket and correlates it to a BucketClaimAccess from the spec.
171171
type AccessedBucket struct {
172172
// bucketName is the name of a Bucket the access should have permissions for.
173173
// +required
174174
// +kubebuilder:validation:MinLength=1
175175
// +kubebuilder:validation:MaxLength=253
176176
BucketName string `json:"bucketName"`
177177

178-
// accessMode is the Read/Write access mode that the access should have for the bucket.
178+
// bucketClaimName must match a BucketClaimAccess's BucketClaimName from the spec.
179179
// +required
180-
AccessMode BucketAccessMode `json:"accessMode"`
180+
// +kubebuilder:validation:MinLength=1
181+
// +kubebuilder:validation:MaxLength=253
182+
BucketClaimName string `json:"bucketClaimName"`
181183
}
182184

183185
// +kubebuilder:object:root=true

client/apis/objectstorage/v1alpha2/definitions.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,36 @@ limitations under the License.
1616

1717
package v1alpha2
1818

19+
// Finalizers
1920
const (
2021
// ProtectionFinalizer is applied to a COSI resource object to protect it from deletion while
2122
// COSI processes deletion of the object's intermediate and backend resources.
2223
ProtectionFinalizer = `objectstorage.k8s.io/protection`
2324
)
2425

26+
// Annotations
27+
const (
28+
// HasBucketAccessReferencesAnnotation : This annotation is applied by the COSI Controller to a
29+
// BucketClaim when a BucketAccess that references the BucketClaim is created. The annotation
30+
// remains for as long as any BucketAccess references the BucketClaim. Once all BucketAccesses
31+
// that reference the BucketClaim are deleted, the annotation is removed.
32+
HasBucketAccessReferencesAnnotation = `objectstorage.k8s.io/has-bucketaccess-references`
33+
34+
// SidecarCleanupFinishedAnnotation : This annotation is applied by a COSI Sidecar to a managed
35+
// BucketAccess when the resources is being deleted. The Sidecar calls the Driver to perform
36+
// backend deletion actions and then hands off final deletion cleanup to the COSI Controller
37+
// by setting this annotation on the resource.
38+
SidecarCleanupFinishedAnnotation = `objectstorage.k8s.io/sidecar-cleanup-finished`
39+
40+
// ControllerManagementOverrideAnnotation : This annotation can be applied to a resource by the
41+
// COSI Controller in order to reclaim management of the resource temporarily when it would
42+
// otherwise be managed by a COSI Sidecar. This is intended for scenarios where a bug in
43+
// provisioning needs to be rectified by a newer version of the COSI Controller. Once the bug is
44+
// resolved, the annotation should be removed to allow normal Sidecar handoff to occur.
45+
ControllerManagementOverrideAnnotation = `objectstorage.k8s.io/controller-management-override`
46+
)
47+
48+
// Sidecar RPC definitions
2549
const (
2650
// RpcEndpointDefault is the default RPC endpoint unix socket location.
2751
RpcEndpointDefault = "unix:///var/lib/cosi/cosi.sock"

client/config/crd/objectstorage.k8s.io_bucketaccesses.yaml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,16 +142,14 @@ spec:
142142
with per-Bucket access options. This field is populated by the COSI Controller based on the
143143
referenced BucketClaims in the spec.
144144
items:
145-
description: AccessedBucket identifies a Bucket and corresponding
146-
access parameters.
145+
description: AccessedBucket identifies a Bucket and correlates it
146+
to a BucketClaimAccess from the spec.
147147
properties:
148-
accessMode:
149-
description: accessMode is the Read/Write access mode that the
150-
access should have for the bucket.
151-
enum:
152-
- ReadWrite
153-
- ReadOnly
154-
- WriteOnly
148+
bucketClaimName:
149+
description: bucketClaimName must match a BucketClaimAccess's
150+
BucketClaimName from the spec.
151+
maxLength: 253
152+
minLength: 1
155153
type: string
156154
bucketName:
157155
description: bucketName is the name of a Bucket the access should
@@ -160,7 +158,7 @@ spec:
160158
minLength: 1
161159
type: string
162160
required:
163-
- accessMode
161+
- bucketClaimName
164162
- bucketName
165163
type: object
166164
type: array

0 commit comments

Comments
 (0)