From 9c4a08ca7a2dc34f5c898cb554ba86133a223f12 Mon Sep 17 00:00:00 2001 From: Jimmi Dyson Date: Wed, 25 Jun 2025 14:56:08 +0100 Subject: [PATCH] feat: Add experimental sysext based clusterclasses --- .pre-commit-config.yaml | 2 +- .../README.md | 1 + .../default}/aws-cluster-class.yaml | 0 .../default}/docker-cluster-class.yaml | 0 .../default}/nutanix-cluster-class.yaml | 0 .../aws-sysext-cluster-class.yaml | 252 +++++++++++ .../nutanix-sysext-cluster-class.yaml | 396 ++++++++++++++++++ ...aws.yaml => clusterclass_default_aws.yaml} | 5 +- ....yaml => clusterclass_default_docker.yaml} | 5 +- ...yaml => clusterclass_default_nutanix.yaml} | 5 +- .../clusterclass_experimental_aws.yaml | 9 + .../clusterclass_experimental_docker.yaml | 9 + .../clusterclass_experimental_nutanix.yaml | 9 + .../values.schema.json | 3 + .../values.yaml | 1 + .../aws-sysext-cluster-cilium-helm-addon.yaml | 68 +++ ...anix-sysext-cluster-cilium-helm-addon.yaml | 165 ++++++++ .../aws/clusterclass/kustomization.yaml.tmpl | 5 - .../clusterclass/kustomization.yaml.tmpl | 5 - .../clusterclass/kustomization.yaml.tmpl | 5 - .../{ => default}/aws/kustomization.yaml.tmpl | 25 +- .../default/aws}/kustomizeconfig.yaml | 0 .../docker/kustomization.yaml.tmpl | 25 +- .../default/docker}/kustomizeconfig.yaml | 0 .../nutanix/kustomization.yaml.tmpl | 21 +- .../default/nutanix}/kustomizeconfig.yaml | 0 .../sysext/aws/kustomization.yaml.tmpl | 110 +++++ .../sysext/aws/kustomizeconfig.yaml | 22 + .../sysext/nutanix/kustomization.yaml.tmpl | 68 +++ .../sysext/nutanix/kustomizeconfig.yaml | 22 + .../aws}/calico/crs/kustomization.yaml.tmpl | 8 +- .../calico/helm-addon/kustomization.yaml.tmpl | 4 +- .../aws/cilium/crs/kustomization.yaml.tmpl | 8 +- .../helm-addon/kustomization.yaml.tmpl | 4 +- .../calico}/crs/kustomization.yaml.tmpl | 8 +- .../helm-addon/kustomization.yaml.tmpl | 4 +- .../cilium}/crs/kustomization.yaml.tmpl | 8 +- .../cilium/helm-addon/kustomization.yaml.tmpl | 4 +- .../calico/crs/kustomization.yaml.tmpl | 6 +- .../calico/helm-addon/kustomization.yaml.tmpl | 16 + .../cilium/crs/kustomization.yaml.tmpl | 6 +- .../cilium/helm-addon/kustomization.yaml.tmpl | 16 + .../calico/helm-addon/kustomization.yaml.tmpl | 16 - .../cilium/helm-addon/kustomization.yaml.tmpl | 16 - .../cilium/helm-addon/kustomization.yaml.tmpl | 22 + .../cilium/helm-addon/kustomization.yaml.tmpl | 22 + ...nitialize-kubeadmconfigtemplate-files.yaml | 6 + ...eadmconfigtemplate-prekubeadmcommands.yaml | 6 + ...ze-kubeadmcontrolplanetemplate-files.yaml} | 0 ...ntrolplanetemplate-prekubeadmcommands.yaml | 6 + .../kubeadmconfigtemplate-nkp-sysctl.yaml | 13 + ...ubeadmcontrolplanetemplate-nkp-sysctl.yaml | 13 + hack/examples/patches/sysext-cc-patch.yaml | 47 +++ .../release/add-version-to-clusterclasses.sh | 2 +- hack/examples/sync.sh | 18 +- hack/license-header.txt | 2 +- make/addons.mk | 2 +- make/dev.mk | 1 + test/e2e/config/caren.yaml | 6 +- 59 files changed, 1410 insertions(+), 118 deletions(-) rename charts/cluster-api-runtime-extensions-nutanix/{defaultclusterclasses => clusterclasses/default}/aws-cluster-class.yaml (100%) rename charts/cluster-api-runtime-extensions-nutanix/{defaultclusterclasses => clusterclasses/default}/docker-cluster-class.yaml (100%) rename charts/cluster-api-runtime-extensions-nutanix/{defaultclusterclasses => clusterclasses/default}/nutanix-cluster-class.yaml (100%) create mode 100644 charts/cluster-api-runtime-extensions-nutanix/clusterclasses/experimental/aws-sysext-cluster-class.yaml create mode 100644 charts/cluster-api-runtime-extensions-nutanix/clusterclasses/experimental/nutanix-sysext-cluster-class.yaml rename charts/cluster-api-runtime-extensions-nutanix/templates/{clusterclass_aws.yaml => clusterclass_default_aws.yaml} (67%) rename charts/cluster-api-runtime-extensions-nutanix/templates/{clusterclass_docker.yaml => clusterclass_default_docker.yaml} (67%) rename charts/cluster-api-runtime-extensions-nutanix/templates/{clusterclass_nutanix.yaml => clusterclass_default_nutanix.yaml} (67%) create mode 100644 charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_experimental_aws.yaml create mode 100644 charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_experimental_docker.yaml create mode 100644 charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_experimental_nutanix.yaml create mode 100644 examples/capi-quick-start/aws-sysext-cluster-cilium-helm-addon.yaml create mode 100644 examples/capi-quick-start/nutanix-sysext-cluster-cilium-helm-addon.yaml rename hack/examples/overlays/clusterclasses/{ => default}/aws/kustomization.yaml.tmpl (76%) rename hack/examples/{bases/aws/clusterclass => overlays/clusterclasses/default/aws}/kustomizeconfig.yaml (100%) rename hack/examples/overlays/clusterclasses/{ => default}/docker/kustomization.yaml.tmpl (62%) rename hack/examples/{bases/docker/clusterclass => overlays/clusterclasses/default/docker}/kustomizeconfig.yaml (100%) rename hack/examples/overlays/clusterclasses/{ => default}/nutanix/kustomization.yaml.tmpl (66%) rename hack/examples/{bases/nutanix/clusterclass => overlays/clusterclasses/default/nutanix}/kustomizeconfig.yaml (100%) create mode 100644 hack/examples/overlays/clusterclasses/sysext/aws/kustomization.yaml.tmpl create mode 100644 hack/examples/overlays/clusterclasses/sysext/aws/kustomizeconfig.yaml create mode 100644 hack/examples/overlays/clusterclasses/sysext/nutanix/kustomization.yaml.tmpl create mode 100644 hack/examples/overlays/clusterclasses/sysext/nutanix/kustomizeconfig.yaml rename hack/examples/overlays/clusters/{docker => default/aws}/calico/crs/kustomization.yaml.tmpl (59%) rename hack/examples/overlays/clusters/{ => default}/aws/calico/helm-addon/kustomization.yaml.tmpl (72%) rename hack/examples/overlays/clusters/{ => default}/aws/cilium/crs/kustomization.yaml.tmpl (59%) rename hack/examples/overlays/clusters/{docker/calico => default/aws/cilium}/helm-addon/kustomization.yaml.tmpl (72%) rename hack/examples/overlays/clusters/{docker/cilium => default/docker/calico}/crs/kustomization.yaml.tmpl (58%) rename hack/examples/overlays/clusters/{aws/cilium => default/docker/calico}/helm-addon/kustomization.yaml.tmpl (72%) rename hack/examples/overlays/clusters/{aws/calico => default/docker/cilium}/crs/kustomization.yaml.tmpl (58%) rename hack/examples/overlays/clusters/{ => default}/docker/cilium/helm-addon/kustomization.yaml.tmpl (72%) rename hack/examples/overlays/clusters/{ => default}/nutanix/calico/crs/kustomization.yaml.tmpl (64%) create mode 100644 hack/examples/overlays/clusters/default/nutanix/calico/helm-addon/kustomization.yaml.tmpl rename hack/examples/overlays/clusters/{ => default}/nutanix/cilium/crs/kustomization.yaml.tmpl (64%) create mode 100644 hack/examples/overlays/clusters/default/nutanix/cilium/helm-addon/kustomization.yaml.tmpl delete mode 100644 hack/examples/overlays/clusters/nutanix/calico/helm-addon/kustomization.yaml.tmpl delete mode 100644 hack/examples/overlays/clusters/nutanix/cilium/helm-addon/kustomization.yaml.tmpl create mode 100644 hack/examples/overlays/clusters/sysext/aws/cilium/helm-addon/kustomization.yaml.tmpl create mode 100644 hack/examples/overlays/clusters/sysext/nutanix/cilium/helm-addon/kustomization.yaml.tmpl create mode 100644 hack/examples/patches/initialize-kubeadmconfigtemplate-files.yaml create mode 100644 hack/examples/patches/initialize-kubeadmconfigtemplate-prekubeadmcommands.yaml rename hack/examples/patches/{initialize-files.yaml => initialize-kubeadmcontrolplanetemplate-files.yaml} (100%) create mode 100644 hack/examples/patches/initialize-kubeadmcontrolplanetemplate-prekubeadmcommands.yaml create mode 100644 hack/examples/patches/kubeadmconfigtemplate-nkp-sysctl.yaml create mode 100644 hack/examples/patches/kubeadmcontrolplanetemplate-nkp-sysctl.yaml create mode 100644 hack/examples/patches/sysext-cc-patch.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 84eb5c921..198015eb0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -153,7 +153,7 @@ repos: name: License headers - YAML and Makefiles stages: [pre-commit] files: (^Makefile|\.(ya?ml|mk))$ - exclude: ^(internal/test|pkg/handlers/.+/embedded|examples|charts/cluster-api-runtime-extensions-nutanix/(defaultclusterclasses|addons))/.+\.ya?ml|docs/static/helm/index\.yaml|charts/cluster-api-runtime-extensions-nutanix/templates/helm-config.yaml|hack/examples/files/kube-vip.yaml$ + exclude: ^(internal/test|pkg/handlers/.+/embedded|examples|charts/cluster-api-runtime-extensions-nutanix/(clusterclasses|addons))/.+\.ya?ml|docs/static/helm/index\.yaml|charts/cluster-api-runtime-extensions-nutanix/templates/helm-config.yaml|hack/examples/files/kube-vip.yaml$ args: - --license-filepath - hack/license-header.txt diff --git a/charts/cluster-api-runtime-extensions-nutanix/README.md b/charts/cluster-api-runtime-extensions-nutanix/README.md index 993f712dc..ff88caa6b 100644 --- a/charts/cluster-api-runtime-extensions-nutanix/README.md +++ b/charts/cluster-api-runtime-extensions-nutanix/README.md @@ -29,6 +29,7 @@ A Helm chart for cluster-api-runtime-extensions-nutanix | certificates.issuer.name | string | `""` | | | certificates.issuer.selfSigned | bool | `true` | | | deployDefaultClusterClasses | bool | `true` | | +| deployExperimentalClusterClasses | bool | `false` | | | deployment.replicas | int | `1` | | | enforceClusterAutoscalerLimits.enabled | bool | `true` | | | env | object | `{}` | | diff --git a/charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/aws-cluster-class.yaml b/charts/cluster-api-runtime-extensions-nutanix/clusterclasses/default/aws-cluster-class.yaml similarity index 100% rename from charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/aws-cluster-class.yaml rename to charts/cluster-api-runtime-extensions-nutanix/clusterclasses/default/aws-cluster-class.yaml diff --git a/charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/docker-cluster-class.yaml b/charts/cluster-api-runtime-extensions-nutanix/clusterclasses/default/docker-cluster-class.yaml similarity index 100% rename from charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/docker-cluster-class.yaml rename to charts/cluster-api-runtime-extensions-nutanix/clusterclasses/default/docker-cluster-class.yaml diff --git a/charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/nutanix-cluster-class.yaml b/charts/cluster-api-runtime-extensions-nutanix/clusterclasses/default/nutanix-cluster-class.yaml similarity index 100% rename from charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/nutanix-cluster-class.yaml rename to charts/cluster-api-runtime-extensions-nutanix/clusterclasses/default/nutanix-cluster-class.yaml diff --git a/charts/cluster-api-runtime-extensions-nutanix/clusterclasses/experimental/aws-sysext-cluster-class.yaml b/charts/cluster-api-runtime-extensions-nutanix/clusterclasses/experimental/aws-sysext-cluster-class.yaml new file mode 100644 index 000000000..8799a3fce --- /dev/null +++ b/charts/cluster-api-runtime-extensions-nutanix/clusterclasses/experimental/aws-sysext-cluster-class.yaml @@ -0,0 +1,252 @@ +apiVersion: cluster.x-k8s.io/v1beta1 +kind: ClusterClass +metadata: + labels: + cluster.x-k8s.io/provider: aws + name: aws-sysext-quick-start +spec: + controlPlane: + machineInfrastructure: + ref: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: AWSMachineTemplate + name: aws-sysext-quick-start-control-plane + ref: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: KubeadmControlPlaneTemplate + name: aws-sysext-quick-start-control-plane + infrastructure: + ref: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: AWSClusterTemplate + name: aws-sysext-quick-start + patches: + - definitions: + - jsonPatches: + - op: add + path: /spec/template/spec/preKubeadmCommands/- + value: mkdir -p /var/lib/extensions/ + - op: add + path: /spec/template/spec/preKubeadmCommands/- + value: curl -L https://extensions.flatcar.org/extensions/containerd/containerd-2.1.3-x86-64.raw + -o /var/lib/extensions/containerd.raw + - op: add + path: /spec/template/spec/preKubeadmCommands/- + valueFrom: + template: curl -L https://extensions.flatcar.org/extensions/kubernetes/kubernetes-{{ + .builtin.cluster.topology.version }}-x86-64.raw -o /var/lib/extensions/kubernetes.raw + - op: add + path: /spec/template/spec/preKubeadmCommands/- + value: systemd-sysext merge + selector: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfigTemplate + matchResources: + machineDeploymentClass: + names: + - '*' + - jsonPatches: + - op: add + path: /spec/template/spec/kubeadmConfigSpec/preKubeadmCommands/- + value: mkdir -p /var/lib/extensions/ + - op: add + path: /spec/template/spec/kubeadmConfigSpec/preKubeadmCommands/- + value: curl -L https://extensions.flatcar.org/extensions/containerd/containerd-2.1.3-x86-64.raw + -o /var/lib/extensions/containerd.raw + - op: add + path: /spec/template/spec/kubeadmConfigSpec/preKubeadmCommands/- + valueFrom: + template: curl -L https://extensions.flatcar.org/extensions/kubernetes/kubernetes-{{ + .builtin.cluster.topology.version }}-x86-64.raw -o /var/lib/extensions/kubernetes.raw + - op: add + path: /spec/template/spec/kubeadmConfigSpec/preKubeadmCommands/- + value: systemd-sysext merge + selector: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: KubeadmControlPlaneTemplate + matchResources: + controlPlane: true + name: sysexts + - external: + discoverVariablesExtension: awsclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix + generateExtension: awsclusterv4configpatch-gp.cluster-api-runtime-extensions-nutanix + name: cluster-config + - external: + discoverVariablesExtension: awsworkerconfigvars-dv.cluster-api-runtime-extensions-nutanix + generateExtension: awsworkerv4configpatch-gp.cluster-api-runtime-extensions-nutanix + name: worker-config + - definitions: + - jsonPatches: + - op: add + path: /spec/template/spec/identityRef + value: + kind: AWSClusterControllerIdentity + name: default + selector: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: AWSClusterTemplate + matchResources: + infrastructureCluster: true + description: AWSClusterStaticIdentity identityRef to use when creating the cluster + name: identityRef + workers: + machineDeployments: + - class: default-worker + template: + bootstrap: + ref: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfigTemplate + name: aws-sysext-quick-start-worker-bootstraptemplate + infrastructure: + ref: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: AWSMachineTemplate + name: aws-sysext-quick-start-worker-machinetemplate +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: AWSClusterTemplate +metadata: + labels: + cluster.x-k8s.io/provider: aws + name: aws-sysext-quick-start +spec: + template: + spec: + controlPlaneLoadBalancer: + healthCheckProtocol: HTTPS + loadBalancerType: nlb +--- +apiVersion: controlplane.cluster.x-k8s.io/v1beta1 +kind: KubeadmControlPlaneTemplate +metadata: + labels: + cluster.x-k8s.io/provider: aws + name: aws-sysext-quick-start-control-plane +spec: + template: + spec: + kubeadmConfigSpec: + clusterConfiguration: + apiServer: + extraArgs: + admission-control-config-file: /etc/kubernetes/admission.yaml + enable-admission-plugins: DenyServiceExternalIPs,EventRateLimit,NodeRestriction + profiling: "false" + service-account-lookup: "true" + extraVolumes: + - hostPath: /etc/kubernetes/admission.yaml + mountPath: /etc/kubernetes/admission.yaml + name: admission-config + pathType: File + readOnly: true + - hostPath: /etc/kubernetes/eventratelimit-config.yaml + mountPath: /etc/kubernetes/eventratelimit-config.yaml + name: eventratelimit-config + pathType: File + readOnly: true + controllerManager: + extraArgs: + cloud-provider: external + profiling: "false" + terminated-pod-gc-threshold: "10000" + scheduler: + extraArgs: + profiling: "false" + files: + - content: | + apiVersion: apiserver.config.k8s.io/v1 + kind: AdmissionConfiguration + plugins: + - name: EventRateLimit + path: /etc/kubernetes/eventratelimit-config.yaml + path: /etc/kubernetes/admission.yaml + permissions: "0600" + - content: | + apiVersion: eventratelimit.admission.k8s.io/v1alpha1 + kind: Configuration + limits: + - type: Server + qps: 10000 + burst: 40000 + path: /etc/kubernetes/eventratelimit-config.yaml + permissions: "0600" + - content: | + net.ipv4.ip_forward=1 + path: /etc/sysctl.d/99-nkp.conf + permissions: "0644" + initConfiguration: + nodeRegistration: + kubeletExtraArgs: + cloud-provider: external + event-qps: "5" + make-iptables-util-chains: "true" + pod-max-pids: "4096" + read-only-port: "0" + streaming-connection-idle-timeout: 5m + tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + name: '{{ ds.meta_data.local_hostname }}' + joinConfiguration: + nodeRegistration: + kubeletExtraArgs: + cloud-provider: external + event-qps: "5" + make-iptables-util-chains: "true" + pod-max-pids: "4096" + read-only-port: "0" + streaming-connection-idle-timeout: 5m + tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + name: '{{ ds.meta_data.local_hostname }}' + preKubeadmCommands: + - systemctl restart systemd-sysctl +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: AWSMachineTemplate +metadata: + labels: + cluster.x-k8s.io/provider: aws + name: aws-sysext-quick-start-control-plane +spec: + template: + spec: + instanceType: PLACEHOLDER + sshKeyName: "" +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 +kind: AWSMachineTemplate +metadata: + labels: + cluster.x-k8s.io/provider: aws + name: aws-sysext-quick-start-worker-machinetemplate +spec: + template: + spec: + instanceType: PLACEHOLDER + sshKeyName: "" +--- +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 +kind: KubeadmConfigTemplate +metadata: + labels: + cluster.x-k8s.io/provider: aws + name: aws-sysext-quick-start-worker-bootstraptemplate +spec: + template: + spec: + files: + - content: | + net.ipv4.ip_forward=1 + path: /etc/sysctl.d/99-nkp.conf + permissions: "0644" + joinConfiguration: + nodeRegistration: + kubeletExtraArgs: + cloud-provider: external + event-qps: "5" + pod-max-pids: "4096" + read-only-port: "0" + streaming-connection-idle-timeout: 5m + tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + name: '{{ ds.meta_data.local_hostname }}' + preKubeadmCommands: + - systemctl restart systemd-sysctl diff --git a/charts/cluster-api-runtime-extensions-nutanix/clusterclasses/experimental/nutanix-sysext-cluster-class.yaml b/charts/cluster-api-runtime-extensions-nutanix/clusterclasses/experimental/nutanix-sysext-cluster-class.yaml new file mode 100644 index 000000000..c298e0aec --- /dev/null +++ b/charts/cluster-api-runtime-extensions-nutanix/clusterclasses/experimental/nutanix-sysext-cluster-class.yaml @@ -0,0 +1,396 @@ +apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 +kind: KubeadmConfigTemplate +metadata: + labels: + cluster.x-k8s.io/provider: nutanix + name: nutanix-sysext-quick-start-kcfg-0 +spec: + template: + spec: + files: + - content: | + net.ipv4.ip_forward=1 + path: /etc/sysctl.d/99-nkp.conf + permissions: "0644" + joinConfiguration: + nodeRegistration: + kubeletExtraArgs: + cloud-provider: external + event-qps: "5" + eviction-hard: nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<15%,memory.available<100Mi,imagefs.inodesFree<10% + pod-max-pids: "4096" + read-only-port: "0" + streaming-connection-idle-timeout: 5m + tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + postKubeadmCommands: + - echo "after kubeadm call" > /var/log/postkubeadm.log + preKubeadmCommands: + - echo "before kubeadm call" > /var/log/prekubeadm.log + - hostnamectl set-hostname "{{ ds.meta_data.hostname }}" + - systemctl restart systemd-sysctl + verbosity: 10 +--- +apiVersion: cluster.x-k8s.io/v1beta1 +kind: ClusterClass +metadata: + labels: + cluster.x-k8s.io/provider: nutanix + name: nutanix-sysext-quick-start +spec: + controlPlane: + machineHealthCheck: + maxUnhealthy: 40% + nodeStartupTimeout: 10m + unhealthyConditions: + - status: "False" + timeout: 300s + type: Ready + - status: Unknown + timeout: 300s + type: Ready + - status: "True" + timeout: 300s + type: MemoryPressure + - status: "True" + timeout: 300s + type: DiskPressure + - status: "True" + timeout: 300s + type: PIDPressure + - status: "True" + timeout: 300s + type: NetworkUnavailable + machineInfrastructure: + ref: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: NutanixMachineTemplate + name: nutanix-sysext-quick-start-cp-nmt + ref: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: KubeadmControlPlaneTemplate + name: nutanix-sysext-quick-start-kcpt + infrastructure: + ref: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: NutanixClusterTemplate + name: nutanix-sysext-quick-start-nct + patches: + - definitions: + - jsonPatches: + - op: add + path: /spec/template/spec/preKubeadmCommands/- + value: mkdir -p /var/lib/extensions/ + - op: add + path: /spec/template/spec/preKubeadmCommands/- + value: curl -L https://extensions.flatcar.org/extensions/containerd/containerd-2.1.3-x86-64.raw + -o /var/lib/extensions/containerd.raw + - op: add + path: /spec/template/spec/preKubeadmCommands/- + valueFrom: + template: curl -L https://extensions.flatcar.org/extensions/kubernetes/kubernetes-{{ + .builtin.cluster.topology.version }}-x86-64.raw -o /var/lib/extensions/kubernetes.raw + - op: add + path: /spec/template/spec/preKubeadmCommands/- + value: systemd-sysext merge + selector: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfigTemplate + matchResources: + machineDeploymentClass: + names: + - '*' + - jsonPatches: + - op: add + path: /spec/template/spec/kubeadmConfigSpec/preKubeadmCommands/- + value: mkdir -p /var/lib/extensions/ + - op: add + path: /spec/template/spec/kubeadmConfigSpec/preKubeadmCommands/- + value: curl -L https://extensions.flatcar.org/extensions/containerd/containerd-2.1.3-x86-64.raw + -o /var/lib/extensions/containerd.raw + - op: add + path: /spec/template/spec/kubeadmConfigSpec/preKubeadmCommands/- + valueFrom: + template: curl -L https://extensions.flatcar.org/extensions/kubernetes/kubernetes-{{ + .builtin.cluster.topology.version }}-x86-64.raw -o /var/lib/extensions/kubernetes.raw + - op: add + path: /spec/template/spec/kubeadmConfigSpec/preKubeadmCommands/- + value: systemd-sysext merge + selector: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: KubeadmControlPlaneTemplate + matchResources: + controlPlane: true + name: sysexts + - external: + discoverVariablesExtension: nutanixclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix + generateExtension: nutanixclusterv4configpatch-gp.cluster-api-runtime-extensions-nutanix + name: cluster-config + - external: + discoverVariablesExtension: nutanixworkerconfigvars-dv.cluster-api-runtime-extensions-nutanix + generateExtension: nutanixworkerv4configpatch-gp.cluster-api-runtime-extensions-nutanix + name: worker-config + workers: + machineDeployments: + - class: default-worker + machineHealthCheck: + maxUnhealthy: 40% + nodeStartupTimeout: 10m + unhealthyConditions: + - status: "False" + timeout: 300s + type: Ready + - status: Unknown + timeout: 300s + type: Ready + - status: "True" + timeout: 300s + type: MemoryPressure + - status: "True" + timeout: 300s + type: DiskPressure + - status: "True" + timeout: 300s + type: PIDPressure + - status: "True" + timeout: 300s + type: NetworkUnavailable + template: + bootstrap: + ref: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfigTemplate + name: nutanix-sysext-quick-start-kcfg-0 + infrastructure: + ref: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + kind: NutanixMachineTemplate + name: nutanix-sysext-quick-start-md-nmt +--- +apiVersion: controlplane.cluster.x-k8s.io/v1beta1 +kind: KubeadmControlPlaneTemplate +metadata: + labels: + cluster.x-k8s.io/provider: nutanix + name: nutanix-sysext-quick-start-kcpt +spec: + template: + spec: + kubeadmConfigSpec: + clusterConfiguration: + apiServer: + extraArgs: + admission-control-config-file: /etc/kubernetes/admission.yaml + enable-admission-plugins: DenyServiceExternalIPs,EventRateLimit,NodeRestriction + profiling: "false" + service-account-lookup: "true" + tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 + extraVolumes: + - hostPath: /etc/kubernetes/admission.yaml + mountPath: /etc/kubernetes/admission.yaml + name: admission-config + pathType: File + readOnly: true + - hostPath: /etc/kubernetes/eventratelimit-config.yaml + mountPath: /etc/kubernetes/eventratelimit-config.yaml + name: eventratelimit-config + pathType: File + readOnly: true + controllerManager: + extraArgs: + cloud-provider: external + profiling: "false" + terminated-pod-gc-threshold: "10000" + tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 + scheduler: + extraArgs: + profiling: "false" + tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 + files: + - content: |- + apiVersion: v1 + kind: Pod + metadata: + name: kube-vip + namespace: kube-system + spec: + containers: + - args: + - manager + env: + - name: vip_arp + value: "true" + - name: port + value: '{{ .Port }}' + - name: vip_nodename + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: vip_subnet + value: "32" + - name: dns_mode + value: first + - name: cp_enable + value: "true" + - name: cp_namespace + value: kube-system + - name: vip_leaderelection + value: "true" + - name: vip_leasename + value: plndr-cp-lock + - name: vip_leaseduration + value: "15" + - name: vip_renewdeadline + value: "10" + - name: vip_retryperiod + value: "2" + - name: address + value: '{{ .Address }}' + - name: prometheus_server + image: ghcr.io/kube-vip/kube-vip:v0.9.1 + imagePullPolicy: IfNotPresent + name: kube-vip + resources: {} + securityContext: + capabilities: + add: + - NET_ADMIN + - NET_RAW + drop: + - ALL + volumeMounts: + - mountPath: /etc/kubernetes/admin.conf + name: kubeconfig + hostAliases: + - hostnames: + - kubernetes + ip: 127.0.0.1 + hostNetwork: true + volumes: + - hostPath: + path: /etc/kubernetes/admin.conf + name: kubeconfig + path: /etc/kubernetes/manifests/kube-vip.yaml + - content: | + apiVersion: apiserver.config.k8s.io/v1 + kind: AdmissionConfiguration + plugins: + - name: EventRateLimit + path: /etc/kubernetes/eventratelimit-config.yaml + path: /etc/kubernetes/admission.yaml + permissions: "0600" + - content: | + apiVersion: eventratelimit.admission.k8s.io/v1alpha1 + kind: Configuration + limits: + - type: Server + qps: 10000 + burst: 40000 + path: /etc/kubernetes/eventratelimit-config.yaml + permissions: "0600" + - content: | + net.ipv4.ip_forward=1 + path: /etc/sysctl.d/99-nkp.conf + permissions: "0644" + initConfiguration: + nodeRegistration: + kubeletExtraArgs: + cloud-provider: external + event-qps: "5" + eviction-hard: nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<15%,memory.available<100Mi,imagefs.inodesFree<10% + make-iptables-util-chains: "true" + pod-max-pids: "4096" + read-only-port: "0" + streaming-connection-idle-timeout: 5m + tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + joinConfiguration: + nodeRegistration: + kubeletExtraArgs: + cloud-provider: external + event-qps: "5" + eviction-hard: nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<15%,memory.available<100Mi,imagefs.inodesFree<10% + make-iptables-util-chains: "true" + pod-max-pids: "4096" + read-only-port: "0" + streaming-connection-idle-timeout: 5m + tls-cipher-suites: TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 + postKubeadmCommands: + - echo export KUBECONFIG=/etc/kubernetes/admin.conf >> /root/.bashrc + - echo "after kubeadm call" > /var/log/postkubeadm.log + preKubeadmCommands: + - echo "before kubeadm call" > /var/log/prekubeadm.log + - hostnamectl set-hostname "{{ ds.meta_data.hostname }}" + - echo "::1 ipv6-localhost ipv6-loopback" >/etc/hosts + - echo "127.0.0.1 localhost" >>/etc/hosts + - echo "127.0.0.1 {{ ds.meta_data.hostname }}" >> /etc/hosts + - systemctl restart systemd-sysctl + useExperimentalRetryJoin: true + verbosity: 10 +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: NutanixClusterTemplate +metadata: + labels: + cluster.x-k8s.io/provider: nutanix + name: nutanix-sysext-quick-start-nct +spec: + template: + spec: + controlPlaneEndpoint: + host: PLACEHOLDER + port: 6443 + failureDomains: [] + prismCentral: + address: PLACEHOLDER + credentialRef: + kind: Secret + name: PLACEHOLDER + namespace: default + port: 9440 +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: NutanixMachineTemplate +metadata: + labels: + cluster.x-k8s.io/provider: nutanix + name: nutanix-sysext-quick-start-cp-nmt +spec: + template: + spec: + bootType: legacy + cluster: + name: "" + type: name + image: + name: "" + type: name + memorySize: 4Gi + subnet: + - name: "" + type: name + systemDiskSize: 40Gi + vcpuSockets: 2 + vcpusPerSocket: 1 +--- +apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +kind: NutanixMachineTemplate +metadata: + labels: + cluster.x-k8s.io/provider: nutanix + name: nutanix-sysext-quick-start-md-nmt +spec: + template: + spec: + bootType: legacy + cluster: + name: "" + type: name + image: + name: "" + type: name + memorySize: 4Gi + subnet: + - name: "" + type: name + systemDiskSize: 40Gi + vcpuSockets: 2 + vcpusPerSocket: 1 diff --git a/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_aws.yaml b/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_default_aws.yaml similarity index 67% rename from charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_aws.yaml rename to charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_default_aws.yaml index af43e903a..39a00b396 100644 --- a/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_aws.yaml +++ b/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_default_aws.yaml @@ -2,5 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 {{- if and .Values.deployDefaultClusterClasses (.Capabilities.APIVersions.Has "infrastructure.cluster.x-k8s.io/v1beta2/AWSClusterTemplate") }} -{{ .Files.Get "defaultclusterclasses/aws-cluster-class.yaml" }} +{{ range $path, $_ := .Files.Glob "clusterclasses/default/aws-*.yaml" }} +--- +{{ $.Files.Get $path }} +{{ end }} {{- end}} diff --git a/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_docker.yaml b/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_default_docker.yaml similarity index 67% rename from charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_docker.yaml rename to charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_default_docker.yaml index a043eb6f8..e6b376506 100644 --- a/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_docker.yaml +++ b/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_default_docker.yaml @@ -2,5 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 {{- if and .Values.deployDefaultClusterClasses (.Capabilities.APIVersions.Has "infrastructure.cluster.x-k8s.io/v1beta1/DockerClusterTemplate") }} -{{ .Files.Get "defaultclusterclasses/docker-cluster-class.yaml" }} +{{ range $path, $_ := .Files.Glob "clusterclasses/default/docker-*.yaml" }} +--- +{{ $.Files.Get $path }} +{{ end }} {{- end}} diff --git a/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_nutanix.yaml b/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_default_nutanix.yaml similarity index 67% rename from charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_nutanix.yaml rename to charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_default_nutanix.yaml index e628eeb5f..c1419512d 100644 --- a/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_nutanix.yaml +++ b/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_default_nutanix.yaml @@ -2,5 +2,8 @@ # SPDX-License-Identifier: Apache-2.0 {{- if and .Values.deployDefaultClusterClasses (.Capabilities.APIVersions.Has "infrastructure.cluster.x-k8s.io/v1beta1/NutanixClusterTemplate") }} -{{ .Files.Get "defaultclusterclasses/nutanix-cluster-class.yaml" }} +{{ range $path, $_ := .Files.Glob "clusterclasses/default/nutanix-*.yaml" }} +--- +{{ $.Files.Get $path }} +{{ end }} {{- end}} diff --git a/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_experimental_aws.yaml b/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_experimental_aws.yaml new file mode 100644 index 000000000..acd72f327 --- /dev/null +++ b/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_experimental_aws.yaml @@ -0,0 +1,9 @@ +# Copyright 2025 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +{{- if and .Values.deployExperimentalClusterClasses (.Capabilities.APIVersions.Has "infrastructure.cluster.x-k8s.io/v1beta2/AWSClusterTemplate") }} +{{ range $path, $_ := .Files.Glob "clusterclasses/experimental/aws-*.yaml" }} +--- +{{ $.Files.Get $path }} +{{ end }} +{{- end}} diff --git a/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_experimental_docker.yaml b/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_experimental_docker.yaml new file mode 100644 index 000000000..60b2e1b41 --- /dev/null +++ b/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_experimental_docker.yaml @@ -0,0 +1,9 @@ +# Copyright 2025 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +{{- if and .Values.deployExperimentalClusterClasses (.Capabilities.APIVersions.Has "infrastructure.cluster.x-k8s.io/v1beta1/DockerClusterTemplate") }} +{{ range $path, $_ := .Files.Glob "clusterclasses/experimental/docker-*.yaml" }} +--- +{{ $.Files.Get $path }} +{{ end }} +{{- end}} diff --git a/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_experimental_nutanix.yaml b/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_experimental_nutanix.yaml new file mode 100644 index 000000000..6e3748b7f --- /dev/null +++ b/charts/cluster-api-runtime-extensions-nutanix/templates/clusterclass_experimental_nutanix.yaml @@ -0,0 +1,9 @@ +# Copyright 2025 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +{{- if and .Values.deployExperimentalClusterClasses (.Capabilities.APIVersions.Has "infrastructure.cluster.x-k8s.io/v1beta1/NutanixClusterTemplate") }} +{{ range $path, $_ := .Files.Glob "clusterclasses/experimental/nutanix-*.yaml" }} +--- +{{ $.Files.Get $path }} +{{ end }} +{{- end}} diff --git a/charts/cluster-api-runtime-extensions-nutanix/values.schema.json b/charts/cluster-api-runtime-extensions-nutanix/values.schema.json index 145703e10..f7da5144c 100644 --- a/charts/cluster-api-runtime-extensions-nutanix/values.schema.json +++ b/charts/cluster-api-runtime-extensions-nutanix/values.schema.json @@ -23,6 +23,9 @@ "deployDefaultClusterClasses": { "type": "boolean" }, + "deployExperimentalClusterClasses": { + "type": "boolean" + }, "deployment": { "properties": { "replicas": { diff --git a/charts/cluster-api-runtime-extensions-nutanix/values.yaml b/charts/cluster-api-runtime-extensions-nutanix/values.yaml index 837a8c40d..4b8d2cb7e 100644 --- a/charts/cluster-api-runtime-extensions-nutanix/values.yaml +++ b/charts/cluster-api-runtime-extensions-nutanix/values.yaml @@ -121,6 +121,7 @@ hooks: helmAddonsConfigMap: default-helm-addons-config deployDefaultClusterClasses: true +deployExperimentalClusterClasses: false # The ClusterClass and the Templates it references must be in the same namespace # as the Cluster. To enable cluster creation in user-defined namespaces, CAREN diff --git a/examples/capi-quick-start/aws-sysext-cluster-cilium-helm-addon.yaml b/examples/capi-quick-start/aws-sysext-cluster-cilium-helm-addon.yaml new file mode 100644 index 000000000..ca55b72a1 --- /dev/null +++ b/examples/capi-quick-start/aws-sysext-cluster-cilium-helm-addon.yaml @@ -0,0 +1,68 @@ +apiVersion: cluster.x-k8s.io/v1beta1 +kind: Cluster +metadata: + labels: + cluster.x-k8s.io/provider: aws + name: ${CLUSTER_NAME} +spec: + clusterNetwork: + pods: + cidrBlocks: + - ${POD_CIDR:-192.168.0.0/16} + serviceDomain: ${SERVICE_DOMAIN:="cluster.local"} + services: + cidrBlocks: + - ${SERVICE_CIDR:-10.128.0.0/12} + topology: + class: aws-sysext-quick-start + controlPlane: + replicas: ${CONTROL_PLANE_MACHINE_COUNT} + variables: + - name: clusterConfig + value: + addons: + ccm: {} + clusterAutoscaler: {} + cni: + provider: Cilium + csi: + defaultStorage: + provider: aws-ebs + storageClassConfig: default + providers: + aws-ebs: + storageClassConfigs: + default: {} + snapshotController: {} + nfd: {} + aws: + region: us-west-2 + controlPlane: + aws: + ami: + lookup: + baseOS: ${AMI_LOOKUP_BASEOS} + format: ${AMI_LOOKUP_FORMAT} + org: "${AMI_LOOKUP_ORG}" + dns: + coreDNS: {} + encryptionAtRest: + providers: + - aescbc: {} + - name: workerConfig + value: + aws: + ami: + lookup: + baseOS: ${AMI_LOOKUP_BASEOS} + format: ${AMI_LOOKUP_FORMAT} + org: "${AMI_LOOKUP_ORG}" + version: ${KUBERNETES_VERSION} + workers: + machineDeployments: + - 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-0 diff --git a/examples/capi-quick-start/nutanix-sysext-cluster-cilium-helm-addon.yaml b/examples/capi-quick-start/nutanix-sysext-cluster-cilium-helm-addon.yaml new file mode 100644 index 000000000..c80eec974 --- /dev/null +++ b/examples/capi-quick-start/nutanix-sysext-cluster-cilium-helm-addon.yaml @@ -0,0 +1,165 @@ +apiVersion: v1 +kind: Secret +metadata: + labels: + cluster.x-k8s.io/provider: nutanix + name: ${CLUSTER_NAME}-dockerhub-credentials +stringData: + password: ${DOCKER_HUB_PASSWORD} + username: ${DOCKER_HUB_USERNAME} +type: Opaque +--- +apiVersion: v1 +kind: Secret +metadata: + labels: + cluster.x-k8s.io/provider: nutanix + name: ${CLUSTER_NAME}-pc-creds-for-csi +stringData: + key: ${NUTANIX_ENDPOINT}:${NUTANIX_PORT}:${NUTANIX_USER}:${NUTANIX_PASSWORD} +--- +apiVersion: v1 +kind: Secret +metadata: + labels: + cluster.x-k8s.io/provider: nutanix + name: ${CLUSTER_NAME}-pc-creds +stringData: + credentials: | + [ + { + "type": "basic_auth", + "data": { + "prismCentral":{ + "username": "${NUTANIX_USER}", + "password": "${NUTANIX_PASSWORD}" + } + } + } + ] +--- +apiVersion: cluster.x-k8s.io/v1beta1 +kind: Cluster +metadata: + labels: + cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME} + cluster.x-k8s.io/provider: nutanix + name: ${CLUSTER_NAME} +spec: + clusterNetwork: + pods: + cidrBlocks: + - ${POD_CIDR:-192.168.0.0/16} + serviceDomain: ${SERVICE_DOMAIN:="cluster.local"} + services: + cidrBlocks: + - ${SERVICE_CIDR:-10.128.0.0/12} + topology: + class: nutanix-sysext-quick-start + controlPlane: + metadata: {} + replicas: ${CONTROL_PLANE_MACHINE_COUNT} + variables: + - name: clusterConfig + value: + addons: + ccm: + credentials: + secretRef: + name: ${CLUSTER_NAME}-pc-creds + strategy: HelmAddon + clusterAutoscaler: {} + cni: + provider: Cilium + cosi: {} + csi: + defaultStorage: + provider: nutanix + storageClassConfig: volume + providers: + nutanix: + credentials: + secretRef: + name: ${CLUSTER_NAME}-pc-creds-for-csi + storageClassConfigs: + volume: + parameters: + storageContainer: ${NUTANIX_STORAGE_CONTAINER_NAME} + strategy: HelmAddon + snapshotController: + strategy: HelmAddon + nfd: {} + serviceLoadBalancer: + configuration: + addressRanges: + - end: 198.18.1.10 + start: 198.18.1.1 + - end: 198.18.1.30 + start: 198.18.1.21 + provider: MetalLB + controlPlane: + nutanix: + machineDetails: + bootType: uefi + cluster: + name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} + type: name + imageLookup: + baseOS: ${NUTANIX_MACHINE_TEMPLATE_BASE_OS} + format: ${NUTANIX_MACHINE_TEMPLATE_LOOKUP_FORMAT} + memorySize: 4Gi + subnets: + - name: ${NUTANIX_SUBNET_NAME} + type: name + systemDiskSize: 40Gi + vcpuSockets: 2 + vcpusPerSocket: 1 + dns: + coreDNS: {} + encryptionAtRest: + providers: + - aescbc: {} + imageRegistries: + - credentials: + secretRef: + name: ${CLUSTER_NAME}-dockerhub-credentials + url: https://docker.io + nutanix: + controlPlaneEndpoint: + host: ${CONTROL_PLANE_ENDPOINT_IP} + port: 6443 + virtualIP: + provider: KubeVIP + prismCentralEndpoint: + credentials: + secretRef: + name: ${CLUSTER_NAME}-pc-creds + insecure: ${NUTANIX_INSECURE} + url: https://${NUTANIX_ENDPOINT}:9440 + - name: workerConfig + value: + nutanix: + machineDetails: + bootType: uefi + cluster: + name: ${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME} + type: name + imageLookup: + baseOS: ${NUTANIX_MACHINE_TEMPLATE_BASE_OS} + format: ${NUTANIX_MACHINE_TEMPLATE_LOOKUP_FORMAT} + memorySize: 4Gi + subnets: + - name: ${NUTANIX_SUBNET_NAME} + type: name + systemDiskSize: 40Gi + vcpuSockets: 2 + vcpusPerSocket: 1 + version: ${KUBERNETES_VERSION} + workers: + machineDeployments: + - 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-0 diff --git a/hack/examples/bases/aws/clusterclass/kustomization.yaml.tmpl b/hack/examples/bases/aws/clusterclass/kustomization.yaml.tmpl index d26955365..5a57d5a14 100644 --- a/hack/examples/bases/aws/clusterclass/kustomization.yaml.tmpl +++ b/hack/examples/bases/aws/clusterclass/kustomization.yaml.tmpl @@ -7,14 +7,9 @@ kind: Kustomization resources: - https://github.com/kubernetes-sigs/cluster-api-provider-aws/releases/download/${CAPA_VERSION}/cluster-template-simple-clusterclass.yaml -configurations: - - kustomizeconfig.yaml - sortOptions: order: fifo -namePrefix: aws- - labels: - includeSelectors: false pairs: diff --git a/hack/examples/bases/docker/clusterclass/kustomization.yaml.tmpl b/hack/examples/bases/docker/clusterclass/kustomization.yaml.tmpl index 2fc3897f1..bf63af4b1 100644 --- a/hack/examples/bases/docker/clusterclass/kustomization.yaml.tmpl +++ b/hack/examples/bases/docker/clusterclass/kustomization.yaml.tmpl @@ -7,14 +7,9 @@ kind: Kustomization resources: - https://github.com/kubernetes-sigs/cluster-api/releases/download/${CAPI_VERSION}/clusterclass-quick-start.yaml -configurations: - - kustomizeconfig.yaml - sortOptions: order: fifo -namePrefix: docker- - labels: - includeSelectors: false pairs: diff --git a/hack/examples/bases/nutanix/clusterclass/kustomization.yaml.tmpl b/hack/examples/bases/nutanix/clusterclass/kustomization.yaml.tmpl index e7167dd96..a08af5e3e 100644 --- a/hack/examples/bases/nutanix/clusterclass/kustomization.yaml.tmpl +++ b/hack/examples/bases/nutanix/clusterclass/kustomization.yaml.tmpl @@ -7,14 +7,9 @@ kind: Kustomization resources: - https://github.com/nutanix-cloud-native/cluster-api-provider-nutanix/releases/download/${CAPX_VERSION}/cluster-template-clusterclass.yaml -configurations: - - kustomizeconfig.yaml - sortOptions: order: fifo -namePrefix: - labels: - includeSelectors: false pairs: diff --git a/hack/examples/overlays/clusterclasses/aws/kustomization.yaml.tmpl b/hack/examples/overlays/clusterclasses/default/aws/kustomization.yaml.tmpl similarity index 76% rename from hack/examples/overlays/clusterclasses/aws/kustomization.yaml.tmpl rename to hack/examples/overlays/clusterclasses/default/aws/kustomization.yaml.tmpl index ca79f3628..3b0a66b89 100644 --- a/hack/examples/overlays/clusterclasses/aws/kustomization.yaml.tmpl +++ b/hack/examples/overlays/clusterclasses/default/aws/kustomization.yaml.tmpl @@ -5,11 +5,16 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../../bases/aws/clusterclass +- ../../../../bases/aws/clusterclass sortOptions: order: fifo +namePrefix: aws- + +configurations: + - kustomizeconfig.yaml + patches: - target: kind: ClusterClass @@ -68,29 +73,29 @@ patches: # BEGIN CIS patches - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/cis-kubeadmcontrolplanetemplate.yaml + path: ../../../../patches/cis-kubeadmcontrolplanetemplate.yaml - target: kind: KubeadmConfigTemplate - path: ../../../patches/cis-kubeadmconfigtemplate.yaml + path: ../../../../patches/cis-kubeadmconfigtemplate.yaml - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/initialize-kubeadmcontrolplanetemplate-postkubeadmcommands.yaml + path: ../../../../patches/initialize-kubeadmcontrolplanetemplate-postkubeadmcommands.yaml - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/cis-kubeadmcontrolplanetemplate-kubelet-file-permissions.yaml + path: ../../../../patches/cis-kubeadmcontrolplanetemplate-kubelet-file-permissions.yaml - target: kind: KubeadmConfigTemplate - path: ../../../patches/initialize-kubeadmconfigtemplate-postkubeadmcommands.yaml + path: ../../../../patches/initialize-kubeadmconfigtemplate-postkubeadmcommands.yaml - target: kind: KubeadmConfigTemplate - path: ../../../patches/cis-kubeadmconfigtemplate-kubelet-file-permissions.yaml + path: ../../../../patches/cis-kubeadmconfigtemplate-kubelet-file-permissions.yaml - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/initialize-files.yaml + path: ../../../../patches/initialize-kubeadmcontrolplanetemplate-files.yaml - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/initialize-extravolumes.yaml + path: ../../../../patches/initialize-extravolumes.yaml - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/cis-admissionconfiguration.yaml + path: ../../../../patches/cis-admissionconfiguration.yaml # END CIS patches diff --git a/hack/examples/bases/aws/clusterclass/kustomizeconfig.yaml b/hack/examples/overlays/clusterclasses/default/aws/kustomizeconfig.yaml similarity index 100% rename from hack/examples/bases/aws/clusterclass/kustomizeconfig.yaml rename to hack/examples/overlays/clusterclasses/default/aws/kustomizeconfig.yaml diff --git a/hack/examples/overlays/clusterclasses/docker/kustomization.yaml.tmpl b/hack/examples/overlays/clusterclasses/default/docker/kustomization.yaml.tmpl similarity index 62% rename from hack/examples/overlays/clusterclasses/docker/kustomization.yaml.tmpl rename to hack/examples/overlays/clusterclasses/default/docker/kustomization.yaml.tmpl index 42e323b61..4aebb6fda 100644 --- a/hack/examples/overlays/clusterclasses/docker/kustomization.yaml.tmpl +++ b/hack/examples/overlays/clusterclasses/default/docker/kustomization.yaml.tmpl @@ -5,11 +5,16 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../../bases/docker/clusterclass +- ../../../../bases/docker/clusterclass sortOptions: order: fifo +namePrefix: docker- + +configurations: + - kustomizeconfig.yaml + patches: - target: kind: ClusterClass @@ -29,29 +34,29 @@ patches: # BEGIN CIS patches - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/cis-kubeadmcontrolplanetemplate.yaml + path: ../../../../patches/cis-kubeadmcontrolplanetemplate.yaml - target: kind: KubeadmConfigTemplate - path: ../../../patches/cis-kubeadmconfigtemplate.yaml + path: ../../../../patches/cis-kubeadmconfigtemplate.yaml - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/initialize-kubeadmcontrolplanetemplate-postkubeadmcommands.yaml + path: ../../../../patches/initialize-kubeadmcontrolplanetemplate-postkubeadmcommands.yaml - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/cis-kubeadmcontrolplanetemplate-kubelet-file-permissions.yaml + path: ../../../../patches/cis-kubeadmcontrolplanetemplate-kubelet-file-permissions.yaml - target: kind: KubeadmConfigTemplate - path: ../../../patches/initialize-kubeadmconfigtemplate-postkubeadmcommands.yaml + path: ../../../../patches/initialize-kubeadmconfigtemplate-postkubeadmcommands.yaml - target: kind: KubeadmConfigTemplate - path: ../../../patches/cis-kubeadmconfigtemplate-kubelet-file-permissions.yaml + path: ../../../../patches/cis-kubeadmconfigtemplate-kubelet-file-permissions.yaml - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/initialize-files.yaml + path: ../../../../patches/initialize-kubeadmcontrolplanetemplate-files.yaml - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/initialize-extravolumes.yaml + path: ../../../../patches/initialize-extravolumes.yaml - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/cis-admissionconfiguration.yaml + path: ../../../../patches/cis-admissionconfiguration.yaml # END CIS patches diff --git a/hack/examples/bases/docker/clusterclass/kustomizeconfig.yaml b/hack/examples/overlays/clusterclasses/default/docker/kustomizeconfig.yaml similarity index 100% rename from hack/examples/bases/docker/clusterclass/kustomizeconfig.yaml rename to hack/examples/overlays/clusterclasses/default/docker/kustomizeconfig.yaml diff --git a/hack/examples/overlays/clusterclasses/nutanix/kustomization.yaml.tmpl b/hack/examples/overlays/clusterclasses/default/nutanix/kustomization.yaml.tmpl similarity index 66% rename from hack/examples/overlays/clusterclasses/nutanix/kustomization.yaml.tmpl rename to hack/examples/overlays/clusterclasses/default/nutanix/kustomization.yaml.tmpl index 751829f48..a794d3b08 100644 --- a/hack/examples/overlays/clusterclasses/nutanix/kustomization.yaml.tmpl +++ b/hack/examples/overlays/clusterclasses/default/nutanix/kustomization.yaml.tmpl @@ -5,11 +5,16 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../../bases/nutanix/clusterclass +- ../../../../bases/nutanix/clusterclass sortOptions: order: fifo +namePrefix: nutanix- + +configurations: + - kustomizeconfig.yaml + patches: - target: kind: ClusterClass @@ -29,23 +34,23 @@ patches: # BEGIN CIS patches - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/cis-kubeadmcontrolplanetemplate.yaml + path: ../../../../patches/cis-kubeadmcontrolplanetemplate.yaml - target: kind: KubeadmConfigTemplate - path: ../../../patches/cis-kubeadmconfigtemplate.yaml + path: ../../../../patches/cis-kubeadmconfigtemplate.yaml - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/initialize-kubeadmcontrolplanetemplate-postkubeadmcommands.yaml + path: ../../../../patches/initialize-kubeadmcontrolplanetemplate-postkubeadmcommands.yaml - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/cis-kubeadmcontrolplanetemplate-kubelet-file-permissions.yaml + path: ../../../../patches/cis-kubeadmcontrolplanetemplate-kubelet-file-permissions.yaml - target: kind: KubeadmConfigTemplate - path: ../../../patches/cis-kubeadmconfigtemplate-kubelet-file-permissions.yaml + path: ../../../../patches/cis-kubeadmconfigtemplate-kubelet-file-permissions.yaml - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/initialize-extravolumes.yaml + path: ../../../../patches/initialize-extravolumes.yaml - target: kind: KubeadmControlPlaneTemplate - path: ../../../patches/cis-admissionconfiguration.yaml + path: ../../../../patches/cis-admissionconfiguration.yaml # END CIS patches diff --git a/hack/examples/bases/nutanix/clusterclass/kustomizeconfig.yaml b/hack/examples/overlays/clusterclasses/default/nutanix/kustomizeconfig.yaml similarity index 100% rename from hack/examples/bases/nutanix/clusterclass/kustomizeconfig.yaml rename to hack/examples/overlays/clusterclasses/default/nutanix/kustomizeconfig.yaml diff --git a/hack/examples/overlays/clusterclasses/sysext/aws/kustomization.yaml.tmpl b/hack/examples/overlays/clusterclasses/sysext/aws/kustomization.yaml.tmpl new file mode 100644 index 000000000..247224c7f --- /dev/null +++ b/hack/examples/overlays/clusterclasses/sysext/aws/kustomization.yaml.tmpl @@ -0,0 +1,110 @@ +# Copyright 2024 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- ../../../../bases/aws/clusterclass + +sortOptions: + order: fifo + +namePrefix: "aws-sysext-" + +configurations: + - kustomizeconfig.yaml + +patches: + - target: + kind: ClusterClass + patch: |- + - op: "add" + path: "/spec/patches" + value: + - name: "cluster-config" + external: + generateExtension: "awsclusterv4configpatch-gp.cluster-api-runtime-extensions-nutanix" + discoverVariablesExtension: "awsclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix" + - name: "worker-config" + external: + generateExtension: "awsworkerv4configpatch-gp.cluster-api-runtime-extensions-nutanix" + discoverVariablesExtension: "awsworkerconfigvars-dv.cluster-api-runtime-extensions-nutanix" + - name: identityRef + definitions: + - jsonPatches: + - op: add + path: /spec/template/spec/identityRef + value: + kind: AWSClusterControllerIdentity + name: default + selector: + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 + kind: AWSClusterTemplate + matchResources: + infrastructureCluster: true + description: AWSClusterStaticIdentity identityRef to use when creating the cluster + - target: + kind: AWSMachineTemplate + patch: |- + - op: "add" + path: "/spec/template/spec/sshKeyName" + value: "" + - target: + kind: AWSMachineTemplate + name: quick-start-worker-machinetemplate + patch: |- + - op: "add" + path: "/spec/template/spec/instanceType" + value: "PLACEHOLDER" + - target: + kind: AWSMachineTemplate + name: quick-start-control-plane + patch: |- + - op: "add" + path: "/spec/template/spec/instanceType" + value: "PLACEHOLDER" + - target: + kind: AWSMachineTemplate + patch: |- + - op: "remove" + path: "/spec/template/spec/iamInstanceProfile" + + # BEGIN CIS patches + - target: + kind: KubeadmControlPlaneTemplate + path: ../../../../patches/cis-kubeadmcontrolplanetemplate.yaml + - target: + kind: KubeadmConfigTemplate + path: ../../../../patches/cis-kubeadmconfigtemplate.yaml + - target: + kind: KubeadmControlPlaneTemplate + path: ../../../../patches/initialize-kubeadmcontrolplanetemplate-files.yaml + - target: + kind: KubeadmControlPlaneTemplate + path: ../../../../patches/initialize-extravolumes.yaml + - target: + kind: KubeadmControlPlaneTemplate + path: ../../../../patches/cis-admissionconfiguration.yaml + # END CIS patches + + # BEGIN sysext patches + - target: + kind: KubeadmConfigTemplate + path: ../../../../patches/initialize-kubeadmconfigtemplate-files.yaml + - target: + kind: KubeadmConfigTemplate + path: ../../../../patches/initialize-kubeadmconfigtemplate-prekubeadmcommands.yaml + - target: + kind: KubeadmConfigTemplate + path: ../../../../patches/kubeadmconfigtemplate-nkp-sysctl.yaml + - target: + kind: KubeadmControlPlaneTemplate + path: ../../../../patches/initialize-kubeadmcontrolplanetemplate-prekubeadmcommands.yaml + - target: + kind: KubeadmControlPlaneTemplate + path: ../../../../patches/kubeadmcontrolplanetemplate-nkp-sysctl.yaml + - target: + kind: ClusterClass + path: ../../../../patches/sysext-cc-patch.yaml + # END sysext patches diff --git a/hack/examples/overlays/clusterclasses/sysext/aws/kustomizeconfig.yaml b/hack/examples/overlays/clusterclasses/sysext/aws/kustomizeconfig.yaml new file mode 100644 index 000000000..a3f59598a --- /dev/null +++ b/hack/examples/overlays/clusterclasses/sysext/aws/kustomizeconfig.yaml @@ -0,0 +1,22 @@ +# Copyright 2024 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +nameReference: + - kind: AWSMachineTemplate + fieldSpecs: + - kind: ClusterClass + path: spec/controlPlane/machineInfrastructure/ref/name + - kind: ClusterClass + path: spec/workers/machineDeployments/template/infrastructure/ref/name + - kind: KubeadmControlPlaneTemplate + fieldSpecs: + - kind: ClusterClass + path: spec/controlPlane/ref/name + - kind: AWSClusterTemplate + fieldSpecs: + - kind: ClusterClass + path: spec/infrastructure/ref/name + - kind: KubeadmConfigTemplate + fieldSpecs: + - kind: ClusterClass + path: spec/workers/machineDeployments/template/bootstrap/ref/name diff --git a/hack/examples/overlays/clusterclasses/sysext/nutanix/kustomization.yaml.tmpl b/hack/examples/overlays/clusterclasses/sysext/nutanix/kustomization.yaml.tmpl new file mode 100644 index 000000000..b654c5f97 --- /dev/null +++ b/hack/examples/overlays/clusterclasses/sysext/nutanix/kustomization.yaml.tmpl @@ -0,0 +1,68 @@ +# Copyright 2024 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- ../../../../bases/nutanix/clusterclass + +sortOptions: + order: fifo + +namePrefix: "nutanix-sysext-" + +configurations: + - kustomizeconfig.yaml + +patches: + - target: + kind: ClusterClass + patch: |- + - op: "add" + path: "/spec/patches" + value: + - name: "cluster-config" + external: + generateExtension: "nutanixclusterv4configpatch-gp.cluster-api-runtime-extensions-nutanix" + discoverVariablesExtension: "nutanixclusterconfigvars-dv.cluster-api-runtime-extensions-nutanix" + - name: "worker-config" + external: + generateExtension: "nutanixworkerv4configpatch-gp.cluster-api-runtime-extensions-nutanix" + discoverVariablesExtension: "nutanixworkerconfigvars-dv.cluster-api-runtime-extensions-nutanix" + + # BEGIN CIS patches + - target: + kind: KubeadmControlPlaneTemplate + path: ../../../../patches/cis-kubeadmcontrolplanetemplate.yaml + - target: + kind: KubeadmConfigTemplate + path: ../../../../patches/cis-kubeadmconfigtemplate.yaml + - target: + kind: KubeadmControlPlaneTemplate + path: ../../../../patches/initialize-extravolumes.yaml + - target: + kind: KubeadmControlPlaneTemplate + path: ../../../../patches/cis-admissionconfiguration.yaml + # END CIS patches + + # BEGIN sysext patches + - target: + kind: KubeadmConfigTemplate + path: ../../../../patches/initialize-kubeadmconfigtemplate-files.yaml + # - target: + # kind: KubeadmConfigTemplate + # path: ../../../../patches/initialize-kubeadmconfigtemplate-prekubeadmcommands.yaml + - target: + kind: KubeadmConfigTemplate + path: ../../../../patches/kubeadmconfigtemplate-nkp-sysctl.yaml + # - target: + # kind: KubeadmControlPlaneTemplate + # path: ../../../../patches/initialize-kubeadmcontrolplanetemplate-prekubeadmcommands.yaml + - target: + kind: KubeadmControlPlaneTemplate + path: ../../../../patches/kubeadmcontrolplanetemplate-nkp-sysctl.yaml + - target: + kind: ClusterClass + path: ../../../../patches/sysext-cc-patch.yaml + # END sysext patches diff --git a/hack/examples/overlays/clusterclasses/sysext/nutanix/kustomizeconfig.yaml b/hack/examples/overlays/clusterclasses/sysext/nutanix/kustomizeconfig.yaml new file mode 100644 index 000000000..c9afc2bb3 --- /dev/null +++ b/hack/examples/overlays/clusterclasses/sysext/nutanix/kustomizeconfig.yaml @@ -0,0 +1,22 @@ +# Copyright 2024 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +nameReference: + - kind: NutanixMachineTemplate + fieldSpecs: + - kind: ClusterClass + path: spec/controlPlane/machineInfrastructure/ref/name + - kind: ClusterClass + path: spec/workers/machineDeployments/template/infrastructure/ref/name + - kind: KubeadmControlPlaneTemplate + fieldSpecs: + - kind: ClusterClass + path: spec/controlPlane/ref/name + - kind: NutanixClusterTemplate + fieldSpecs: + - kind: ClusterClass + path: spec/infrastructure/ref/name + - kind: KubeadmConfigTemplate + fieldSpecs: + - kind: ClusterClass + path: spec/workers/machineDeployments/template/bootstrap/ref/name diff --git a/hack/examples/overlays/clusters/docker/calico/crs/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/default/aws/calico/crs/kustomization.yaml.tmpl similarity index 59% rename from hack/examples/overlays/clusters/docker/calico/crs/kustomization.yaml.tmpl rename to hack/examples/overlays/clusters/default/aws/calico/crs/kustomization.yaml.tmpl index a2a628f0c..1cfb81a48 100644 --- a/hack/examples/overlays/clusters/docker/calico/crs/kustomization.yaml.tmpl +++ b/hack/examples/overlays/clusters/default/aws/calico/crs/kustomization.yaml.tmpl @@ -5,7 +5,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../../../../bases/docker/cluster +- ../../../../../../bases/aws/cluster sortOptions: order: fifo @@ -13,10 +13,10 @@ sortOptions: patches: - target: kind: Cluster - path: ../../../../../patches/calico.yaml + path: ../../../../../../patches/calico.yaml - target: kind: Cluster - path: ../../../../../patches/crs-strategy.yaml + path: ../../../../../../patches/crs-strategy.yaml - target: kind: Cluster - path: ../../../../../patches/docker/csi-crs-strategy.yaml + path: ../../../../../../patches/aws/crs-strategy.yaml diff --git a/hack/examples/overlays/clusters/aws/calico/helm-addon/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/default/aws/calico/helm-addon/kustomization.yaml.tmpl similarity index 72% rename from hack/examples/overlays/clusters/aws/calico/helm-addon/kustomization.yaml.tmpl rename to hack/examples/overlays/clusters/default/aws/calico/helm-addon/kustomization.yaml.tmpl index 4b2aac093..bb19d422b 100644 --- a/hack/examples/overlays/clusters/aws/calico/helm-addon/kustomization.yaml.tmpl +++ b/hack/examples/overlays/clusters/default/aws/calico/helm-addon/kustomization.yaml.tmpl @@ -5,7 +5,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../../../../bases/aws/cluster +- ../../../../../../bases/aws/cluster sortOptions: order: fifo @@ -13,4 +13,4 @@ sortOptions: patches: - target: kind: Cluster - path: ../../../../../patches/calico.yaml + path: ../../../../../../patches/calico.yaml diff --git a/hack/examples/overlays/clusters/aws/cilium/crs/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/default/aws/cilium/crs/kustomization.yaml.tmpl similarity index 59% rename from hack/examples/overlays/clusters/aws/cilium/crs/kustomization.yaml.tmpl rename to hack/examples/overlays/clusters/default/aws/cilium/crs/kustomization.yaml.tmpl index 9d1283968..34b444e8b 100644 --- a/hack/examples/overlays/clusters/aws/cilium/crs/kustomization.yaml.tmpl +++ b/hack/examples/overlays/clusters/default/aws/cilium/crs/kustomization.yaml.tmpl @@ -5,7 +5,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../../../../bases/aws/cluster +- ../../../../../../bases/aws/cluster sortOptions: order: fifo @@ -13,10 +13,10 @@ sortOptions: patches: - target: kind: Cluster - path: ../../../../../patches/cilium.yaml + path: ../../../../../../patches/cilium.yaml - target: kind: Cluster - path: ../../../../../patches/crs-strategy.yaml + path: ../../../../../../patches/crs-strategy.yaml - target: kind: Cluster - path: ../../../../../patches/aws/crs-strategy.yaml + path: ../../../../../../patches/aws/crs-strategy.yaml diff --git a/hack/examples/overlays/clusters/docker/calico/helm-addon/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/default/aws/cilium/helm-addon/kustomization.yaml.tmpl similarity index 72% rename from hack/examples/overlays/clusters/docker/calico/helm-addon/kustomization.yaml.tmpl rename to hack/examples/overlays/clusters/default/aws/cilium/helm-addon/kustomization.yaml.tmpl index 1537557f4..8e6a82b2f 100644 --- a/hack/examples/overlays/clusters/docker/calico/helm-addon/kustomization.yaml.tmpl +++ b/hack/examples/overlays/clusters/default/aws/cilium/helm-addon/kustomization.yaml.tmpl @@ -5,7 +5,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../../../../bases/docker/cluster +- ../../../../../../bases/aws/cluster sortOptions: order: fifo @@ -13,4 +13,4 @@ sortOptions: patches: - target: kind: Cluster - path: ../../../../../patches/calico.yaml + path: ../../../../../../patches/cilium.yaml diff --git a/hack/examples/overlays/clusters/docker/cilium/crs/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/default/docker/calico/crs/kustomization.yaml.tmpl similarity index 58% rename from hack/examples/overlays/clusters/docker/cilium/crs/kustomization.yaml.tmpl rename to hack/examples/overlays/clusters/default/docker/calico/crs/kustomization.yaml.tmpl index 6f784918d..c5522491e 100644 --- a/hack/examples/overlays/clusters/docker/cilium/crs/kustomization.yaml.tmpl +++ b/hack/examples/overlays/clusters/default/docker/calico/crs/kustomization.yaml.tmpl @@ -5,7 +5,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../../../../bases/docker/cluster +- ../../../../../../bases/docker/cluster sortOptions: order: fifo @@ -13,10 +13,10 @@ sortOptions: patches: - target: kind: Cluster - path: ../../../../../patches/cilium.yaml + path: ../../../../../../patches/calico.yaml - target: kind: Cluster - path: ../../../../../patches/crs-strategy.yaml + path: ../../../../../../patches/crs-strategy.yaml - target: kind: Cluster - path: ../../../../../patches/docker/csi-crs-strategy.yaml + path: ../../../../../../patches/docker/csi-crs-strategy.yaml diff --git a/hack/examples/overlays/clusters/aws/cilium/helm-addon/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/default/docker/calico/helm-addon/kustomization.yaml.tmpl similarity index 72% rename from hack/examples/overlays/clusters/aws/cilium/helm-addon/kustomization.yaml.tmpl rename to hack/examples/overlays/clusters/default/docker/calico/helm-addon/kustomization.yaml.tmpl index 485aa607f..c28f39515 100644 --- a/hack/examples/overlays/clusters/aws/cilium/helm-addon/kustomization.yaml.tmpl +++ b/hack/examples/overlays/clusters/default/docker/calico/helm-addon/kustomization.yaml.tmpl @@ -5,7 +5,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../../../../bases/aws/cluster +- ../../../../../../bases/docker/cluster sortOptions: order: fifo @@ -13,4 +13,4 @@ sortOptions: patches: - target: kind: Cluster - path: ../../../../../patches/cilium.yaml + path: ../../../../../../patches/calico.yaml diff --git a/hack/examples/overlays/clusters/aws/calico/crs/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/default/docker/cilium/crs/kustomization.yaml.tmpl similarity index 58% rename from hack/examples/overlays/clusters/aws/calico/crs/kustomization.yaml.tmpl rename to hack/examples/overlays/clusters/default/docker/cilium/crs/kustomization.yaml.tmpl index f1bb51112..bb3ff0b14 100644 --- a/hack/examples/overlays/clusters/aws/calico/crs/kustomization.yaml.tmpl +++ b/hack/examples/overlays/clusters/default/docker/cilium/crs/kustomization.yaml.tmpl @@ -5,7 +5,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../../../../bases/aws/cluster +- ../../../../../../bases/docker/cluster sortOptions: order: fifo @@ -13,10 +13,10 @@ sortOptions: patches: - target: kind: Cluster - path: ../../../../../patches/calico.yaml + path: ../../../../../../patches/cilium.yaml - target: kind: Cluster - path: ../../../../../patches/crs-strategy.yaml + path: ../../../../../../patches/crs-strategy.yaml - target: kind: Cluster - path: ../../../../../patches/aws/crs-strategy.yaml + path: ../../../../../../patches/docker/csi-crs-strategy.yaml diff --git a/hack/examples/overlays/clusters/docker/cilium/helm-addon/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/default/docker/cilium/helm-addon/kustomization.yaml.tmpl similarity index 72% rename from hack/examples/overlays/clusters/docker/cilium/helm-addon/kustomization.yaml.tmpl rename to hack/examples/overlays/clusters/default/docker/cilium/helm-addon/kustomization.yaml.tmpl index 5d25f9583..1860ff84d 100644 --- a/hack/examples/overlays/clusters/docker/cilium/helm-addon/kustomization.yaml.tmpl +++ b/hack/examples/overlays/clusters/default/docker/cilium/helm-addon/kustomization.yaml.tmpl @@ -5,7 +5,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../../../../bases/docker/cluster +- ../../../../../../bases/docker/cluster sortOptions: order: fifo @@ -13,4 +13,4 @@ sortOptions: patches: - target: kind: Cluster - path: ../../../../../patches/cilium.yaml + path: ../../../../../../patches/cilium.yaml diff --git a/hack/examples/overlays/clusters/nutanix/calico/crs/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/default/nutanix/calico/crs/kustomization.yaml.tmpl similarity index 64% rename from hack/examples/overlays/clusters/nutanix/calico/crs/kustomization.yaml.tmpl rename to hack/examples/overlays/clusters/default/nutanix/calico/crs/kustomization.yaml.tmpl index f7dd00af3..75107b665 100644 --- a/hack/examples/overlays/clusters/nutanix/calico/crs/kustomization.yaml.tmpl +++ b/hack/examples/overlays/clusters/default/nutanix/calico/crs/kustomization.yaml.tmpl @@ -5,7 +5,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../../../../bases/nutanix/cluster +- ../../../../../../bases/nutanix/cluster sortOptions: order: fifo @@ -13,7 +13,7 @@ sortOptions: patches: - target: kind: Cluster - path: ../../../../../patches/calico.yaml + path: ../../../../../../patches/calico.yaml - target: kind: Cluster - path: ../../../../../patches/crs-strategy.yaml + path: ../../../../../../patches/crs-strategy.yaml diff --git a/hack/examples/overlays/clusters/default/nutanix/calico/helm-addon/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/default/nutanix/calico/helm-addon/kustomization.yaml.tmpl new file mode 100644 index 000000000..7100baa00 --- /dev/null +++ b/hack/examples/overlays/clusters/default/nutanix/calico/helm-addon/kustomization.yaml.tmpl @@ -0,0 +1,16 @@ +# Copyright 2024 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- ../../../../../../bases/nutanix/cluster + +sortOptions: + order: fifo + +patches: + - target: + kind: Cluster + path: ../../../../../../patches/calico.yaml diff --git a/hack/examples/overlays/clusters/nutanix/cilium/crs/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/default/nutanix/cilium/crs/kustomization.yaml.tmpl similarity index 64% rename from hack/examples/overlays/clusters/nutanix/cilium/crs/kustomization.yaml.tmpl rename to hack/examples/overlays/clusters/default/nutanix/cilium/crs/kustomization.yaml.tmpl index 4d4053efb..200519120 100644 --- a/hack/examples/overlays/clusters/nutanix/cilium/crs/kustomization.yaml.tmpl +++ b/hack/examples/overlays/clusters/default/nutanix/cilium/crs/kustomization.yaml.tmpl @@ -5,7 +5,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: -- ../../../../../bases/nutanix/cluster +- ../../../../../../bases/nutanix/cluster sortOptions: order: fifo @@ -13,7 +13,7 @@ sortOptions: patches: - target: kind: Cluster - path: ../../../../../patches/cilium.yaml + path: ../../../../../../patches/cilium.yaml - target: kind: Cluster - path: ../../../../../patches/crs-strategy.yaml + path: ../../../../../../patches/crs-strategy.yaml diff --git a/hack/examples/overlays/clusters/default/nutanix/cilium/helm-addon/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/default/nutanix/cilium/helm-addon/kustomization.yaml.tmpl new file mode 100644 index 000000000..09dcc533d --- /dev/null +++ b/hack/examples/overlays/clusters/default/nutanix/cilium/helm-addon/kustomization.yaml.tmpl @@ -0,0 +1,16 @@ +# Copyright 2024 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- ../../../../../../bases/nutanix/cluster + +sortOptions: + order: fifo + +patches: + - target: + kind: Cluster + path: ../../../../../../patches/cilium.yaml diff --git a/hack/examples/overlays/clusters/nutanix/calico/helm-addon/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/nutanix/calico/helm-addon/kustomization.yaml.tmpl deleted file mode 100644 index 3e3041773..000000000 --- a/hack/examples/overlays/clusters/nutanix/calico/helm-addon/kustomization.yaml.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2024 Nutanix. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -resources: -- ../../../../../bases/nutanix/cluster - -sortOptions: - order: fifo - -patches: - - target: - kind: Cluster - path: ../../../../../patches/calico.yaml diff --git a/hack/examples/overlays/clusters/nutanix/cilium/helm-addon/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/nutanix/cilium/helm-addon/kustomization.yaml.tmpl deleted file mode 100644 index 6e697edca..000000000 --- a/hack/examples/overlays/clusters/nutanix/cilium/helm-addon/kustomization.yaml.tmpl +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright 2024 Nutanix. All rights reserved. -# SPDX-License-Identifier: Apache-2.0 - -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -resources: -- ../../../../../bases/nutanix/cluster - -sortOptions: - order: fifo - -patches: - - target: - kind: Cluster - path: ../../../../../patches/cilium.yaml diff --git a/hack/examples/overlays/clusters/sysext/aws/cilium/helm-addon/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/sysext/aws/cilium/helm-addon/kustomization.yaml.tmpl new file mode 100644 index 000000000..a7be355c0 --- /dev/null +++ b/hack/examples/overlays/clusters/sysext/aws/cilium/helm-addon/kustomization.yaml.tmpl @@ -0,0 +1,22 @@ +# Copyright 2024 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- ../../../../../../bases/aws/cluster + +sortOptions: + order: fifo + +patches: + - target: + kind: Cluster + path: ../../../../../../patches/cilium.yaml + - target: + kind: Cluster + patch: |- + - op: "add" + path: "/spec/topology/class" + value: "aws-sysext-quick-start" diff --git a/hack/examples/overlays/clusters/sysext/nutanix/cilium/helm-addon/kustomization.yaml.tmpl b/hack/examples/overlays/clusters/sysext/nutanix/cilium/helm-addon/kustomization.yaml.tmpl new file mode 100644 index 000000000..6df177fdf --- /dev/null +++ b/hack/examples/overlays/clusters/sysext/nutanix/cilium/helm-addon/kustomization.yaml.tmpl @@ -0,0 +1,22 @@ +# Copyright 2024 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: +- ../../../../../../bases/nutanix/cluster + +sortOptions: + order: fifo + +patches: + - target: + kind: Cluster + path: ../../../../../../patches/cilium.yaml + - target: + kind: Cluster + patch: |- + - op: "add" + path: "/spec/topology/class" + value: "nutanix-sysext-quick-start" diff --git a/hack/examples/patches/initialize-kubeadmconfigtemplate-files.yaml b/hack/examples/patches/initialize-kubeadmconfigtemplate-files.yaml new file mode 100644 index 000000000..16be5f3d4 --- /dev/null +++ b/hack/examples/patches/initialize-kubeadmconfigtemplate-files.yaml @@ -0,0 +1,6 @@ +# Copyright 2025 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +- op: add + path: /spec/template/spec/files + value: [] diff --git a/hack/examples/patches/initialize-kubeadmconfigtemplate-prekubeadmcommands.yaml b/hack/examples/patches/initialize-kubeadmconfigtemplate-prekubeadmcommands.yaml new file mode 100644 index 000000000..799e72aa1 --- /dev/null +++ b/hack/examples/patches/initialize-kubeadmconfigtemplate-prekubeadmcommands.yaml @@ -0,0 +1,6 @@ +# Copyright 2025 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +- op: add + path: /spec/template/spec/preKubeadmCommands + value: [] diff --git a/hack/examples/patches/initialize-files.yaml b/hack/examples/patches/initialize-kubeadmcontrolplanetemplate-files.yaml similarity index 100% rename from hack/examples/patches/initialize-files.yaml rename to hack/examples/patches/initialize-kubeadmcontrolplanetemplate-files.yaml diff --git a/hack/examples/patches/initialize-kubeadmcontrolplanetemplate-prekubeadmcommands.yaml b/hack/examples/patches/initialize-kubeadmcontrolplanetemplate-prekubeadmcommands.yaml new file mode 100644 index 000000000..58c3fb8ae --- /dev/null +++ b/hack/examples/patches/initialize-kubeadmcontrolplanetemplate-prekubeadmcommands.yaml @@ -0,0 +1,6 @@ +# Copyright 2025 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +- op: add + path: /spec/template/spec/kubeadmConfigSpec/preKubeadmCommands + value: [] diff --git a/hack/examples/patches/kubeadmconfigtemplate-nkp-sysctl.yaml b/hack/examples/patches/kubeadmconfigtemplate-nkp-sysctl.yaml new file mode 100644 index 000000000..ad0465db0 --- /dev/null +++ b/hack/examples/patches/kubeadmconfigtemplate-nkp-sysctl.yaml @@ -0,0 +1,13 @@ +# Copyright 2025 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +- op: "add" + path: "/spec/template/spec/files/-" + value: + content: | + net.ipv4.ip_forward=1 + path: /etc/sysctl.d/99-nkp.conf + permissions: "0644" +- op: "add" + path: "/spec/template/spec/preKubeadmCommands/-" + value: systemctl restart systemd-sysctl diff --git a/hack/examples/patches/kubeadmcontrolplanetemplate-nkp-sysctl.yaml b/hack/examples/patches/kubeadmcontrolplanetemplate-nkp-sysctl.yaml new file mode 100644 index 000000000..70c95c1b6 --- /dev/null +++ b/hack/examples/patches/kubeadmcontrolplanetemplate-nkp-sysctl.yaml @@ -0,0 +1,13 @@ +# Copyright 2025 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +- op: "add" + path: "/spec/template/spec/kubeadmConfigSpec/files/-" + value: + content: | + net.ipv4.ip_forward=1 + path: /etc/sysctl.d/99-nkp.conf + permissions: "0644" +- op: "add" + path: "/spec/template/spec/kubeadmConfigSpec/preKubeadmCommands/-" + value: systemctl restart systemd-sysctl diff --git a/hack/examples/patches/sysext-cc-patch.yaml b/hack/examples/patches/sysext-cc-patch.yaml new file mode 100644 index 000000000..67f49dc1d --- /dev/null +++ b/hack/examples/patches/sysext-cc-patch.yaml @@ -0,0 +1,47 @@ +# Copyright 2025 Nutanix. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +- op: "add" + path: "/spec/patches/0" + value: + name: sysexts + definitions: + - selector: + apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + kind: KubeadmConfigTemplate + matchResources: + machineDeploymentClass: + names: ["*"] + jsonPatches: + - op: add + path: /spec/template/spec/preKubeadmCommands/- + value: mkdir -p /var/lib/extensions/ + - op: add + path: /spec/template/spec/preKubeadmCommands/- + value: curl -L https://extensions.flatcar.org/extensions/containerd/containerd-2.1.3-x86-64.raw -o /var/lib/extensions/containerd.raw + - op: add + path: /spec/template/spec/preKubeadmCommands/- + valueFrom: + template: curl -L https://extensions.flatcar.org/extensions/kubernetes/kubernetes-{{ .builtin.cluster.topology.version }}-x86-64.raw -o /var/lib/extensions/kubernetes.raw + - op: add + path: /spec/template/spec/preKubeadmCommands/- + value: systemd-sysext merge + - selector: + apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + kind: KubeadmControlPlaneTemplate + matchResources: + controlPlane: true + jsonPatches: + - op: add + path: /spec/template/spec/kubeadmConfigSpec/preKubeadmCommands/- + value: mkdir -p /var/lib/extensions/ + - op: add + path: /spec/template/spec/kubeadmConfigSpec/preKubeadmCommands/- + value: curl -L https://extensions.flatcar.org/extensions/containerd/containerd-2.1.3-x86-64.raw -o /var/lib/extensions/containerd.raw + - op: add + path: /spec/template/spec/kubeadmConfigSpec/preKubeadmCommands/- + valueFrom: + template: curl -L https://extensions.flatcar.org/extensions/kubernetes/kubernetes-{{ .builtin.cluster.topology.version }}-x86-64.raw -o /var/lib/extensions/kubernetes.raw + - op: add + path: /spec/template/spec/kubeadmConfigSpec/preKubeadmCommands/- + value: systemd-sysext merge diff --git a/hack/examples/release/add-version-to-clusterclasses.sh b/hack/examples/release/add-version-to-clusterclasses.sh index 94134e769..56f3a235b 100755 --- a/hack/examples/release/add-version-to-clusterclasses.sh +++ b/hack/examples/release/add-version-to-clusterclasses.sh @@ -13,7 +13,7 @@ trap 'find "${SCRIPT_DIR}" -name kustomization.yaml -delete' EXIT export CAREN_RELEASE_VERSION="${1}" -for CC_TEMPLATE in "${SCRIPT_DIR}"/../../../charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/*.yaml; do +for CC_TEMPLATE in "${SCRIPT_DIR}"/../../../charts/cluster-api-runtime-extensions-nutanix/clusterclasses/**/*.yaml; do export CC_TEMPLATE envsubst -no-empty -no-unset -i "${SCRIPT_DIR}/kustomization.yaml.tmpl" -o "${SCRIPT_DIR}/kustomization.yaml" diff --git a/hack/examples/sync.sh b/hack/examples/sync.sh index cff626deb..b54d87485 100755 --- a/hack/examples/sync.sh +++ b/hack/examples/sync.sh @@ -19,24 +19,36 @@ export KUBE_VIP_CONTENT find "${SCRIPT_DIR}" -name kustomization.yaml.tmpl \ -exec sh -c 'k="${1}"; envsubst -no-unset -i "${k}" -o "${k%.tmpl}"' shell {} \; -readonly EXAMPLE_CLUSTERCLASSES_DIR=charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses +readonly EXAMPLE_CLUSTERCLASSES_DIR=charts/cluster-api-runtime-extensions-nutanix/clusterclasses mkdir -p "${EXAMPLE_CLUSTERCLASSES_DIR}" readonly EXAMPLE_CLUSTERS_DIR=examples/capi-quick-start mkdir -p "${EXAMPLE_CLUSTERS_DIR}" for provider in "aws" "docker" "nutanix"; do kustomize build --load-restrictor LoadRestrictionsNone \ - ./hack/examples/overlays/clusterclasses/"${provider}" >"${EXAMPLE_CLUSTERCLASSES_DIR}"/"${provider}"-cluster-class.yaml + ./hack/examples/overlays/clusterclasses/default/"${provider}" | + sed "s/ name: ${provider}-${provider}-/ name: ${provider}-/" >"${EXAMPLE_CLUSTERCLASSES_DIR}"/default/"${provider}"-cluster-class.yaml for cni in "calico" "cilium"; do for strategy in "helm-addon" "crs"; do kustomize build --load-restrictor LoadRestrictionsNone \ - ./hack/examples/overlays/clusters/"${provider}"/"${cni}"/"${strategy}" \ + ./hack/examples/overlays/clusters/default/"${provider}"/"${cni}"/"${strategy}" \ >"${EXAMPLE_CLUSTERS_DIR}/${provider}-cluster-${cni}-${strategy}.yaml" done done done +unset provider cni strategy + +for provider in "aws" "nutanix"; do + kustomize build --load-restrictor LoadRestrictionsNone \ + ./hack/examples/overlays/clusterclasses/sysext/"${provider}" | + sed "s/ name: ${provider}-sysext-${provider}-/ name: ${provider}-sysext-/" >"${EXAMPLE_CLUSTERCLASSES_DIR}"/experimental/"${provider}"-sysext-cluster-class.yaml + + kustomize build --load-restrictor LoadRestrictionsNone \ + ./hack/examples/overlays/clusters/sysext/"${provider}"/cilium/helm-addon >"${EXAMPLE_CLUSTERS_DIR}/${provider}-sysext-cluster-cilium-helm-addon.yaml" +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/hack/license-header.txt b/hack/license-header.txt index 4e4e1e778..66d477754 100644 --- a/hack/license-header.txt +++ b/hack/license-header.txt @@ -1,2 +1,2 @@ -Copyright 2024 Nutanix. All rights reserved. +Copyright 2025 Nutanix. All rights reserved. SPDX-License-Identifier: Apache-2.0 diff --git a/make/addons.mk b/make/addons.mk index 661841c43..fc8466fd6 100644 --- a/make/addons.mk +++ b/make/addons.mk @@ -92,4 +92,4 @@ list-images: -chart-directory=$(PWD)/charts/cluster-api-runtime-extensions-nutanix/ \ -helm-chart-configmap=$(PWD)/charts/cluster-api-runtime-extensions-nutanix/templates/helm-config.yaml \ -caren-version=$(CAREN_VERSION) \ - -additional-yaml-files=$(PWD)/charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/nutanix-cluster-class.yaml + -additional-yaml-files=$(PWD)/charts/cluster-api-runtime-extensions-nutanix/clusterclasses/default/nutanix-cluster-class.yaml diff --git a/make/dev.mk b/make/dev.mk index 57974e495..897e95d4f 100644 --- a/make/dev.mk +++ b/make/dev.mk @@ -22,6 +22,7 @@ dev.run-on-kind: --set-string image.tag=$(SNAPSHOT_VERSION) \ --set-string helmRepository.images.bundleInitializer.tag=$(SNAPSHOT_VERSION) \ --set extraArgs.feature-gates="$(CAREN_FEATURE_GATES)" \ + --set deployExperimentalClusterClasses=true \ --wait --wait-for-jobs kubectl rollout restart deployment cluster-api-runtime-extensions-nutanix kubectl rollout restart deployment helm-repository diff --git a/test/e2e/config/caren.yaml b/test/e2e/config/caren.yaml index 7ead5aa57..c8d0f2f28 100644 --- a/test/e2e/config/caren.yaml +++ b/test/e2e/config/caren.yaml @@ -58,7 +58,7 @@ providers: contract: v1beta1 files: - sourcePath: "../data/shared/v1beta1-capa/metadata.yaml" - - sourcePath: "../../../charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/aws-cluster-class.yaml" + - sourcePath: "../../../charts/cluster-api-runtime-extensions-nutanix/clusterclasses/default/aws-cluster-class.yaml" targetName: clusterclass-aws-quick-start.yaml - sourcePath: "../../../examples/capi-quick-start/aws-cluster-cilium-helm-addon.yaml" targetName: cluster-template-topology-cilium-helm-addon.yaml @@ -81,7 +81,7 @@ providers: contract: v1beta1 files: - sourcePath: "../data/shared/v1beta1/metadata.yaml" - - sourcePath: "../../../charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/docker-cluster-class.yaml" + - sourcePath: "../../../charts/cluster-api-runtime-extensions-nutanix/clusterclasses/default/docker-cluster-class.yaml" targetName: clusterclass-docker-quick-start.yaml - sourcePath: "../../../examples/capi-quick-start/docker-cluster-cilium-helm-addon.yaml" targetName: cluster-template-topology-cilium-helm-addon.yaml @@ -104,7 +104,7 @@ providers: contract: v1beta1 files: - sourcePath: "../data/shared/v1beta1-capx/metadata.yaml" - - sourcePath: "../../../charts/cluster-api-runtime-extensions-nutanix/defaultclusterclasses/nutanix-cluster-class.yaml" + - sourcePath: "../../../charts/cluster-api-runtime-extensions-nutanix/clusterclasses/default/nutanix-cluster-class.yaml" targetName: clusterclass-nutanix-quick-start.yaml - sourcePath: "../../../examples/capi-quick-start/nutanix-cluster-cilium-helm-addon.yaml" targetName: cluster-template-topology-cilium-helm-addon.yaml