Skip to content

Commit 2526026

Browse files
Add COSI addon APIs
Similar to CSI, add NutanixCOSI Provider addon API.
1 parent 6b33e5f commit 2526026

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

api/v1alpha1/addon_types.go

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
storagev1 "k8s.io/api/storage/v1"
99

1010
nutanixv1 "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/external/github.com/nutanix-cloud-native/cluster-api-provider-nutanix/api/v1beta1"
11+
objectstoragev1alpha1 "github.com/nutanix-cloud-native/cluster-api-runtime-extensions-nutanix/api/external/sigs.k8s.io/container-object-storage-interface/client/apis/objectstorage/v1alpha1"
1112
)
1213

1314
// All kubebuilder "Enum" build tag values are available in the OpenAPI spec.
@@ -249,10 +250,98 @@ type CSICredentials struct {
249250

250251
type DockerCOSI struct {
251252
GenericCOSI `json:",inline"`
253+
254+
Providers DockerCOSIProviders `json:"providers"`
255+
}
256+
257+
type DockerCOSIProviders struct {
258+
DockerCOSI COSIProvider `json:"docker"`
252259
}
253260

254261
type NutanixCOSI struct {
255262
GenericCOSI `json:",inline"`
263+
264+
Providers NutanixCOSIProviders `json:"providers"`
265+
}
266+
267+
// COSICredentials holds a reference to the Secret used by the COSI provider.
268+
type COSICredentials struct {
269+
// A reference to the Secret containing the credentials used by the COSI provider.
270+
// +kubebuilder:validation:Required
271+
SecretRef LocalObjectReference `json:"secretRef"`
272+
}
273+
274+
type BucketClassRetentionPolicy objectstoragev1alpha1.DeletionPolicy
275+
276+
// BucketClassConfig describes how to create a BucketClass in the cluster
277+
type BucketClassConfig struct {
278+
// RetentionPolicy is used to specify how COSI should handle deletion of this
279+
// bucket. There are 2 possible values:
280+
// - Retain: Indicates that the bucket should not be deleted from the OSP
281+
// - Delete: Indicates that the bucket should be deleted from the OSP
282+
// once all the workloads accessing this bucket are done
283+
// +kubebuilder:default:=Retain
284+
RetentionPolicy BucketClassRetentionPolicy `json:"deletionPolicy"`
285+
286+
// Parameters is an opaque map for passing in configuration to a driver
287+
// for creating the bucket
288+
// +optional
289+
Parameters map[string]string `json:"parameters,omitempty"`
290+
}
291+
292+
type BucketAccessClassAuthenticationType objectstoragev1alpha1.AuthenticationType
293+
294+
// BucketAccessClassConfig describes how to create a BucketAccessClass in the cluster
295+
type BucketAccessClassConfig struct {
296+
// AuthenticationType denotes the style of authentication
297+
// It can be one of
298+
// Key - access, secret tokens based authentication
299+
// IAM - implicit authentication of pods to the OSP based on service account mappings
300+
// +kubebuilder:default:=Key
301+
AuthenticationType BucketAccessClassAuthenticationType `json:"authenticationType"`
302+
303+
// Parameters is an opaque map for passing in configuration to a driver
304+
// for granting access to a bucket
305+
// +optional
306+
Parameters map[string]string `json:"parameters,omitempty"`
307+
}
308+
309+
// COSIProvider is analogous to CSIProvider, but for object storage. It allows
310+
// you to configure credentials and (optionally) “BucketClassConfigs” or
311+
// provider-specific parameters for object buckets.
312+
type COSIProvider struct {
313+
// BucketClassConfigs is a map of storage class configurations for this CSI provider.
314+
// +kubebuilder:validation:Optional
315+
// +kubebuilder:minItems=1
316+
BucketClassConfigs map[string]BucketClassConfig `json:"bucketClassConfigs,omitempty"`
317+
318+
// BucketAccessClassConfigs is a map of storage class configurations for this CSI provider.
319+
// +kubebuilder:validation:Optional
320+
// +kubebuilder:minItems=1
321+
BucketAccessClassConfigs map[string]BucketClassConfig `json:"bucketAccessClassConfigs,omitempty"`
322+
323+
// Addon strategy used to deploy the specific COSI provider to the workload cluster.
324+
// +kubebuilder:default=HelmAddon
325+
// +kubebuilder:validation:Enum=HelmAddon
326+
Strategy *AddonStrategy `json:"strategy,omitempty"`
327+
}
328+
329+
type NutanixCOSIProviders struct {
330+
NutanixCOSI COSIProvider `json:"nutanix"`
331+
}
332+
333+
type NutanixCOSIProvider struct {
334+
COSIProvider `json:",inline"`
335+
336+
// PrismCentralCredentials is a reference to the secret used by the COSI Provider to authenticate with prism central
337+
// to create IAM users
338+
// +kubebuilder:validation:Required
339+
PrismCentralCredentials *COSICredentials `json:"prismCentralCredentials,omitempty"`
340+
341+
// ObjectsStoreCredentials is a reference to the secret used by the COSI Provider to do S3 Operations on the Objects
342+
// Store
343+
// +kubebuilder:validation:Required
344+
ObjectsStoreCredentials *COSICredentials `json:"objectsStoreCredentials,omitempty"`
256345
}
257346

258347
// CCM tells us to enable or disable the cloud provider interface.

0 commit comments

Comments
 (0)