diff --git a/examples/capi-quick-start/nutanix-cluster-failuredomain-cilium-crs.yaml b/examples/capi-quick-start/nutanix-cluster-with-failuredomains-cilium-crs.yaml similarity index 97% rename from examples/capi-quick-start/nutanix-cluster-failuredomain-cilium-crs.yaml rename to examples/capi-quick-start/nutanix-cluster-with-failuredomains-cilium-crs.yaml index 2b875a72b..37002d5c0 100644 --- a/examples/capi-quick-start/nutanix-cluster-failuredomain-cilium-crs.yaml +++ b/examples/capi-quick-start/nutanix-cluster-with-failuredomains-cilium-crs.yaml @@ -1,3 +1,39 @@ +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: NutanixFailureDomain +metadata: + name: fd-1 +spec: + prismElementCluster: + name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} + type: name + subnets: + - name: ${NUTANIX_SUBNET_NAME} + type: name +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: NutanixFailureDomain +metadata: + name: fd-2 +spec: + prismElementCluster: + name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} + type: name + subnets: + - name: ${NUTANIX_SUBNET_NAME} + type: name +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: NutanixFailureDomain +metadata: + name: fd-3 +spec: + prismElementCluster: + name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} + type: name + subnets: + - name: ${NUTANIX_SUBNET_NAME} + type: name +--- apiVersion: v1 kind: Secret metadata: @@ -38,42 +74,6 @@ stringData: } ] --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: NutanixFailureDomain -metadata: - name: fd-1 -spec: - prismElementCluster: - type: name - name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} - subnets: - - type: name - name: ${NUTANIX_SUBNET_NAME} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: NutanixFailureDomain -metadata: - name: fd-2 -spec: - prismElementCluster: - type: name - name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} - subnets: - - type: name - name: ${NUTANIX_SUBNET_NAME} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: NutanixFailureDomain -metadata: - name: fd-3 -spec: - prismElementCluster: - type: name - name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} - subnets: - - type: name - name: ${NUTANIX_SUBNET_NAME} ---- apiVersion: cluster.x-k8s.io/v1beta1 kind: Cluster metadata: @@ -201,12 +201,12 @@ spec: cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: "${WORKER_MACHINE_COUNT}" name: md-0 - class: default-worker + failureDomain: fd-3 metadata: annotations: cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size: "${WORKER_MACHINE_COUNT}" cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: "${WORKER_MACHINE_COUNT}" name: md-1 - failureDomain: fd-3 variables: overrides: - name: workerConfig diff --git a/examples/capi-quick-start/nutanix-cluster-failuredomain-cilium-helm-addon.yaml b/examples/capi-quick-start/nutanix-cluster-with-failuredomains-cilium-helm-addon.yaml similarity index 96% rename from examples/capi-quick-start/nutanix-cluster-failuredomain-cilium-helm-addon.yaml rename to examples/capi-quick-start/nutanix-cluster-with-failuredomains-cilium-helm-addon.yaml index b74d6e1c3..62b958d4f 100644 --- a/examples/capi-quick-start/nutanix-cluster-failuredomain-cilium-helm-addon.yaml +++ b/examples/capi-quick-start/nutanix-cluster-with-failuredomains-cilium-helm-addon.yaml @@ -1,3 +1,39 @@ +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: NutanixFailureDomain +metadata: + name: fd-1 +spec: + prismElementCluster: + name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} + type: name + subnets: + - name: ${NUTANIX_SUBNET_NAME} + type: name +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: NutanixFailureDomain +metadata: + name: fd-2 +spec: + prismElementCluster: + name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} + type: name + subnets: + - name: ${NUTANIX_SUBNET_NAME} + type: name +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: NutanixFailureDomain +metadata: + name: fd-3 +spec: + prismElementCluster: + name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} + type: name + subnets: + - name: ${NUTANIX_SUBNET_NAME} + type: name +--- apiVersion: v1 kind: Secret metadata: @@ -38,42 +74,6 @@ stringData: } ] --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: NutanixFailureDomain -metadata: - name: fd-1 -spec: - prismElementCluster: - type: name - name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} - subnets: - - type: name - name: ${NUTANIX_SUBNET_NAME} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: NutanixFailureDomain -metadata: - name: fd-2 -spec: - prismElementCluster: - type: name - name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} - subnets: - - type: name - name: ${NUTANIX_SUBNET_NAME} ---- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 -kind: NutanixFailureDomain -metadata: - name: fd-3 -spec: - prismElementCluster: - type: name - name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} - subnets: - - type: name - name: ${NUTANIX_SUBNET_NAME} ---- apiVersion: cluster.x-k8s.io/v1beta1 kind: Cluster metadata: @@ -93,7 +93,9 @@ spec: topology: class: nutanix-quick-start controlPlane: - metadata: {} + metadata: + annotations: + controlplane.cluster.x-k8s.io/skip-kube-proxy: "" replicas: ${CONTROL_PLANE_MACHINE_COUNT} variables: - name: clusterConfig @@ -198,12 +200,12 @@ spec: cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: "${WORKER_MACHINE_COUNT}" name: md-0 - class: default-worker + failureDomain: fd-3 metadata: annotations: cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size: "${WORKER_MACHINE_COUNT}" cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: "${WORKER_MACHINE_COUNT}" name: md-1 - failureDomain: fd-3 variables: overrides: - name: workerConfig diff --git a/hack/examples/additional-resources/nutanix/failure-domains.yaml b/hack/examples/additional-resources/nutanix/failure-domains.yaml new file mode 100644 index 000000000..6118d0a92 --- /dev/null +++ b/hack/examples/additional-resources/nutanix/failure-domains.yaml @@ -0,0 +1,39 @@ +# Copyright 2025 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: NutanixFailureDomain +metadata: + name: fd-1 +spec: + prismElementCluster: + type: name + name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} + subnets: + - type: name + name: ${NUTANIX_SUBNET_NAME} +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: NutanixFailureDomain +metadata: + name: fd-2 +spec: + prismElementCluster: + type: name + name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} + subnets: + - type: name + name: ${NUTANIX_SUBNET_NAME} +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: NutanixFailureDomain +metadata: + name: fd-3 +spec: + prismElementCluster: + type: name + name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} + subnets: + - type: name + name: ${NUTANIX_SUBNET_NAME} diff --git a/hack/examples/overlays/clusters/nutanix-with-failuredomains/cilium/crs/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/nutanix-with-failuredomains/cilium/crs/kustomization.yaml.tmpl new file mode 100644 index 000000000..1fb889566 --- /dev/null +++ b/hack/examples/overlays/clusters/nutanix-with-failuredomains/cilium/crs/kustomization.yaml.tmpl @@ -0,0 +1,23 @@ +# Copyright 2025 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- ../../../../../additional-resources/nutanix/failure-domains.yaml +- ../../../../../bases/nutanix/cluster + +sortOptions: + order: fifo + +patches: + - target: + kind: Cluster + path: ../../../../../patches/cilium.yaml + - target: + kind: Cluster + path: ../../../../../patches/crs-strategy.yaml + - target: + kind: Cluster + path: ../../../../../patches/nutanix/use-failure-domains.yaml diff --git a/hack/examples/overlays/clusters/nutanix-with-failuredomains/cilium/helm-addon/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/nutanix-with-failuredomains/cilium/helm-addon/kustomization.yaml.tmpl new file mode 100644 index 000000000..ced28d493 --- /dev/null +++ b/hack/examples/overlays/clusters/nutanix-with-failuredomains/cilium/helm-addon/kustomization.yaml.tmpl @@ -0,0 +1,23 @@ +# Copyright 2025 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- ../../../../../additional-resources/nutanix/failure-domains.yaml +- ../../../../../bases/nutanix/cluster + +sortOptions: + order: fifo + +patches: + - target: + kind: Cluster + path: ../../../../../patches/cilium.yaml + - target: + kind: Cluster + path: ../../../../../patches/skip-kube-proxy.yaml + - target: + kind: Cluster + path: ../../../../../patches/nutanix/use-failure-domains.yaml diff --git a/hack/examples/patches/nutanix/use-failure-domains.yaml b/hack/examples/patches/nutanix/use-failure-domains.yaml new file mode 100644 index 000000000..45aae4fce --- /dev/null +++ b/hack/examples/patches/nutanix/use-failure-domains.yaml @@ -0,0 +1,38 @@ +# Copyright 2025 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +- op: "add" + path: "/spec/topology/variables/0/value/controlPlane/nutanix/failureDomains" + value: + - fd-1 + - fd-2 + - fd-3 +- op: "remove" + path: "/spec/topology/variables/0/value/controlPlane/nutanix/machineDetails/cluster" +- op: "remove" + path: "/spec/topology/variables/0/value/controlPlane/nutanix/machineDetails/subnets" + +- op: "add" + path: "/spec/topology/workers/machineDeployments/-" + value: + class: default-worker + metadata: + annotations: + cluster.x-k8s.io/cluster-api-autoscaler-node-group-max-size: "${WORKER_MACHINE_COUNT}" + cluster.x-k8s.io/cluster-api-autoscaler-node-group-min-size: "${WORKER_MACHINE_COUNT}" + name: md-1 + failureDomain: fd-3 + variables: + overrides: + - name: workerConfig + value: + nutanix: + machineDetails: + bootType: uefi + imageLookup: + baseOS: ${NUTANIX_MACHINE_TEMPLATE_BASE_OS} + format: ${NUTANIX_MACHINE_TEMPLATE_LOOKUP_FORMAT} + memorySize: 4Gi + systemDiskSize: 40Gi + vcpuSockets: 2 + vcpusPerSocket: 1 diff --git a/hack/examples/sync.sh b/hack/examples/sync.sh index cff626deb..d74a33079 100755 --- a/hack/examples/sync.sh +++ b/hack/examples/sync.sh @@ -37,6 +37,19 @@ for provider in "aws" "docker" "nutanix"; do done done +# shellcheck disable=SC2043 # Keep the loop for future use. +for provider in "nutanix"; do + for modifier in "failuredomains"; do + for cni in "cilium"; do + for strategy in "helm-addon" "crs"; do + kustomize build --load-restrictor LoadRestrictionsNone \ + ./hack/examples/overlays/clusters/"${provider}"-with-"${modifier}"/"${cni}"/"${strategy}" \ + >"${EXAMPLE_CLUSTERS_DIR}/${provider}-cluster-with-${modifier}-${cni}-${strategy}.yaml" + done + done + done +done + # TODO Remove once kustomize supports retaining quotes in what will be numeric values. #shellcheck disable=SC2016 sed -i'' 's/${AMI_LOOKUP_ORG}/"${AMI_LOOKUP_ORG}"/' "${EXAMPLE_CLUSTERS_DIR}"/*.yaml diff --git a/test/e2e/config/caren.yaml b/test/e2e/config/caren.yaml index d89b9c229..15c883479 100644 --- a/test/e2e/config/caren.yaml +++ b/test/e2e/config/caren.yaml @@ -110,10 +110,10 @@ providers: targetName: cluster-template-topology-cilium-helm-addon.yaml - sourcePath: "../../../examples/capi-quick-start/nutanix-cluster-cilium-crs.yaml" targetName: cluster-template-topology-cilium-crs.yaml - - sourcePath: "../../../examples/capi-quick-start/nutanix-cluster-failuredomain-cilium-helm-addon.yaml" - targetName: cluster-template-topology-failuredomain-cilium-helm-addon.yaml - - sourcePath: "../../../examples/capi-quick-start/nutanix-cluster-failuredomain-cilium-crs.yaml" - targetName: cluster-template-topology-failuredomain-cilium-crs.yaml + - sourcePath: "../../../examples/capi-quick-start/nutanix-cluster-with-failuredomains-cilium-helm-addon.yaml" + targetName: cluster-template-topology-with-failuredomains-cilium-helm-addon.yaml + - sourcePath: "../../../examples/capi-quick-start/nutanix-cluster-with-failuredomains-cilium-crs.yaml" + targetName: cluster-template-topology-with-failuredomains-cilium-crs.yaml - sourcePath: "../../../examples/capi-quick-start/nutanix-cluster-calico-helm-addon.yaml" targetName: cluster-template-topology-calico-helm-addon.yaml - sourcePath: "../../../examples/capi-quick-start/nutanix-cluster-calico-crs.yaml" diff --git a/test/e2e/quick_start_test.go b/test/e2e/quick_start_test.go index b8580c9d7..6b66d52f7 100644 --- a/test/e2e/quick_start_test.go +++ b/test/e2e/quick_start_test.go @@ -63,7 +63,10 @@ var _ = Describe("Quick start", func() { if provider == "Nutanix" && cniProvider == "Cilium" { flavors = append( flavors, - fmt.Sprintf("topology-failuredomain-%s-%s", strings.ToLower(cniProvider), strategy), + fmt.Sprintf( + "topology-with-failuredomains-%s-%s", + strings.ToLower(cniProvider), + strategy), ) } for _, flavor := range flavors {