Skip to content

Commit f4c313e

Browse files
committed
fixup! refactor: Use simple string for default storageclass config name
1 parent b933076 commit f4c313e

27 files changed

+57
-123
lines changed

api/v1alpha1/addon_types.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,20 +109,15 @@ type ClusterAutoscaler struct {
109109
Strategy AddonStrategy `json:"strategy"`
110110
}
111111

112-
type DefaultStorage struct {
113-
// Name of storage class config in any of the provider objects.
114-
// +kubebuilder:validation:Required
115-
// +kubebuilder:validation:MinLength=1
116-
StorageClassConfigName string `json:"storageClassConfigName"`
117-
}
118-
119112
type CSI struct {
120113
// +kubebuilder:validation:MinItems=1
121114
// +kubebuilder:validation:Required
122115
Providers []CSIProvider `json:"providers"`
123116

117+
// Name of the default storage class config in any of the provider objects.
124118
// +kubebuilder:validation:Required
125-
DefaultStorage DefaultStorage `json:"defaultStorage"`
119+
// +kubebuilder:validation:MinLength=1
120+
DefaultStorageClassConfigName string `json:"defaultStorageClassConfigName"`
126121
}
127122

128123
type CSIProvider struct {

api/v1alpha1/crds/caren.nutanix.com_awsclusterconfigs.yaml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,10 @@ spec:
100100
type: object
101101
csi:
102102
properties:
103-
defaultStorage:
104-
properties:
105-
storageClassConfigName:
106-
description: Name of storage class config in any of the provider objects.
107-
minLength: 1
108-
type: string
109-
required:
110-
- storageClassConfigName
111-
type: object
103+
defaultStorageClassConfigName:
104+
description: Name of the default storage class config in any of the provider objects.
105+
minLength: 1
106+
type: string
112107
providers:
113108
items:
114109
properties:
@@ -184,7 +179,7 @@ spec:
184179
minItems: 1
185180
type: array
186181
required:
187-
- defaultStorage
182+
- defaultStorageClassConfigName
188183
- providers
189184
type: object
190185
nfd:

api/v1alpha1/crds/caren.nutanix.com_dockerclusterconfigs.yaml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,10 @@ spec:
100100
type: object
101101
csi:
102102
properties:
103-
defaultStorage:
104-
properties:
105-
storageClassConfigName:
106-
description: Name of storage class config in any of the provider objects.
107-
minLength: 1
108-
type: string
109-
required:
110-
- storageClassConfigName
111-
type: object
103+
defaultStorageClassConfigName:
104+
description: Name of the default storage class config in any of the provider objects.
105+
minLength: 1
106+
type: string
112107
providers:
113108
items:
114109
properties:
@@ -184,7 +179,7 @@ spec:
184179
minItems: 1
185180
type: array
186181
required:
187-
- defaultStorage
182+
- defaultStorageClassConfigName
188183
- providers
189184
type: object
190185
nfd:

api/v1alpha1/crds/caren.nutanix.com_genericclusterconfigs.yaml

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -114,16 +114,11 @@ spec:
114114
type: object
115115
csi:
116116
properties:
117-
defaultStorage:
118-
properties:
119-
storageClassConfigName:
120-
description: Name of storage class config in any of the
121-
provider objects.
122-
minLength: 1
123-
type: string
124-
required:
125-
- storageClassConfigName
126-
type: object
117+
defaultStorageClassConfigName:
118+
description: Name of the default storage class config in any
119+
of the provider objects.
120+
minLength: 1
121+
type: string
127122
providers:
128123
items:
129124
properties:
@@ -210,7 +205,7 @@ spec:
210205
minItems: 1
211206
type: array
212207
required:
213-
- defaultStorage
208+
- defaultStorageClassConfigName
214209
- providers
215210
type: object
216211
nfd:

api/v1alpha1/crds/caren.nutanix.com_nutanixclusterconfigs.yaml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,10 @@ spec:
100100
type: object
101101
csi:
102102
properties:
103-
defaultStorage:
104-
properties:
105-
storageClassConfigName:
106-
description: Name of storage class config in any of the provider objects.
107-
minLength: 1
108-
type: string
109-
required:
110-
- storageClassConfigName
111-
type: object
103+
defaultStorageClassConfigName:
104+
description: Name of the default storage class config in any of the provider objects.
105+
minLength: 1
106+
type: string
112107
providers:
113108
items:
114109
properties:
@@ -184,7 +179,7 @@ spec:
184179
minItems: 1
185180
type: array
186181
required:
187-
- defaultStorage
182+
- defaultStorageClassConfigName
188183
- providers
189184
type: object
190185
nfd:

api/v1alpha1/zz_generated.deepcopy.go

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

examples/capi-quick-start/aws-cluster-calico-crs.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ spec:
2828
provider: Calico
2929
strategy: ClusterResourceSet
3030
csi:
31-
defaultStorage:
32-
storageClassConfigName: aws-ebs
31+
defaultStorageClassConfigName: aws-ebs
3332
providers:
3433
- name: aws-ebs
3534
storageClassConfig:

examples/capi-quick-start/aws-cluster-calico-helm-addon.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ spec:
2828
provider: Calico
2929
strategy: HelmAddon
3030
csi:
31-
defaultStorage:
32-
storageClassConfigName: aws-ebs
31+
defaultStorageClassConfigName: aws-ebs
3332
providers:
3433
- name: aws-ebs
3534
storageClassConfig:

examples/capi-quick-start/aws-cluster-cilium-crs.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ spec:
2828
provider: Cilium
2929
strategy: ClusterResourceSet
3030
csi:
31-
defaultStorage:
32-
storageClassConfigName: aws-ebs
31+
defaultStorageClassConfigName: aws-ebs
3332
providers:
3433
- name: aws-ebs
3534
storageClassConfig:

examples/capi-quick-start/aws-cluster-cilium-helm-addon.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ spec:
2828
provider: Cilium
2929
strategy: HelmAddon
3030
csi:
31-
defaultStorage:
32-
storageClassConfigName: aws-ebs
31+
defaultStorageClassConfigName: aws-ebs
3332
providers:
3433
- name: aws-ebs
3534
storageClassConfig:

examples/capi-quick-start/docker-cluster-calico-crs.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ spec:
2828
provider: Calico
2929
strategy: ClusterResourceSet
3030
csi:
31-
defaultStorage:
32-
storageClassConfigName: local-path
31+
defaultStorageClassConfigName: local-path
3332
providers:
3433
- name: local-path
3534
storageClassConfig:

examples/capi-quick-start/docker-cluster-calico-helm-addon.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ spec:
2828
provider: Calico
2929
strategy: HelmAddon
3030
csi:
31-
defaultStorage:
32-
storageClassConfigName: local-path
31+
defaultStorageClassConfigName: local-path
3332
providers:
3433
- name: local-path
3534
storageClassConfig:

examples/capi-quick-start/docker-cluster-cilium-crs.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ spec:
2828
provider: Cilium
2929
strategy: ClusterResourceSet
3030
csi:
31-
defaultStorage:
32-
storageClassConfigName: local-path
31+
defaultStorageClassConfigName: local-path
3332
providers:
3433
- name: local-path
3534
storageClassConfig:

examples/capi-quick-start/docker-cluster-cilium-helm-addon.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ spec:
2828
provider: Cilium
2929
strategy: HelmAddon
3030
csi:
31-
defaultStorage:
32-
storageClassConfigName: local-path
31+
defaultStorageClassConfigName: local-path
3332
providers:
3433
- name: local-path
3534
storageClassConfig:

examples/capi-quick-start/nutanix-cluster-calico-crs.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ spec:
7373
provider: Calico
7474
strategy: ClusterResourceSet
7575
csi:
76-
defaultStorage:
77-
storageClassConfigName: nutanix-volume
76+
defaultStorageClassConfigName: nutanix-volume
7877
providers:
7978
- credentials:
8079
secretRef:

examples/capi-quick-start/nutanix-cluster-calico-helm-addon.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ spec:
7373
provider: Calico
7474
strategy: HelmAddon
7575
csi:
76-
defaultStorage:
77-
storageClassConfigName: nutanix-volume
76+
defaultStorageClassConfigName: nutanix-volume
7877
providers:
7978
- credentials:
8079
secretRef:

examples/capi-quick-start/nutanix-cluster-cilium-crs.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ spec:
7373
provider: Cilium
7474
strategy: ClusterResourceSet
7575
csi:
76-
defaultStorage:
77-
storageClassConfigName: nutanix-volume
76+
defaultStorageClassConfigName: nutanix-volume
7877
providers:
7978
- credentials:
8079
secretRef:

examples/capi-quick-start/nutanix-cluster-cilium-helm-addon.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ spec:
7373
provider: Cilium
7474
strategy: HelmAddon
7575
csi:
76-
defaultStorage:
77-
storageClassConfigName: nutanix-volume
76+
defaultStorageClassConfigName: nutanix-volume
7877
providers:
7978
- credentials:
8079
secretRef:

hack/examples/patches/aws/csi.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
- op: "add"
55
path: "/spec/topology/variables/0/value/addons/csi"
66
value:
7-
defaultStorage:
8-
storageClassConfigName: aws-ebs
7+
defaultStorageClassConfigName: aws-ebs
98
providers:
109
- name: aws-ebs
1110
storageClassConfig:

hack/examples/patches/docker/csi.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
- op: "add"
55
path: "/spec/topology/variables/0/value/addons/csi"
66
value:
7-
defaultStorage:
8-
storageClassConfigName: local-path
7+
defaultStorageClassConfigName: local-path
98
providers:
109
- name: local-path
1110
storageClassConfig:

hack/examples/patches/nutanix/csi.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
- op: "add"
55
path: "/spec/topology/variables/0/value/addons/csi"
66
value:
7-
defaultStorage:
8-
storageClassConfigName: nutanix-volume
7+
defaultStorageClassConfigName: nutanix-volume
98
providers:
109
- name: nutanix
1110
storageClassConfig:

pkg/handlers/generic/lifecycle/csi/aws-ebs/handler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func New(
5858
func (a *AWSEBS) Apply(
5959
ctx context.Context,
6060
provider v1alpha1.CSIProvider,
61-
defaultStorageConfig v1alpha1.DefaultStorage,
61+
defaultStorageClassConfigName string,
6262
req *runtimehooksv1.AfterControlPlaneInitializedRequest,
6363
_ logr.Logger,
6464
) error {
@@ -78,7 +78,7 @@ func (a *AWSEBS) Apply(
7878
a.client,
7979
provider.StorageClassConfig,
8080
&req.Cluster,
81-
defaultStorageConfig,
81+
defaultStorageClassConfigName,
8282
v1alpha1.CSIProviderAWSEBS,
8383
v1alpha1.AWSEBSProvisioner,
8484
defaultStorageClassParameters,

pkg/handlers/generic/lifecycle/csi/handler.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type CSIProvider interface {
2727
Apply(
2828
context.Context,
2929
v1alpha1.CSIProvider,
30-
v1alpha1.DefaultStorage,
30+
string,
3131
*runtimehooksv1.AfterControlPlaneInitializedRequest,
3232
logr.Logger,
3333
) error
@@ -133,7 +133,7 @@ func (c *CSIHandler) AfterControlPlaneInitialized(
133133
err = handler.Apply(
134134
ctx,
135135
provider,
136-
csi.DefaultStorage,
136+
csi.DefaultStorageClassConfigName,
137137
req,
138138
log,
139139
)
@@ -162,7 +162,7 @@ func validateDefaultStorage(csi v1alpha1.CSI) error {
162162
return slices.ContainsFunc(
163163
provider.StorageClassConfig,
164164
func(scc v1alpha1.StorageClassConfig) bool {
165-
return scc.Name == csi.DefaultStorage.StorageClassConfigName
165+
return scc.Name == csi.DefaultStorageClassConfigName
166166
},
167167
)
168168
}) {

0 commit comments

Comments
 (0)