Skip to content

Commit 9039258

Browse files
authored
feat: Use HelmAddon as default addon strategy (#771)
This is properly defaulted by CAPI as can be seen in the Cluster resource when it gets applied (these do not appear in the example cluster manifests): ``` variables: - name: clusterConfig value: addons: clusterAutoscaler: strategy: HelmAddon cni: provider: Cilium strategy: HelmAddon csi: defaultStorage: provider: local-path storageClassConfig: default providers: local-path: storageClassConfigs: default: allowExpansion: false reclaimPolicy: Delete volumeBindingMode: WaitForFirstConsumer strategy: HelmAddon snapshotController: strategy: HelmAddon nfd: strategy: HelmAddon ```
1 parent ed66c17 commit 9039258

19 files changed

+45
-121
lines changed

api/v1alpha1/addon_types.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ type GenericAddons struct {
9696
ServiceLoadBalancer *ServiceLoadBalancer `json:"serviceLoadBalancer,omitempty"`
9797
}
9898

99+
// +kubebuilder:validation:Required
100+
// +kubebuilder:validation:Enum=ClusterResourceSet;HelmAddon
99101
type AddonStrategy string
100102

101103
// CNI required for providing CNI configuration.
@@ -104,26 +106,24 @@ type CNI struct {
104106
// +kubebuilder:validation:Required
105107
// +kubebuilder:validation:Enum=Calico;Cilium
106108
Provider string `json:"provider"`
109+
107110
// Addon strategy used to deploy the CNI provider to the workload cluster.
108-
// +kubebuilder:validation:Required
109-
// +kubebuilder:validation:Enum=ClusterResourceSet;HelmAddon
111+
// +kubebuilder:default=HelmAddon
110112
Strategy AddonStrategy `json:"strategy"`
111113
}
112114

113115
// NFD tells us to enable or disable the node feature discovery addon.
114116
type NFD struct {
115117
// Addon strategy used to deploy Node Feature Discovery (NFD) to the workload cluster.
116-
// +kubebuilder:validation:Required
117-
// +kubebuilder:validation:Enum=ClusterResourceSet;HelmAddon
118+
// +kubebuilder:default=HelmAddon
118119
Strategy AddonStrategy `json:"strategy"`
119120
}
120121

121122
// ClusterAutoscaler tells us to enable or disable the cluster-autoscaler addon.
122123
type ClusterAutoscaler struct {
123124
// Addon strategy used to deploy cluster-autoscaler to the management cluster
124125
// targeting the workload cluster.
125-
// +kubebuilder:validation:Required
126-
// +kubebuilder:validation:Enum=ClusterResourceSet;HelmAddon
126+
// +kubebuilder:default=HelmAddon
127127
Strategy AddonStrategy `json:"strategy"`
128128
}
129129

@@ -138,8 +138,7 @@ type GenericCSI struct {
138138

139139
type SnapshotController struct {
140140
// Addon strategy used to deploy the snapshot controller to the workload cluster.
141-
// +kubebuilder:validation:Required
142-
// +kubebuilder:validation:Enum=ClusterResourceSet;HelmAddon
141+
// +kubebuilder:default=HelmAddon
143142
Strategy AddonStrategy `json:"strategy"`
144143
}
145144

@@ -197,8 +196,7 @@ type CSIProvider struct {
197196
StorageClassConfigs map[string]StorageClassConfig `json:"storageClassConfigs"`
198197

199198
// Addon strategy used to deploy the CSI provider to the workload cluster.
200-
// +kubebuilder:validation:Required
201-
// +kubebuilder:validation:Enum=ClusterResourceSet;HelmAddon
199+
// +kubebuilder:default=HelmAddon
202200
Strategy AddonStrategy `json:"strategy"`
203201

204202
// The reference to any secret used by the CSI Provider.
@@ -240,8 +238,7 @@ type CCM struct {
240238
Credentials *CCMCredentials `json:"credentials,omitempty"`
241239

242240
// Addon strategy used to deploy the CCM to the workload cluster.
243-
// +kubebuilder:validation:Required
244-
// +kubebuilder:validation:Enum=ClusterResourceSet;HelmAddon
241+
// +kubebuilder:default=HelmAddon
245242
Strategy AddonStrategy `json:"strategy"`
246243
}
247244

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ spec:
6565
- secretRef
6666
type: object
6767
strategy:
68+
default: HelmAddon
6869
description: Addon strategy used to deploy the CCM to the workload cluster.
6970
enum:
7071
- ClusterResourceSet
@@ -77,6 +78,7 @@ spec:
7778
description: ClusterAutoscaler tells us to enable or disable the cluster-autoscaler addon.
7879
properties:
7980
strategy:
81+
default: HelmAddon
8082
description: |-
8183
Addon strategy used to deploy cluster-autoscaler to the management cluster
8284
targeting the workload cluster.
@@ -97,6 +99,7 @@ spec:
9799
- Cilium
98100
type: string
99101
strategy:
102+
default: HelmAddon
100103
description: Addon strategy used to deploy the CNI provider to the workload cluster.
101104
enum:
102105
- ClusterResourceSet
@@ -176,6 +179,7 @@ spec:
176179
description: StorageClassConfigs is a map of storage class configurations for this CSI provider.
177180
type: object
178181
strategy:
182+
default: HelmAddon
179183
description: Addon strategy used to deploy the CSI provider to the workload cluster.
180184
enum:
181185
- ClusterResourceSet
@@ -192,6 +196,7 @@ spec:
192196
description: Deploy the CSI snapshot controller and associated CRDs.
193197
properties:
194198
strategy:
199+
default: HelmAddon
195200
description: Addon strategy used to deploy the snapshot controller to the workload cluster.
196201
enum:
197202
- ClusterResourceSet
@@ -208,6 +213,7 @@ spec:
208213
description: NFD tells us to enable or disable the node feature discovery addon.
209214
properties:
210215
strategy:
216+
default: HelmAddon
211217
description: Addon strategy used to deploy Node Feature Discovery (NFD) to the workload cluster.
212218
enum:
213219
- ClusterResourceSet

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ spec:
6565
- secretRef
6666
type: object
6767
strategy:
68+
default: HelmAddon
6869
description: Addon strategy used to deploy the CCM to the workload cluster.
6970
enum:
7071
- ClusterResourceSet
@@ -77,6 +78,7 @@ spec:
7778
description: ClusterAutoscaler tells us to enable or disable the cluster-autoscaler addon.
7879
properties:
7980
strategy:
81+
default: HelmAddon
8082
description: |-
8183
Addon strategy used to deploy cluster-autoscaler to the management cluster
8284
targeting the workload cluster.
@@ -97,6 +99,7 @@ spec:
9799
- Cilium
98100
type: string
99101
strategy:
102+
default: HelmAddon
100103
description: Addon strategy used to deploy the CNI provider to the workload cluster.
101104
enum:
102105
- ClusterResourceSet
@@ -176,6 +179,7 @@ spec:
176179
description: StorageClassConfigs is a map of storage class configurations for this CSI provider.
177180
type: object
178181
strategy:
182+
default: HelmAddon
179183
description: Addon strategy used to deploy the CSI provider to the workload cluster.
180184
enum:
181185
- ClusterResourceSet
@@ -192,6 +196,7 @@ spec:
192196
description: Deploy the CSI snapshot controller and associated CRDs.
193197
properties:
194198
strategy:
199+
default: HelmAddon
195200
description: Addon strategy used to deploy the snapshot controller to the workload cluster.
196201
enum:
197202
- ClusterResourceSet
@@ -208,6 +213,7 @@ spec:
208213
description: NFD tells us to enable or disable the node feature discovery addon.
209214
properties:
210215
strategy:
216+
default: HelmAddon
211217
description: Addon strategy used to deploy Node Feature Discovery (NFD) to the workload cluster.
212218
enum:
213219
- ClusterResourceSet

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ spec:
6565
- secretRef
6666
type: object
6767
strategy:
68+
default: HelmAddon
6869
description: Addon strategy used to deploy the CCM to the workload cluster.
6970
enum:
7071
- ClusterResourceSet
@@ -77,6 +78,7 @@ spec:
7778
description: ClusterAutoscaler tells us to enable or disable the cluster-autoscaler addon.
7879
properties:
7980
strategy:
81+
default: HelmAddon
8082
description: |-
8183
Addon strategy used to deploy cluster-autoscaler to the management cluster
8284
targeting the workload cluster.
@@ -97,6 +99,7 @@ spec:
9799
- Cilium
98100
type: string
99101
strategy:
102+
default: HelmAddon
100103
description: Addon strategy used to deploy the CNI provider to the workload cluster.
101104
enum:
102105
- ClusterResourceSet
@@ -176,6 +179,7 @@ spec:
176179
description: StorageClassConfigs is a map of storage class configurations for this CSI provider.
177180
type: object
178181
strategy:
182+
default: HelmAddon
179183
description: Addon strategy used to deploy the CSI provider to the workload cluster.
180184
enum:
181185
- ClusterResourceSet
@@ -192,6 +196,7 @@ spec:
192196
description: Deploy the CSI snapshot controller and associated CRDs.
193197
properties:
194198
strategy:
199+
default: HelmAddon
195200
description: Addon strategy used to deploy the snapshot controller to the workload cluster.
196201
enum:
197202
- ClusterResourceSet
@@ -208,6 +213,7 @@ spec:
208213
description: NFD tells us to enable or disable the node feature discovery addon.
209214
properties:
210215
strategy:
216+
default: HelmAddon
211217
description: Addon strategy used to deploy Node Feature Discovery (NFD) to the workload cluster.
212218
enum:
213219
- ClusterResourceSet

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,10 @@ spec:
2121
- name: clusterConfig
2222
value:
2323
addons:
24-
ccm:
25-
strategy: HelmAddon
26-
clusterAutoscaler:
27-
strategy: HelmAddon
24+
ccm: {}
25+
clusterAutoscaler: {}
2826
cni:
2927
provider: Calico
30-
strategy: HelmAddon
3128
csi:
3229
defaultStorage:
3330
provider: aws-ebs
@@ -36,11 +33,8 @@ spec:
3633
aws-ebs:
3734
storageClassConfigs:
3835
default: {}
39-
strategy: HelmAddon
40-
snapshotController:
41-
strategy: HelmAddon
42-
nfd:
43-
strategy: HelmAddon
36+
snapshotController: {}
37+
nfd: {}
4438
aws:
4539
region: us-west-2
4640
controlPlane:

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

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,10 @@ spec:
2121
- name: clusterConfig
2222
value:
2323
addons:
24-
ccm:
25-
strategy: HelmAddon
26-
clusterAutoscaler:
27-
strategy: HelmAddon
24+
ccm: {}
25+
clusterAutoscaler: {}
2826
cni:
2927
provider: Cilium
30-
strategy: HelmAddon
3128
csi:
3229
defaultStorage:
3330
provider: aws-ebs
@@ -36,11 +33,8 @@ spec:
3633
aws-ebs:
3734
storageClassConfigs:
3835
default: {}
39-
strategy: HelmAddon
40-
snapshotController:
41-
strategy: HelmAddon
42-
nfd:
43-
strategy: HelmAddon
36+
snapshotController: {}
37+
nfd: {}
4438
aws:
4539
region: us-west-2
4640
controlPlane:

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ spec:
2222
- name: clusterConfig
2323
value:
2424
addons:
25-
clusterAutoscaler:
26-
strategy: HelmAddon
25+
clusterAutoscaler: {}
2726
cni:
2827
provider: Calico
29-
strategy: HelmAddon
3028
csi:
3129
defaultStorage:
3230
provider: local-path
@@ -35,11 +33,8 @@ spec:
3533
local-path:
3634
storageClassConfigs:
3735
default: {}
38-
strategy: HelmAddon
39-
snapshotController:
40-
strategy: HelmAddon
41-
nfd:
42-
strategy: HelmAddon
36+
snapshotController: {}
37+
nfd: {}
4338
encryptionAtRest:
4439
providers:
4540
- aescbc: {}

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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ spec:
2222
- name: clusterConfig
2323
value:
2424
addons:
25-
clusterAutoscaler:
26-
strategy: HelmAddon
25+
clusterAutoscaler: {}
2726
cni:
2827
provider: Cilium
29-
strategy: HelmAddon
3028
csi:
3129
defaultStorage:
3230
provider: local-path
@@ -35,11 +33,8 @@ spec:
3533
local-path:
3634
storageClassConfigs:
3735
default: {}
38-
strategy: HelmAddon
39-
snapshotController:
40-
strategy: HelmAddon
41-
nfd:
42-
strategy: HelmAddon
36+
snapshotController: {}
37+
nfd: {}
4338
encryptionAtRest:
4439
providers:
4540
- aescbc: {}

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,9 @@ spec:
6868
secretRef:
6969
name: ${CLUSTER_NAME}-pc-creds
7070
strategy: HelmAddon
71-
clusterAutoscaler:
72-
strategy: HelmAddon
71+
clusterAutoscaler: {}
7372
cni:
7473
provider: Calico
75-
strategy: HelmAddon
7674
csi:
7775
defaultStorage:
7876
provider: nutanix
@@ -89,8 +87,7 @@ spec:
8987
strategy: HelmAddon
9088
snapshotController:
9189
strategy: HelmAddon
92-
nfd:
93-
strategy: HelmAddon
90+
nfd: {}
9491
controlPlane:
9592
nutanix:
9693
machineDetails:

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,9 @@ spec:
6868
secretRef:
6969
name: ${CLUSTER_NAME}-pc-creds
7070
strategy: HelmAddon
71-
clusterAutoscaler:
72-
strategy: HelmAddon
71+
clusterAutoscaler: {}
7372
cni:
7473
provider: Cilium
75-
strategy: HelmAddon
7674
csi:
7775
defaultStorage:
7876
provider: nutanix
@@ -89,8 +87,7 @@ spec:
8987
strategy: HelmAddon
9088
snapshotController:
9189
strategy: HelmAddon
92-
nfd:
93-
strategy: HelmAddon
90+
nfd: {}
9491
controlPlane:
9592
nutanix:
9693
machineDetails:

hack/examples/overlays/clusters/aws/calico/helm-addon/kustomization.yaml.tmpl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,3 @@ patches:
1414
- target:
1515
kind: Cluster
1616
path: ../../../../../patches/calico.yaml
17-
- target:
18-
kind: Cluster
19-
path: ../../../../../patches/helm-addon-strategy.yaml
20-
- target:
21-
kind: Cluster
22-
path: ../../../../../patches/aws/helm-addon-strategy.yaml

hack/examples/overlays/clusters/aws/cilium/helm-addon/kustomization.yaml.tmpl

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,3 @@ patches:
1414
- target:
1515
kind: Cluster
1616
path: ../../../../../patches/cilium.yaml
17-
- target:
18-
kind: Cluster
19-
path: ../../../../../patches/helm-addon-strategy.yaml
20-
- target:
21-
kind: Cluster
22-
path: ../../../../../patches/aws/helm-addon-strategy.yaml

0 commit comments

Comments
 (0)