Skip to content

Commit fa8e744

Browse files
faiqdkoshkin
andauthored
feat: adds aws ebs config (#192)
Implements the CSI driver for AWS EBS as well as a "defaultStorageClass" option. A user can test this functionality with CAPA clusters with the following under the main cluster config variable ``` addons: csi: providers: - name: aws-ebs defaultClassName: aws-ebs ``` --------- Co-authored-by: Dimitri Koshkin <dimitri.koshkin@gmail.com>
1 parent fc2ef20 commit fa8e744

23 files changed

+2749
-9
lines changed

api/v1alpha1/clusterconfig_types.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616

1717
const (
1818
CNIProviderCalico = "calico"
19+
CSIProviderAWSEBS = "aws-ebs"
1920
)
2021

2122
//+kubebuilder:object:root=true
@@ -320,6 +321,9 @@ type Addons struct {
320321

321322
// +optional
322323
NFD *NFD `json:"nfd,omitempty"`
324+
325+
// +optional
326+
CSIProviders *CSIProviders `json:"csi,omitempty"`
323327
}
324328

325329
func (Addons) VariableSchema() clusterv1.VariableSchema {
@@ -330,6 +334,7 @@ func (Addons) VariableSchema() clusterv1.VariableSchema {
330334
Properties: map[string]clusterv1.JSONSchemaProps{
331335
"cni": CNI{}.VariableSchema().OpenAPIV3Schema,
332336
"nfd": NFD{}.VariableSchema().OpenAPIV3Schema,
337+
"csi": CSIProviders{}.VariableSchema().OpenAPIV3Schema,
333338
},
334339
},
335340
}
@@ -369,6 +374,45 @@ func (NFD) VariableSchema() clusterv1.VariableSchema {
369374
}
370375
}
371376

377+
type CSIProviders struct {
378+
// +optional
379+
Providers []CSIProvider `json:"providers,omitempty"`
380+
// +optional
381+
DefaultClassName string `json:"defaultClassName,omitempty"`
382+
}
383+
384+
type CSIProvider struct {
385+
Name string `json:"name,omitempty"`
386+
}
387+
388+
func (CSIProviders) VariableSchema() clusterv1.VariableSchema {
389+
supportedCSIProviders := []string{CSIProviderAWSEBS}
390+
return clusterv1.VariableSchema{
391+
OpenAPIV3Schema: clusterv1.JSONSchemaProps{
392+
Type: "object",
393+
Properties: map[string]clusterv1.JSONSchemaProps{
394+
"providers": {
395+
Type: "array",
396+
Items: &clusterv1.JSONSchemaProps{
397+
Type: "object",
398+
Properties: map[string]clusterv1.JSONSchemaProps{
399+
"name": {
400+
Type: "string",
401+
Enum: variables.MustMarshalValuesToEnumJSON(
402+
supportedCSIProviders...),
403+
},
404+
},
405+
},
406+
},
407+
"defaultClassName": {
408+
Type: "string",
409+
Enum: variables.MustMarshalValuesToEnumJSON(supportedCSIProviders...),
410+
},
411+
},
412+
},
413+
}
414+
}
415+
372416
func init() {
373417
SchemeBuilder.Register(&ClusterConfig{})
374418
}

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 40 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)