Skip to content

Commit 6f519eb

Browse files
authored
build: use kustomize to generate failuredomain examples (#1294)
**What problem does this PR solve?**: Uses kustomize to generate the failuredomain example files and skip kube-proxy installation. **Which issue(s) this PR fixes**: Fixes # **How Has This Been Tested?**: <!-- Please describe the tests that you ran to verify your changes. Provide output from the tests and any manual steps needed to replicate the tests. --> **Special notes for your reviewer**: <!-- Use this to provide any additional information to the reviewers. This may include: - Best way to review the PR. - Where the author wants the most review attention on. - etc. -->
1 parent df047f4 commit 6f519eb

File tree

9 files changed

+221
-80
lines changed

9 files changed

+221
-80
lines changed

examples/capi-quick-start/nutanix-cluster-failuredomain-cilium-crs.yaml renamed to examples/capi-quick-start/nutanix-cluster-with-failuredomains-cilium-crs.yaml

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
2+
kind: NutanixFailureDomain
3+
metadata:
4+
name: fd-1
5+
spec:
6+
prismElementCluster:
7+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
8+
type: name
9+
subnets:
10+
- name: ${NUTANIX_SUBNET_NAME}
11+
type: name
12+
---
13+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
14+
kind: NutanixFailureDomain
15+
metadata:
16+
name: fd-2
17+
spec:
18+
prismElementCluster:
19+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
20+
type: name
21+
subnets:
22+
- name: ${NUTANIX_SUBNET_NAME}
23+
type: name
24+
---
25+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
26+
kind: NutanixFailureDomain
27+
metadata:
28+
name: fd-3
29+
spec:
30+
prismElementCluster:
31+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
32+
type: name
33+
subnets:
34+
- name: ${NUTANIX_SUBNET_NAME}
35+
type: name
36+
---
137
apiVersion: v1
238
kind: Secret
339
metadata:
@@ -38,42 +74,6 @@ stringData:
3874
}
3975
]
4076
---
41-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
42-
kind: NutanixFailureDomain
43-
metadata:
44-
name: fd-1
45-
spec:
46-
prismElementCluster:
47-
type: name
48-
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
49-
subnets:
50-
- type: name
51-
name: ${NUTANIX_SUBNET_NAME}
52-
---
53-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
54-
kind: NutanixFailureDomain
55-
metadata:
56-
name: fd-2
57-
spec:
58-
prismElementCluster:
59-
type: name
60-
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
61-
subnets:
62-
- type: name
63-
name: ${NUTANIX_SUBNET_NAME}
64-
---
65-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
66-
kind: NutanixFailureDomain
67-
metadata:
68-
name: fd-3
69-
spec:
70-
prismElementCluster:
71-
type: name
72-
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
73-
subnets:
74-
- type: name
75-
name: ${NUTANIX_SUBNET_NAME}
76-
---
7777
apiVersion: cluster.x-k8s.io/v1beta1
7878
kind: Cluster
7979
metadata:
@@ -201,12 +201,12 @@ spec:
201201
cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: "${WORKER_MACHINE_COUNT}"
202202
name: md-0
203203
- class: default-worker
204+
failureDomain: fd-3
204205
metadata:
205206
annotations:
206207
cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size: "${WORKER_MACHINE_COUNT}"
207208
cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: "${WORKER_MACHINE_COUNT}"
208209
name: md-1
209-
failureDomain: fd-3
210210
variables:
211211
overrides:
212212
- name: workerConfig

examples/capi-quick-start/nutanix-cluster-failuredomain-cilium-helm-addon.yaml renamed to examples/capi-quick-start/nutanix-cluster-with-failuredomains-cilium-helm-addon.yaml

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
2+
kind: NutanixFailureDomain
3+
metadata:
4+
name: fd-1
5+
spec:
6+
prismElementCluster:
7+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
8+
type: name
9+
subnets:
10+
- name: ${NUTANIX_SUBNET_NAME}
11+
type: name
12+
---
13+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
14+
kind: NutanixFailureDomain
15+
metadata:
16+
name: fd-2
17+
spec:
18+
prismElementCluster:
19+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
20+
type: name
21+
subnets:
22+
- name: ${NUTANIX_SUBNET_NAME}
23+
type: name
24+
---
25+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
26+
kind: NutanixFailureDomain
27+
metadata:
28+
name: fd-3
29+
spec:
30+
prismElementCluster:
31+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
32+
type: name
33+
subnets:
34+
- name: ${NUTANIX_SUBNET_NAME}
35+
type: name
36+
---
137
apiVersion: v1
238
kind: Secret
339
metadata:
@@ -38,42 +74,6 @@ stringData:
3874
}
3975
]
4076
---
41-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
42-
kind: NutanixFailureDomain
43-
metadata:
44-
name: fd-1
45-
spec:
46-
prismElementCluster:
47-
type: name
48-
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
49-
subnets:
50-
- type: name
51-
name: ${NUTANIX_SUBNET_NAME}
52-
---
53-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
54-
kind: NutanixFailureDomain
55-
metadata:
56-
name: fd-2
57-
spec:
58-
prismElementCluster:
59-
type: name
60-
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
61-
subnets:
62-
- type: name
63-
name: ${NUTANIX_SUBNET_NAME}
64-
---
65-
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
66-
kind: NutanixFailureDomain
67-
metadata:
68-
name: fd-3
69-
spec:
70-
prismElementCluster:
71-
type: name
72-
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
73-
subnets:
74-
- type: name
75-
name: ${NUTANIX_SUBNET_NAME}
76-
---
7777
apiVersion: cluster.x-k8s.io/v1beta1
7878
kind: Cluster
7979
metadata:
@@ -93,7 +93,9 @@ spec:
9393
topology:
9494
class: nutanix-quick-start
9595
controlPlane:
96-
metadata: {}
96+
metadata:
97+
annotations:
98+
controlplane.cluster.x-k8s.io/skip-kube-proxy: ""
9799
replicas: ${CONTROL_PLANE_MACHINE_COUNT}
98100
variables:
99101
- name: clusterConfig
@@ -198,12 +200,12 @@ spec:
198200
cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: "${WORKER_MACHINE_COUNT}"
199201
name: md-0
200202
- class: default-worker
203+
failureDomain: fd-3
201204
metadata:
202205
annotations:
203206
cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size: "${WORKER_MACHINE_COUNT}"
204207
cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: "${WORKER_MACHINE_COUNT}"
205208
name: md-1
206-
failureDomain: fd-3
207209
variables:
208210
overrides:
209211
- name: workerConfig
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright 2025 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
---
5+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
6+
kind: NutanixFailureDomain
7+
metadata:
8+
name: fd-1
9+
spec:
10+
prismElementCluster:
11+
type: name
12+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
13+
subnets:
14+
- type: name
15+
name: ${NUTANIX_SUBNET_NAME}
16+
---
17+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
18+
kind: NutanixFailureDomain
19+
metadata:
20+
name: fd-2
21+
spec:
22+
prismElementCluster:
23+
type: name
24+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
25+
subnets:
26+
- type: name
27+
name: ${NUTANIX_SUBNET_NAME}
28+
---
29+
apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
30+
kind: NutanixFailureDomain
31+
metadata:
32+
name: fd-3
33+
spec:
34+
prismElementCluster:
35+
type: name
36+
name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}
37+
subnets:
38+
- type: name
39+
name: ${NUTANIX_SUBNET_NAME}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2025 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: kustomize.config.k8s.io/v1beta1
5+
kind: Kustomization
6+
7+
resources:
8+
- ../../../../../additional-resources/nutanix/failure-domains.yaml
9+
- ../../../../../bases/nutanix/cluster
10+
11+
sortOptions:
12+
order: fifo
13+
14+
patches:
15+
- target:
16+
kind: Cluster
17+
path: ../../../../../patches/cilium.yaml
18+
- target:
19+
kind: Cluster
20+
path: ../../../../../patches/crs-strategy.yaml
21+
- target:
22+
kind: Cluster
23+
path: ../../../../../patches/nutanix/use-failure-domains.yaml
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2025 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
apiVersion: kustomize.config.k8s.io/v1beta1
5+
kind: Kustomization
6+
7+
resources:
8+
- ../../../../../additional-resources/nutanix/failure-domains.yaml
9+
- ../../../../../bases/nutanix/cluster
10+
11+
sortOptions:
12+
order: fifo
13+
14+
patches:
15+
- target:
16+
kind: Cluster
17+
path: ../../../../../patches/cilium.yaml
18+
- target:
19+
kind: Cluster
20+
path: ../../../../../patches/skip-kube-proxy.yaml
21+
- target:
22+
kind: Cluster
23+
path: ../../../../../patches/nutanix/use-failure-domains.yaml
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copyright 2025 Nutanix. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
- op: "add"
5+
path: "/spec/topology/variables/0/value/controlPlane/nutanix/failureDomains"
6+
value:
7+
- fd-1
8+
- fd-2
9+
- fd-3
10+
- op: "remove"
11+
path: "/spec/topology/variables/0/value/controlPlane/nutanix/machineDetails/cluster"
12+
- op: "remove"
13+
path: "/spec/topology/variables/0/value/controlPlane/nutanix/machineDetails/subnets"
14+
15+
- op: "add"
16+
path: "/spec/topology/workers/machineDeployments/-"
17+
value:
18+
class: default-worker
19+
metadata:
20+
annotations:
21+
cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size: "${WORKER_MACHINE_COUNT}"
22+
cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: "${WORKER_MACHINE_COUNT}"
23+
name: md-1
24+
failureDomain: fd-3
25+
variables:
26+
overrides:
27+
- name: workerConfig
28+
value:
29+
nutanix:
30+
machineDetails:
31+
bootType: uefi
32+
imageLookup:
33+
baseOS: ${NUTANIX_MACHINE_TEMPLATE_BASE_OS}
34+
format: ${NUTANIX_MACHINE_TEMPLATE_LOOKUP_FORMAT}
35+
memorySize: 4Gi
36+
systemDiskSize: 40Gi
37+
vcpuSockets: 2
38+
vcpusPerSocket: 1

hack/examples/sync.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,19 @@ for provider in "aws" "docker" "nutanix"; do
3737
done
3838
done
3939

40+
# shellcheck disable=SC2043 # Keep the loop for future use.
41+
for provider in "nutanix"; do
42+
for modifier in "failuredomains"; do
43+
for cni in "cilium"; do
44+
for strategy in "helm-addon" "crs"; do
45+
kustomize build --load-restrictor LoadRestrictionsNone \
46+
./hack/examples/overlays/clusters/"${provider}"-with-"${modifier}"/"${cni}"/"${strategy}" \
47+
>"${EXAMPLE_CLUSTERS_DIR}/${provider}-cluster-with-${modifier}-${cni}-${strategy}.yaml"
48+
done
49+
done
50+
done
51+
done
52+
4053
# TODO Remove once kustomize supports retaining quotes in what will be numeric values.
4154
#shellcheck disable=SC2016
4255
sed -i'' 's/${AMI_LOOKUP_ORG}/"${AMI_LOOKUP_ORG}"/' "${EXAMPLE_CLUSTERS_DIR}"/*.yaml

test/e2e/config/caren.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ providers:
110110
targetName: cluster-template-topology-cilium-helm-addon.yaml
111111
- sourcePath: "../../../examples/capi-quick-start/nutanix-cluster-cilium-crs.yaml"
112112
targetName: cluster-template-topology-cilium-crs.yaml
113-
- sourcePath: "../../../examples/capi-quick-start/nutanix-cluster-failuredomain-cilium-helm-addon.yaml"
114-
targetName: cluster-template-topology-failuredomain-cilium-helm-addon.yaml
115-
- sourcePath: "../../../examples/capi-quick-start/nutanix-cluster-failuredomain-cilium-crs.yaml"
116-
targetName: cluster-template-topology-failuredomain-cilium-crs.yaml
113+
- sourcePath: "../../../examples/capi-quick-start/nutanix-cluster-with-failuredomains-cilium-helm-addon.yaml"
114+
targetName: cluster-template-topology-with-failuredomains-cilium-helm-addon.yaml
115+
- sourcePath: "../../../examples/capi-quick-start/nutanix-cluster-with-failuredomains-cilium-crs.yaml"
116+
targetName: cluster-template-topology-with-failuredomains-cilium-crs.yaml
117117
- sourcePath: "../../../examples/capi-quick-start/nutanix-cluster-calico-helm-addon.yaml"
118118
targetName: cluster-template-topology-calico-helm-addon.yaml
119119
- sourcePath: "../../../examples/capi-quick-start/nutanix-cluster-calico-crs.yaml"

test/e2e/quick_start_test.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,10 @@ var _ = Describe("Quick start", func() {
6363
if provider == "Nutanix" && cniProvider == "Cilium" {
6464
flavors = append(
6565
flavors,
66-
fmt.Sprintf("topology-failuredomain-%s-%s", strings.ToLower(cniProvider), strategy),
66+
fmt.Sprintf(
67+
"topology-with-failuredomains-%s-%s",
68+
strings.ToLower(cniProvider),
69+
strategy),
6770
)
6871
}
6972
for _, flavor := range flavors {

0 commit comments

Comments
 (0)