Skip to content

Commit 221ff74

Browse files
feat(api): Add COSI addon APIs for Nutanix
Similar to CSI, add NutanixCOSI Provider addon API.
1 parent 6b33e5f commit 221ff74

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

Diff for: api/v1alpha1/addon_types.go

+83
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.
@@ -253,6 +254,88 @@ type DockerCOSI struct {
253254

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

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

0 commit comments

Comments
 (0)