@@ -58,11 +58,13 @@ type BucketAccessSpec struct {
5858 // bucketClaims is a list of BucketClaims the provisioned access must have permissions for,
5959 // along with per-BucketClaim access parameters and system output definitions.
6060 // At least one BucketClaim must be referenced.
61+ // A maximum of 128 BucketClaims may be referenced.
6162 // Multiple references to the same BucketClaim are not permitted.
6263 // +required
6364 // +listType=map
6465 // +listMapKey=bucketClaimName
6566 // +kubebuilder:validation:MinItems=1
67+ // +kubebuilder:validation:MaxItems=128
6668 // +kubebuilder:validation:XValidation:message="bucketClaims list is immutable",rule="self == oldSelf"
6769 BucketClaims []BucketClaimAccess `json:"bucketClaims,omitempty"`
6870
@@ -74,16 +76,18 @@ type BucketAccessSpec struct {
7476 BucketAccessClassName string `json:"bucketAccessClassName,omitempty"`
7577
7678 // protocol is the object storage protocol that the provisioned access must use.
79+ // Access can only be granted for BucketClaims that support the requested protocol.
80+ // Each BucketClaim status reports which protocols are supported for the BucketClaim's bucket.
81+ // Possible values: 'S3', 'Azure', 'GCS'.
7782 // +required
7883 // +kubebuilder:validation:XValidation:message="protocol is immutable",rule="self == oldSelf"
7984 Protocol ObjectProtocol `json:"protocol,omitempty"`
8085
8186 // serviceAccountName is the name of the Kubernetes ServiceAccount that user application Pods
8287 // intend to use for access to referenced BucketClaims.
83- // This has different behavior based on the BucketAccessClass's defined AuthenticationType:
84- // - Key: This field is ignored.
85- // - ServiceAccount: This field is required. The driver should configure the system so that Pods
86- // using the ServiceAccount authenticate to the object storage backend automatically.
88+ // Required when the BucketAccessClass is configured to use ServiceAccount authentication type.
89+ // Ignored for all other authentication types.
90+ // It is recommended to specify this for all BucketAccesses to improve portability.
8791 // +optional
8892 // +kubebuilder:validation:MinLength=1
8993 // +kubebuilder:validation:MaxLength=253
@@ -104,8 +108,12 @@ type BucketAccessStatus struct {
104108
105109 // accountID is the unique identifier for the backend access known to the driver.
106110 // This field is populated by the COSI Sidecar once access has been successfully granted.
111+ // Must be at most 2048 characters and consist only of alphanumeric characters ([a-z0-9A-Z]),
112+ // dashes (-), dots (.), and underscores (_).
107113 // +optional
108114 // +kubebuilder:validation:MinLength=1
115+ // +kubebuilder:validation:MaxLength=2048
116+ // +kubebuilder:validation:Pattern=`^[a-zA-Z0-9._-]+$`
109117 // +kubebuilder:validation:XValidation:message="accountId is immutable once set",rule="self == oldSelf"
110118 AccountID string `json:"accountID,omitempty"`
111119
@@ -116,25 +124,35 @@ type BucketAccessStatus struct {
116124 // +listType=map
117125 // +listMapKey=bucketName
118126 // +kubebuilder:validation:MinItems=1
127+ // +kubebuilder:validation:MaxItems=128
119128 // +kubebuilder:validation:XValidation:message="accessedBuckets is immutable once set",rule="self == oldSelf"
120129 AccessedBuckets []AccessedBucket `json:"accessedBuckets,omitempty"`
121130
122131 // driverName holds a copy of the BucketAccessClass driver name from the time of BucketAccess
123132 // provisioning. This field is populated by the COSI Controller.
133+ // Must be 63 characters or less, beginning and ending with an alphanumeric character
134+ // ([a-z0-9A-Z]) with dashes (-), dots (.), and alphanumerics between.
124135 // +optional
125136 // +kubebuilder:validation:MinLength=1
137+ // +kubebuilder:validation:MaxLength=63
138+ // +kubebuilder:validation:Pattern=`^[a-zA-Z0-9]([a-zA-Z0-9\-\.]{0,61}[a-zA-Z0-9])?$`
126139 // +kubebuilder:validation:XValidation:message="driverName is immutable once set",rule="self == oldSelf"
127140 DriverName string `json:"driverName,omitempty"`
128141
129142 // authenticationType holds a copy of the BucketAccessClass authentication type from the time of
130143 // BucketAccess provisioning. This field is populated by the COSI Controller.
144+ // Possible values:
145+ // - Key: clients may use a protocol-appropriate access key to authenticate to the backend object store.
146+ // - ServiceAccount: Pods using the ServiceAccount given in spec.serviceAccountName may authenticate to the backend object store automatically.
131147 // +optional
132148 // +kubebuilder:validation:XValidation:message="authenticationType is immutable once set",rule="self == oldSelf"
133149 AuthenticationType BucketAccessAuthenticationType `json:"authenticationType,omitempty"`
134150
135151 // parameters holds a copy of the BucketAccessClass parameters from the time of BucketAccess
136152 // provisioning. This field is populated by the COSI Controller.
137153 // +optional
154+ // +kubebuilder:validation:MinProperties=1
155+ // +kubebuilder:validation:MaxProperties=512
138156 // +kubebuilder:validation:XValidation:message="accessedBuckets is immutable once set",rule="self == oldSelf"
139157 Parameters map [string ]string `json:"parameters,omitempty"`
140158
@@ -150,13 +168,22 @@ type BucketAccessStatus struct {
150168type BucketClaimAccess struct {
151169 // bucketClaimName is the name of a BucketClaim the access should have permissions for.
152170 // The BucketClaim must be in the same Namespace as the BucketAccess.
171+ // Must be a valid Kubernetes resource name: at most 253 characters, consisting only of
172+ // lower-case alphanumeric characters, hyphens, and periods, starting and ending with an
173+ // alphanumeric character.
153174 // +required
154175 // +kubebuilder:validation:MinLength=1
155176 // +kubebuilder:validation:MaxLength=253
177+ // +kubebuilder:validation:XValidation:message="name must be a valid resource name",rule="!format.dns1123Subdomain().validate(self).hasValue()"
156178 BucketClaimName string `json:"bucketClaimName,omitempty"`
157179
158180 // accessMode is the Read/Write access mode that the access should have for the bucket.
159- // Possible values: ReadWrite, ReadOnly, WriteOnly.
181+ // The provisioned access will have the corresponding permissions to read and/or write objects
182+ // the BucketClaim's bucket.
183+ // The provisioned access can also assume to have corresponding permissions to read and/or write
184+ // object metadata and object metadata (e.g., tags) except when metadata changes would change
185+ // object store behaviors or permissions (e.g., changes to object caching behaviors).
186+ // Possible values: 'ReadWrite', 'ReadOnly', 'WriteOnly'.
160187 // +required
161188 AccessMode BucketAccessMode `json:"accessMode,omitempty"`
162189
@@ -166,24 +193,36 @@ type BucketClaimAccess struct {
166193 // BucketAccess is deleted and deprovisioned.
167194 // The Secret name must be unique across all bucketClaimRefs for all BucketAccesses in the same
168195 // Namespace.
196+ // Must be a valid Kubernetes resource name: at most 253 characters, consisting only of
197+ // lower-case alphanumeric characters, hyphens, and periods, starting and ending with an
198+ // alphanumeric character.
169199 // +required
170200 // +kubebuilder:validation:MinLength=1
171201 // +kubebuilder:validation:MaxLength=253
202+ // +kubebuilder:validation:XValidation:message="name must be a valid resource name",rule="!format.dns1123Subdomain().validate(self).hasValue()"
172203 AccessSecretName string `json:"accessSecretName,omitempty"`
173204}
174205
175206// AccessedBucket identifies a Bucket and correlates it to a BucketClaimAccess from the spec.
176207type AccessedBucket struct {
177208 // bucketName is the name of a Bucket the access should have permissions for.
209+ // Must be a valid Kubernetes resource name: at most 253 characters, consisting only of
210+ // lower-case alphanumeric characters, hyphens, and periods, starting and ending with an
211+ // alphanumeric character.
178212 // +required
179213 // +kubebuilder:validation:MinLength=1
180214 // +kubebuilder:validation:MaxLength=253
215+ // +kubebuilder:validation:XValidation:message="name must be a valid resource name",rule="!format.dns1123Subdomain().validate(self).hasValue()"
181216 BucketName string `json:"bucketName,omitempty"`
182217
183218 // bucketClaimName must match a BucketClaimAccess's BucketClaimName from the spec.
219+ // Must be a valid Kubernetes resource name: at most 253 characters, consisting only of
220+ // lower-case alphanumeric characters, hyphens, and periods, starting and ending with an
221+ // alphanumeric character.
184222 // +required
185223 // +kubebuilder:validation:MinLength=1
186224 // +kubebuilder:validation:MaxLength=253
225+ // +kubebuilder:validation:XValidation:message="name must be a valid resource name",rule="!format.dns1123Subdomain().validate(self).hasValue()"
187226 BucketClaimName string `json:"bucketClaimName,omitempty"`
188227}
189228
0 commit comments