├── docs ├── vscode-integration │ ├── settings.json │ ├── README.md │ └── tasks.json └── getting_started.md ├── pkg └── client │ ├── testdata │ ├── invalidTestConfigMissingCredentialRef.json │ ├── validTestConfig.json │ ├── validTestCredentials.json │ ├── validTestManagerCredentials.json │ ├── validTestCA.pem │ └── validTestManagerCA.pem │ ├── cache.go │ ├── cache_test.go │ └── status.go ├── config ├── prometheus │ ├── kustomization.yaml │ └── monitor.yaml ├── rbac │ ├── service_account.yaml │ ├── auth_proxy_client_clusterrole.yaml │ ├── role_binding.yaml │ ├── auth_proxy_role_binding.yaml │ ├── auth_proxy_service.yaml │ ├── leader_election_role_binding.yaml │ ├── auth_proxy_role.yaml │ ├── nutanixcluster_viewer_role.yaml │ ├── nutanixmachine_viewer_role.yaml │ ├── nutanixmachinetemplate_viewer_role.yaml │ ├── nutanixcluster_editor_role.yaml │ ├── nutanixmachine_editor_role.yaml │ ├── nutanixmachinetemplate_editor_role.yaml │ ├── leader_election_role.yaml │ ├── nutanixclustertemplate_viewer_role.yaml │ ├── nutanixclustertemplate_editor_role.yaml │ ├── kustomization.yaml │ └── role.yaml ├── manager │ ├── controller_manager_config.yaml │ └── kustomization.yaml ├── crd │ ├── patches │ │ ├── cainjection_in_nutanixclusters.yaml │ │ ├── cainjection_in_nutanixmachines.yaml │ │ ├── cainjection_in_nutanixclustertemplates.yaml │ │ ├── cainjection_in_nutanixmachinetemplates.yaml │ │ ├── webhook_in_nutanixclusters.yaml │ │ ├── webhook_in_nutanixmachines.yaml │ │ ├── webhook_in_nutanixclustertemplates.yaml │ │ └── webhook_in_nutanixmachinetemplates.yaml │ ├── kustomizeconfig.yaml │ └── kustomization.yaml └── default │ ├── manager_config_patch.yaml │ ├── manager_auth_proxy_patch.yaml │ └── kustomization.yaml ├── tools └── imagebuilder │ ├── terraform │ ├── outputs.tf │ ├── versions.tf │ ├── cloud-init.tpl │ ├── variables.tf │ └── scripts │ │ ├── build_os_image.sh │ │ └── install_prerequisites.sh │ ├── delete_image_build_vm.sh │ ├── create_image_build.sh │ └── README.md ├── templates ├── topology │ ├── ccm-patch.yaml │ ├── cm.yaml │ ├── kustomization.yaml │ ├── secret.yaml │ └── cluster-with-topology.yaml ├── base │ ├── cm.yaml │ ├── kustomization.yaml │ ├── secret.yaml │ ├── nutanix-cluster.yaml │ ├── cluster-without-topology.yaml │ ├── mhc.yaml │ ├── md.yaml │ ├── ccm-patch.yaml │ ├── kct.yaml │ └── nmt.yaml ├── csi │ ├── csi-patch.yaml │ ├── nutanix-csi.yaml │ ├── nutanix-csi-webhook.yaml │ ├── nutanix-csi-crs.yaml │ └── kustomization.yaml ├── csi3 │ ├── csi-patch.yaml │ ├── nutanix-csi.yaml │ ├── nutanix-csi-webhook.yaml │ ├── nutanix-csi-crs.yaml │ ├── kustomization.yaml │ └── nutanix-csi-secret.yaml ├── clusterclass │ ├── nct.yaml │ ├── kustomization.yaml │ ├── kct.yaml │ ├── nmt-cp.yaml │ └── nmt-md.yaml ├── ccm │ ├── kustomization.yaml │ ├── nutanix-ccm-crs.yaml │ └── nutanix-ccm-secret.yaml ├── failure-domains │ ├── kustomization.yaml │ ├── failure-domains-patch.yaml │ └── failure-domains.yaml ├── image-lookup │ ├── kustomization.yaml │ └── lookup-patch.yaml └── testdata │ ├── clusterctl-init.yaml │ ├── cluster-with-control-plane-endpoint.yaml │ ├── cluster-with-project-name.yaml │ ├── cluster-with-project-uuid.yaml │ ├── cluster-with-subnets.yaml │ ├── cluster-with-gpu.yaml │ ├── cluster-with-additional-categories.yaml │ └── cluster-with-failure-domain.yaml ├── test ├── e2e │ ├── data │ │ ├── infrastructure-nutanix │ │ │ ├── v1beta1 │ │ │ │ ├── base │ │ │ │ │ ├── cni-patch.yaml │ │ │ │ │ └── crs.yaml │ │ │ │ ├── cluster-template-clusterclass │ │ │ │ │ └── kustomization.yaml │ │ │ │ ├── no-kubeproxy │ │ │ │ │ ├── cluster-template-topology │ │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ ├── cluster-template │ │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ ├── cluster-template-csi │ │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ ├── cluster-template-no-nmt │ │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ ├── cluster-template-project │ │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ ├── cluster-template-no-secret │ │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ ├── cluster-template-upgrades │ │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ ├── cluster-template-kcp-scale-in │ │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ ├── cluster-template-failure-domains │ │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ ├── cluster-template-kcp-remediation │ │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ ├── cluster-template-md-remediation │ │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ ├── cluster-template-clusterclass │ │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ ├── cluster-template-no-nutanix-cluster │ │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ ├── cluster-template-additional-categories │ │ │ │ │ │ └── kustomization.yaml │ │ │ │ │ ├── no-kubeproxy.yaml │ │ │ │ │ └── no-kubeproxy-clusterclass.yaml │ │ │ │ ├── cluster-template-no-nutanix-cluster │ │ │ │ │ ├── nc.yaml │ │ │ │ │ └── kustomization.yaml │ │ │ │ ├── cluster-template-additional-categories │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ └── nmt.yaml │ │ │ │ ├── cluster-template │ │ │ │ │ └── kustomization.yaml │ │ │ │ ├── cluster-template-topology │ │ │ │ │ └── kustomization.yaml │ │ │ │ ├── cluster-template-kcp-scale-in │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ └── cluster-with-kcp.yaml │ │ │ │ ├── cluster-template-md-remediation │ │ │ │ │ ├── md.yaml │ │ │ │ │ ├── mhc.yaml │ │ │ │ │ └── kustomization.yaml │ │ │ │ ├── cluster-template-csi │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ ├── kct.yaml │ │ │ │ │ └── kcp.yaml │ │ │ │ ├── cluster-template-csi3 │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ ├── kct.yaml │ │ │ │ │ └── kcp.yaml │ │ │ │ ├── cluster-template-project │ │ │ │ │ ├── nmt.yaml │ │ │ │ │ └── kustomization.yaml │ │ │ │ ├── cluster-template-image-lookup │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ └── lookup-patch.yaml │ │ │ │ ├── cluster-template-failure-domains │ │ │ │ │ ├── failure-domain-nmt.yaml │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ └── failure-domain-patch.yaml │ │ │ │ ├── cluster-template-failure-domains-migration │ │ │ │ │ ├── failure-domain-nmt.yaml │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ └── failure-domain-patch.yaml │ │ │ │ ├── cluster-template-kcp-remediation │ │ │ │ │ ├── mhc.yaml │ │ │ │ │ └── kustomization.yaml │ │ │ │ ├── cluster-template-no-nmt │ │ │ │ │ └── kustomization.yaml │ │ │ │ ├── cluster-template-no-secret │ │ │ │ │ └── kustomization.yaml │ │ │ │ └── cluster-template-upgrades │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ └── nmt.yaml │ │ │ └── v1.7.1 │ │ │ │ ├── base │ │ │ │ ├── cni-patch.yaml │ │ │ │ ├── crs.yaml │ │ │ │ └── controlplane-vip.yaml │ │ │ │ └── cluster-template │ │ │ │ └── kustomization.yaml │ │ ├── kubetest │ │ │ └── conformance.yaml │ │ └── shared │ │ │ └── metadata.yaml │ ├── README.md │ ├── k8s_conformance_test.go │ ├── md_rollout_test.go │ ├── mhc_remediations_test.go │ ├── log │ │ └── log.go │ ├── clusterctl_move_test.go │ ├── clusterclass_changes_test.go │ ├── capx_quick_start_test.go │ └── cluster_topology_k8s_configs.go └── helpers │ └── prism-go-client │ └── v3 │ └── client.go ├── OWNERS ├── testdata └── kubeconfig ├── .envrc ├── .github ├── codecov.yml ├── workflows │ ├── calico-conformance-periodic.yaml │ ├── cilium-conformance-periodic.yaml │ ├── flannel-conformance-periodic.yaml │ ├── cilium-without-kubeproxy-conformance-periodic.yaml │ ├── conventional-pr-title.yaml │ ├── trivy-scan.yaml │ ├── codeql-analysis.yml │ └── release.yaml ├── ISSUE_TEMPLATE │ ├── feature_request.md │ └── bug_report.md ├── release.yaml ├── dependabot.yml └── PULL_REQUEST_TEMPLATE.md ├── .yamllint ├── clusterctl.yaml.tmpl ├── tilt-provider.json ├── hack ├── boilerplate.go.txt └── flakes │ ├── flake.lock │ └── flake.nix ├── .golangci.yaml ├── api └── v1beta1 │ ├── doc.go │ ├── nutanixcluster_conversion.go │ ├── nutanixmachine_conversion.go │ ├── nutanixmachinetemplate_conversion.go │ ├── groupversion_info.go │ ├── suite_test.go │ ├── nutanixclustertemplate_types.go │ ├── nutanix_types_test.go │ └── nutanixmachinetemplate_types.go ├── devbox.json ├── hooks └── build-finalize.sh ├── package ├── docker │ └── Dockerfile └── certs │ └── digicertca.crt ├── scripts ├── csi_nutanix_update.sh ├── ccm_nutanix_update.sh ├── csi3_nutanix_update.sh └── gen-self-cert.sh ├── metadata.yaml ├── PROJECT ├── controllers ├── options.go └── suite_test.go ├── CONTRIBUTING.md ├── make ├── test-cluster-without-topology.mk └── test-cluster-with-topology.mk └── .gitignore /docs/vscode-integration/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "go.testEnvFile": "${workspaceFolder}/.vscode/test.env" 3 | } 4 | -------------------------------------------------------------------------------- /pkg/client/testdata/invalidTestConfigMissingCredentialRef.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "cluster-endpoint", 3 | "port": 9440 4 | } -------------------------------------------------------------------------------- /config/prometheus/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - monitor.yaml 3 | apiVersion: kustomize.config.k8s.io/v1beta1 4 | kind: Kustomization 5 | -------------------------------------------------------------------------------- /config/rbac/service_account.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ServiceAccount 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | -------------------------------------------------------------------------------- /tools/imagebuilder/terraform/outputs.tf: -------------------------------------------------------------------------------- 1 | output "ip_address" { 2 | value = lookup(nutanix_virtual_machine.build_vm.nic_list.0.ip_endpoint_list[0], "ip") 3 | } 4 | -------------------------------------------------------------------------------- /templates/topology/ccm-patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cluster.x-k8s.io/v1beta1 2 | kind: Cluster 3 | metadata: 4 | labels: 5 | ccm: "nutanix" 6 | name: "${CLUSTER_NAME}" 7 | -------------------------------------------------------------------------------- /tools/imagebuilder/terraform/versions.tf: -------------------------------------------------------------------------------- 1 | terraform { 2 | required_providers { 3 | nutanix = { 4 | source = "nutanix/nutanix" 5 | version = "1.4.1" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /templates/base/cm.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: ${CLUSTER_NAME}-pc-trusted-ca-bundle 6 | binaryData: 7 | ca.crt: ${NUTANIX_ADDITIONAL_TRUST_BUNDLE=""} 8 | -------------------------------------------------------------------------------- /templates/csi/csi-patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cluster.x-k8s.io/v1beta1 2 | kind: Cluster 3 | metadata: 4 | labels: 5 | csi: "nutanix" 6 | name: "${CLUSTER_NAME}" 7 | namespace: "${NAMESPACE}" 8 | -------------------------------------------------------------------------------- /templates/csi3/csi-patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cluster.x-k8s.io/v1beta1 2 | kind: Cluster 3 | metadata: 4 | labels: 5 | csi: "nutanix" 6 | name: "${CLUSTER_NAME}" 7 | namespace: "${NAMESPACE}" 8 | -------------------------------------------------------------------------------- /templates/topology/cm.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: ${CLUSTER_NAME}-pc-trusted-ca-bundle 6 | binaryData: 7 | ca.crt: ${NUTANIX_ADDITIONAL_TRUST_BUNDLE=""} 8 | -------------------------------------------------------------------------------- /pkg/client/testdata/validTestConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "address": "cluster-endpoint", 3 | "port": 9440, 4 | "credentialRef": { 5 | "kind": "Secret", 6 | "name": "creds", 7 | "namespace": "test" 8 | } 9 | } -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/base/cni-patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cluster.x-k8s.io/v1beta1 2 | kind: Cluster 3 | metadata: 4 | labels: 5 | cni: ${CLUSTER_NAME}-crs-cni 6 | name: "${CLUSTER_NAME}" 7 | -------------------------------------------------------------------------------- /OWNERS: -------------------------------------------------------------------------------- 1 | reviewers: 2 | - adiantum 3 | - deepakm-ntnx 4 | - thunderboltsid 5 | - tuxtof 6 | - yannickstruyf3 7 | approvers: 8 | - adiantum 9 | - deepakm-ntnx 10 | - thunderboltsid 11 | - tuxtof 12 | - yannickstruyf3 13 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-clusterclass/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../../../../../templates/clusterclass/ 5 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-topology/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../cluster-template-topology/ 5 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-no-nutanix-cluster/nc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 2 | kind: NutanixCluster 3 | metadata: 4 | name: "${CLUSTER_NAME}" 5 | $patch: delete 6 | -------------------------------------------------------------------------------- /test/e2e/data/kubetest/conformance.yaml: -------------------------------------------------------------------------------- 1 | ginkgo.focus: \[Conformance\] 2 | ginkgo.skip: \[Serial\] 3 | disable-log-dump: true 4 | ginkgo.show-node-events: true 5 | ginkgo.flake-attempts: 3 6 | ginkgo.trace: true 7 | ginkgo.v: true 8 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_client_clusterrole.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: metrics-reader 5 | rules: 6 | - nonResourceURLs: 7 | - "/metrics" 8 | verbs: 9 | - get 10 | -------------------------------------------------------------------------------- /pkg/client/testdata/validTestCredentials.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "type": "basic_auth", 4 | "data": { 5 | "prismCentral":{ 6 | "username": "user", 7 | "password": "password" 8 | } 9 | } 10 | } 11 | ] -------------------------------------------------------------------------------- /templates/clusterclass/nct.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 2 | kind: NutanixClusterTemplate 3 | metadata: 4 | name: nutanix-quick-start-nct 5 | spec: 6 | template: 7 | spec: 8 | failureDomains: [] 9 | -------------------------------------------------------------------------------- /templates/csi/nutanix-csi.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: nutanix-csi 6 | data: 7 | ns.yaml: |- 8 | apiVersion: v1 9 | kind: Namespace 10 | metadata: 11 | name: ntnx-system 12 | -------------------------------------------------------------------------------- /templates/csi3/nutanix-csi.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: ConfigMap 4 | metadata: 5 | name: nutanix-csi 6 | data: 7 | ns.yaml: |- 8 | apiVersion: v1 9 | kind: Namespace 10 | metadata: 11 | name: ntnx-system 12 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1.7.1/base/cni-patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cluster.x-k8s.io/v1beta1 2 | kind: Cluster 3 | metadata: 4 | labels: 5 | cni: ${CLUSTER_NAME}-crs-cni 6 | name: "${CLUSTER_NAME}" 7 | namespace: "${NAMESPACE}" 8 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-additional-categories/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../cluster-template 5 | patches: 6 | - path: ./nmt.yaml 7 | -------------------------------------------------------------------------------- /pkg/client/testdata/validTestManagerCredentials.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "type": "basic_auth", 4 | "data": { 5 | "prismCentral":{ 6 | "username": "admin", 7 | "password": "adminpassword" 8 | } 9 | } 10 | } 11 | ] -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../cluster-template/ 5 | patches: 6 | - path: ../no-kubeproxy.yaml 7 | -------------------------------------------------------------------------------- /templates/clusterclass/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - ./nct.yaml 6 | - ./clusterclass.yaml 7 | - ./nmt-cp.yaml 8 | - ./nmt-md.yaml 9 | - ./kcpt.yaml 10 | - ./kct.yaml 11 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-csi/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../cluster-template-csi/ 5 | patches: 6 | - path: ../no-kubeproxy.yaml 7 | -------------------------------------------------------------------------------- /templates/topology/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | resources: 5 | - ../ccm 6 | - ./cm.yaml 7 | - ./cluster-with-topology.yaml 8 | - ./secret.yaml 9 | 10 | patches: 11 | - path: ./ccm-patch.yaml 12 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-no-nmt/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../cluster-template-no-nmt/ 5 | patches: 6 | - path: ../no-kubeproxy.yaml 7 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-project/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../cluster-template-project/ 5 | patches: 6 | - path: ../no-kubeproxy.yaml 7 | -------------------------------------------------------------------------------- /testdata/kubeconfig: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | clusters: 3 | - cluster: 4 | server: https://example.com:6443 5 | name: test 6 | contexts: 7 | - context: 8 | cluster: test 9 | name: test 10 | current-context: test 11 | kind: Config 12 | preferences: {} 13 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../../../../../templates/base/ 5 | - ../base/crs.yaml 6 | patches: 7 | - path: ../base/cni-patch.yaml 8 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-no-secret/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../cluster-template-no-secret/ 5 | patches: 6 | - path: ../no-kubeproxy.yaml 7 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-upgrades/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../cluster-template-upgrades/ 5 | patches: 6 | - path: ../no-kubeproxy.yaml 7 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-kcp-scale-in/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../cluster-template-kcp-scale-in/ 5 | patches: 6 | - path: ../no-kubeproxy.yaml 7 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-failure-domains/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../cluster-template-failure-domains/ 5 | patches: 6 | - path: ../no-kubeproxy.yaml 7 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-kcp-remediation/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../cluster-template-kcp-remediation/ 5 | patches: 6 | - path: ../no-kubeproxy.yaml 7 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-md-remediation/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../cluster-template-md-remediation/ 5 | patches: 6 | - path: ../no-kubeproxy.yaml 7 | -------------------------------------------------------------------------------- /.envrc: -------------------------------------------------------------------------------- 1 | # Automatically sets up your devbox environment whenever you cd into this 2 | # directory via our direnv integration: 3 | 4 | eval "$(devbox generate direnv --print-envrc)" 5 | 6 | # check out https://www.jetpack.io/devbox/docs/ide_configuration/direnv/ 7 | # for more details 8 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-topology/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../../../../../templates/topology/ 5 | - ../base/crs.yaml 6 | patches: 7 | - path: ../base/cni-patch.yaml 8 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-clusterclass/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../cluster-template-clusterclass/ 5 | patches: 6 | - path: ../no-kubeproxy-clusterclass.yaml 7 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-no-nutanix-cluster/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../cluster-template-no-nutanix-cluster/ 5 | patches: 6 | - path: ../no-kubeproxy.yaml 7 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-kcp-scale-in/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../cluster-template-upgrades 5 | patches: 6 | - path: ../base/cni-patch.yaml 7 | - path: ./cluster-with-kcp.yaml 8 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/cluster-template-additional-categories/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../cluster-template-additional-categories/ 5 | patches: 6 | - path: ../no-kubeproxy.yaml 7 | -------------------------------------------------------------------------------- /templates/ccm/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | configMapGenerator: 5 | - behavior: merge 6 | files: 7 | - nutanix-ccm.yaml 8 | name: nutanix-ccm 9 | 10 | resources: 11 | - ./nutanix-ccm-crs.yaml 12 | - ./nutanix-ccm-secret.yaml 13 | -------------------------------------------------------------------------------- /templates/csi/nutanix-csi-webhook.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Secret 4 | metadata: 5 | name: csi-snapshot-validation-webhook-cert 6 | namespace: ntnx-system 7 | type: kubernetes.io/tls 8 | data: 9 | ca.crt: ${WEBHOOK_CA} 10 | tls.key: ${WEBHOOK_KEY} 11 | tls.crt: ${WEBHOOK_CERT} 12 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-md-remediation/md.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cluster.x-k8s.io/v1beta1 2 | kind: MachineDeployment 3 | metadata: 4 | name: "${CLUSTER_NAME}-wmd" 5 | spec: 6 | template: 7 | metadata: 8 | labels: 9 | "e2e.remediation.label": "" 10 | -------------------------------------------------------------------------------- /templates/csi3/nutanix-csi-webhook.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Secret 4 | metadata: 5 | name: csi-snapshot-validation-webhook-cert 6 | namespace: ntnx-system 7 | type: kubernetes.io/tls 8 | data: 9 | ca.crt: ${WEBHOOK_CA} 10 | tls.key: ${WEBHOOK_KEY} 11 | tls.crt: ${WEBHOOK_CERT} 12 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-kcp-scale-in/cluster-with-kcp.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: controlplane.cluster.x-k8s.io/v1beta1 3 | kind: KubeadmControlPlane 4 | metadata: 5 | name: "${CLUSTER_NAME}-kcp" 6 | spec: 7 | rolloutStrategy: 8 | rollingUpdate: 9 | maxSurge: 0 10 | -------------------------------------------------------------------------------- /templates/csi/nutanix-csi-crs.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: addons.cluster.x-k8s.io/v1beta1 2 | kind: ClusterResourceSet 3 | metadata: 4 | name: nutanix-csi-crs 5 | spec: 6 | clusterSelector: 7 | matchLabels: 8 | csi: nutanix 9 | resources: 10 | - kind: ConfigMap 11 | name: nutanix-csi 12 | strategy: ApplyOnce 13 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-csi/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../../../../../templates/csi/ 5 | - ../base/crs.yaml 6 | patches: 7 | - path: ../base/cni-patch.yaml 8 | - path: ./kcp.yaml 9 | - path: ./kct.yaml 10 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-csi3/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../../../../../templates/csi3/ 5 | - ../base/crs.yaml 6 | patches: 7 | - path: ../base/cni-patch.yaml 8 | - path: ./kcp.yaml 9 | - path: ./kct.yaml 10 | -------------------------------------------------------------------------------- /.github/codecov.yml: -------------------------------------------------------------------------------- 1 | codecov: 2 | require_ci_to_pass: true 3 | 4 | ignore: 5 | # ignore all generated controller-gen and conversion-gen code 6 | - "**/zz_generated.*.go" 7 | 8 | coverage: 9 | precision: 2 10 | round: down 11 | range: 75..100 12 | status: 13 | patch: 14 | default: 15 | target: 75% 16 | -------------------------------------------------------------------------------- /tools/imagebuilder/terraform/cloud-init.tpl: -------------------------------------------------------------------------------- 1 | #cloud-config 2 | 3 | # set the hostname 4 | fqdn: ${vmname} 5 | 6 | #cloud-config 7 | users: 8 | - name: ${username} 9 | sudo: ALL=(ALL) NOPASSWD:ALL 10 | shell: /bin/bash 11 | ssh-authorized-keys: 12 | - ${public_key} 13 | 14 | cloud_final_modules: 15 | - [ssh, always] -------------------------------------------------------------------------------- /config/manager/controller_manager_config.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: controller-runtime.sigs.k8s.io/v1alpha1 2 | kind: ControllerManagerConfig 3 | health: 4 | healthProbeBindAddress: :8081 5 | metrics: 6 | bindAddress: 127.0.0.1:8080 7 | webhook: 8 | port: 9443 9 | leaderElection: 10 | leaderElect: true 11 | resourceName: f265110d.cluster.x-k8s.io 12 | -------------------------------------------------------------------------------- /config/rbac/role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: manager-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: manager-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: controller-manager 12 | namespace: system 13 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-project/nmt.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 3 | kind: NutanixMachineTemplate 4 | metadata: 5 | name: "${CLUSTER_NAME}-mt-0" 6 | spec: 7 | template: 8 | spec: 9 | project: 10 | type: name 11 | name: "${NUTANIX_PROJECT_NAME}" 12 | -------------------------------------------------------------------------------- /.yamllint: -------------------------------------------------------------------------------- 1 | extends: default 2 | 3 | rules: 4 | indentation: disable 5 | document-start: disable 6 | comments: disable 7 | line-length: disable 8 | 9 | ignore: | 10 | templates/csi/nutanix-csi-snapshot.yaml 11 | templates/csi/nutanix-csi-storage.yaml 12 | templates/csi3/nutanix-csi-snapshot.yaml 13 | templates/csi3/nutanix-csi-storage.yaml 14 | -------------------------------------------------------------------------------- /clusterctl.yaml.tmpl: -------------------------------------------------------------------------------- 1 | CLUSTERCTL_LOG_LEVEL: 10 2 | EXP_CLUSTER_RESOURCE_SET: "true" 3 | CLUSTER_TOPOLOGY: "true" 4 | 5 | providers: 6 | # add a custom provider 7 | - name: "nutanix" 8 | url: "file://${HOME}/.cluster-api/overrides/infrastructure-nutanix/${LOCAL_PROVIDER_VERSION}/infrastructure-components.yaml" 9 | type: "InfrastructureProvider" 10 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRoleBinding 3 | metadata: 4 | name: proxy-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: ClusterRole 8 | name: proxy-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: controller-manager 12 | namespace: system 13 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_service.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | labels: 5 | control-plane: controller-manager 6 | name: controller-manager-metrics-service 7 | namespace: system 8 | spec: 9 | ports: 10 | - name: https 11 | port: 8443 12 | targetPort: https 13 | selector: 14 | control-plane: controller-manager 15 | -------------------------------------------------------------------------------- /docs/getting_started.md: -------------------------------------------------------------------------------- 1 | # Getting Started 2 | 3 | The Cluster API Provider Nutanix Cloud Infrastructure (CAPX) documentation has been moved to [opendocs.nutanix.com](https://opendocs.nutanix.com/). Refer to [https://opendocs.nutanix.com/capx/latest/getting_started](https://opendocs.nutanix.com/capx/latest/getting_started/) for the latest version of the getting started guide. -------------------------------------------------------------------------------- /config/rbac/leader_election_role_binding.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: RoleBinding 3 | metadata: 4 | name: leader-election-rolebinding 5 | roleRef: 6 | apiGroup: rbac.authorization.k8s.io 7 | kind: Role 8 | name: leader-election-role 9 | subjects: 10 | - kind: ServiceAccount 11 | name: controller-manager 12 | namespace: system 13 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_nutanixclusters.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | annotations: 6 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 7 | name: nutanixclusters.infrastructure.cluster.x-k8s.io 8 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_nutanixmachines.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | annotations: 6 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 7 | name: nutanixmachines.infrastructure.cluster.x-k8s.io 8 | -------------------------------------------------------------------------------- /config/rbac/auth_proxy_role.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: rbac.authorization.k8s.io/v1 2 | kind: ClusterRole 3 | metadata: 4 | name: proxy-role 5 | rules: 6 | - apiGroups: 7 | - authentication.k8s.io 8 | resources: 9 | - tokenreviews 10 | verbs: 11 | - create 12 | - apiGroups: 13 | - authorization.k8s.io 14 | resources: 15 | - subjectaccessreviews 16 | verbs: 17 | - create 18 | -------------------------------------------------------------------------------- /templates/csi3/nutanix-csi-crs.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: addons.cluster.x-k8s.io/v1beta1 2 | kind: ClusterResourceSet 3 | metadata: 4 | name: nutanix-csi-crs 5 | spec: 6 | clusterSelector: 7 | matchLabels: 8 | csi: nutanix 9 | resources: 10 | - kind: ConfigMap 11 | name: nutanix-csi 12 | - kind: Secret 13 | name: nutanix-csi-secret 14 | strategy: ApplyOnce 15 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1.7.1/cluster-template/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - https://github.com/nutanix-cloud-native/cluster-api-provider-nutanix/releases/download/v1.7.1/cluster-template.yaml 5 | - ../base/crs.yaml 6 | patches: 7 | - path: ../base/cni-patch.yaml 8 | - path: ../base/controlplane-vip.yaml 9 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_nutanixclustertemplates.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | annotations: 6 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 7 | name: nutanixclustertemplates.infrastructure.cluster.x-k8s.io 8 | -------------------------------------------------------------------------------- /config/crd/patches/cainjection_in_nutanixmachinetemplates.yaml: -------------------------------------------------------------------------------- 1 | # The following patch adds a directive for certmanager to inject CA into the CRD 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | annotations: 6 | cert-manager.io/inject-ca-from: $(CERTIFICATE_NAMESPACE)/$(CERTIFICATE_NAME) 7 | name: nutanixmachinetemplates.infrastructure.cluster.x-k8s.io 8 | -------------------------------------------------------------------------------- /templates/base/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | namespace: ${NAMESPACE} 5 | 6 | 7 | resources: 8 | - ../ccm 9 | - ./cm.yaml 10 | - ./secret.yaml 11 | - ./nutanix-cluster.yaml 12 | - ./cluster-without-topology.yaml 13 | - ./kcp.yaml 14 | - ./kct.yaml 15 | - ./nmt.yaml 16 | - ./md.yaml 17 | - ./mhc.yaml 18 | patches: 19 | - path: ./ccm-patch.yaml 20 | -------------------------------------------------------------------------------- /templates/base/secret.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Secret 4 | metadata: 5 | name: "${CLUSTER_NAME}" 6 | stringData: 7 | credentials: | 8 | [ 9 | { 10 | "type": "basic_auth", 11 | "data": { 12 | "prismCentral":{ 13 | "username": "${NUTANIX_USER}", 14 | "password": "${NUTANIX_PASSWORD}" 15 | } 16 | } 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /templates/csi/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | configMapGenerator: 5 | - behavior: merge 6 | files: 7 | - nutanix-csi-storage.yaml 8 | - nutanix-csi-snapshot.yaml 9 | - nutanix-csi-webhook.yaml 10 | name: nutanix-csi 11 | 12 | resources: 13 | - ../base/ 14 | - nutanix-csi.yaml 15 | - nutanix-csi-crs.yaml 16 | 17 | patches: 18 | - path: csi-patch.yaml 19 | -------------------------------------------------------------------------------- /templates/topology/secret.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: v1 3 | kind: Secret 4 | metadata: 5 | name: "${CLUSTER_NAME}-pc-creds" 6 | stringData: 7 | credentials: | 8 | [ 9 | { 10 | "type": "basic_auth", 11 | "data": { 12 | "prismCentral":{ 13 | "username": "${NUTANIX_USER}", 14 | "password": "${NUTANIX_PASSWORD}" 15 | } 16 | } 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /.github/workflows/calico-conformance-periodic.yaml: -------------------------------------------------------------------------------- 1 | name: Periodic Conformance Test with Calico 2 | on: 3 | schedule: 4 | - cron: "0 6 * * *" # 6 AM 5 | jobs: 6 | e2e: 7 | uses: ./.github/workflows/e2e.yaml 8 | with: 9 | e2e-labels: "conformance || cluster-upgrade-conformance" 10 | make-target: "test-e2e-calico" 11 | secrets: inherit 12 | permissions: 13 | contents: read 14 | checks: write 15 | -------------------------------------------------------------------------------- /tilt-provider.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nutanix", 3 | "config": { 4 | "image": "ghcr.io/nutanix-cloud-native/cluster-api-provider-nutanix/controller", 5 | "live_reload_deps": [ 6 | "main.go", 7 | "go.mod", 8 | "go.sum", 9 | "api", 10 | "controllers", 11 | "pkg", 12 | "config" 13 | ], 14 | "label": "CAPX" 15 | } 16 | } -------------------------------------------------------------------------------- /.github/workflows/cilium-conformance-periodic.yaml: -------------------------------------------------------------------------------- 1 | name: Periodic Conformance Test with Cilium 2 | on: 3 | schedule: 4 | - cron: "0 0 * * *" # Midnight 5 | jobs: 6 | e2e: 7 | uses: ./.github/workflows/e2e.yaml 8 | with: 9 | e2e-labels: "conformance || cluster-upgrade-conformance" 10 | make-target: "test-e2e-cilium" 11 | secrets: inherit 12 | permissions: 13 | contents: read 14 | checks: write 15 | -------------------------------------------------------------------------------- /.github/workflows/flannel-conformance-periodic.yaml: -------------------------------------------------------------------------------- 1 | name: Periodic Conformance Test with Flannel 2 | on: 3 | schedule: 4 | - cron: "0 12 * * *" # Noon 5 | jobs: 6 | e2e: 7 | uses: ./.github/workflows/e2e.yaml 8 | with: 9 | e2e-labels: "conformance || cluster-upgrade-conformance" 10 | make-target: "test-e2e-flannel" 11 | secrets: inherit 12 | permissions: 13 | contents: read 14 | checks: write 15 | -------------------------------------------------------------------------------- /config/manager/kustomization.yaml: -------------------------------------------------------------------------------- 1 | resources: 2 | - manager.yaml 3 | 4 | generatorOptions: 5 | disableNameSuffixHash: true 6 | 7 | configMapGenerator: 8 | - files: 9 | - controller_manager_config.yaml 10 | name: manager-config 11 | apiVersion: kustomize.config.k8s.io/v1beta1 12 | kind: Kustomization 13 | 14 | images: 15 | - name: controller 16 | newName: ghcr.io/nutanix-cloud-native/cluster-api-provider-nutanix/controller 17 | newTag: latest 18 | -------------------------------------------------------------------------------- /templates/failure-domains/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | 4 | namespace: ${NAMESPACE} 5 | 6 | resources: 7 | - ../base/ 8 | - ./failure-domains.yaml 9 | 10 | patches: 11 | - path: ./failure-domains-patch.yaml 12 | - target: 13 | kind: NutanixMachineTemplate 14 | patch: |- 15 | - op: "remove" 16 | path: "/spec/template/spec/cluster" 17 | - op: "remove" 18 | path: "/spec/template/spec/subnet" 19 | -------------------------------------------------------------------------------- /.github/workflows/cilium-without-kubeproxy-conformance-periodic.yaml: -------------------------------------------------------------------------------- 1 | name: Periodic Conformance Test with Cilium without KubeProxy 2 | on: 3 | schedule: 4 | - cron: "0 18 * * *" # 6 PM 5 | jobs: 6 | e2e: 7 | uses: ./.github/workflows/e2e.yaml 8 | with: 9 | e2e-labels: "conformance || cluster-upgrade-conformance" 10 | make-target: "test-e2e-cilium-no-kubeproxy" 11 | secrets: inherit 12 | permissions: 13 | contents: read 14 | checks: write 15 | -------------------------------------------------------------------------------- /templates/image-lookup/kustomization.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Nutanix. All rights reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | apiVersion: kustomize.config.k8s.io/v1beta1 5 | kind: Kustomization 6 | 7 | metadata: 8 | name: nutanix-image-lookup-kustomize 9 | 10 | resources: 11 | - ../base/ 12 | 13 | patches: 14 | - path: lookup-patch.yaml 15 | - target: 16 | kind: NutanixMachineTemplate 17 | patch: |- 18 | - op: "remove" 19 | path: "/spec/template/spec/image" 20 | -------------------------------------------------------------------------------- /config/rbac/nutanixcluster_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view nutanixclusters. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: nutanixcluster-viewer-role 6 | rules: 7 | - apiGroups: 8 | - infrastructure.cluster.x-k8s.io 9 | resources: 10 | - nutanixclusters 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - infrastructure.cluster.x-k8s.io 17 | resources: 18 | - nutanixclusters/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /config/rbac/nutanixmachine_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view nutanixmachines. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: nutanixmachine-viewer-role 6 | rules: 7 | - apiGroups: 8 | - infrastructure.cluster.x-k8s.io 9 | resources: 10 | - nutanixmachines 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - infrastructure.cluster.x-k8s.io 17 | resources: 18 | - nutanixmachines/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /templates/testdata/clusterctl-init.yaml: -------------------------------------------------------------------------------- 1 | CLUSTERCTL_LOG_LEVEL: 10 2 | EXP_CLUSTER_RESOURCE_SET: 'true' 3 | CLUSTER_TOPOLOGY: 'true' 4 | NUTANIX_ENDPOINT: '' # IP or FQDN of Prism Central 5 | NUTANIX_USER: '' # Prism Central user 6 | NUTANIX_PASSWORD: '' # Prism Central password 7 | providers: 8 | # add a custom provider 9 | - name: "nutanix" 10 | url: "file://${HOME}/.cluster-api/overrides/infrastructure-nutanix/${LOCAL_PROVIDER_VERSION}/infrastructure-components.yaml" 11 | type: "InfrastructureProvider" 12 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1.7.1/base/crs.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: "cni-${CLUSTER_NAME}-crs-cni" 5 | data: ${CNI_RESOURCES} 6 | --- 7 | apiVersion: addons.cluster.x-k8s.io/v1beta1 8 | kind: ClusterResourceSet 9 | metadata: 10 | name: "${CLUSTER_NAME}-crs-cni" 11 | spec: 12 | strategy: ApplyOnce 13 | clusterSelector: 14 | matchLabels: 15 | cni: "${CLUSTER_NAME}-crs-cni" 16 | resources: 17 | - name: "cni-${CLUSTER_NAME}-crs-cni" 18 | kind: ConfigMap 19 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/base/crs.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: ConfigMap 3 | metadata: 4 | name: "cni-${CLUSTER_NAME}-crs-cni" 5 | data: ${CNI_RESOURCES} 6 | --- 7 | apiVersion: addons.cluster.x-k8s.io/v1beta1 8 | kind: ClusterResourceSet 9 | metadata: 10 | name: "${CLUSTER_NAME}-crs-cni" 11 | spec: 12 | strategy: ApplyOnce 13 | clusterSelector: 14 | matchLabels: 15 | cni: "${CLUSTER_NAME}-crs-cni" 16 | resources: 17 | - name: "cni-${CLUSTER_NAME}-crs-cni" 18 | kind: ConfigMap 19 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_nutanixclusters.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables a conversion webhook for the CRD 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | name: nutanixclusters.infrastructure.cluster.x-k8s.io 6 | spec: 7 | conversion: 8 | strategy: Webhook 9 | webhook: 10 | clientConfig: 11 | service: 12 | namespace: system 13 | name: webhook-service 14 | path: /convert 15 | conversionReviewVersions: ["v1", "v1beta1"] 16 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_nutanixmachines.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables a conversion webhook for the CRD 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | name: nutanixmachines.infrastructure.cluster.x-k8s.io 6 | spec: 7 | conversion: 8 | strategy: Webhook 9 | webhook: 10 | clientConfig: 11 | service: 12 | namespace: system 13 | name: webhook-service 14 | path: /convert 15 | conversionReviewVersions: ["v1", "v1beta1"] 16 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_nutanixclustertemplates.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables a conversion webhook for the CRD 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | name: nutanixclustertemplates.infrastructure.cluster.x-k8s.io 6 | spec: 7 | conversion: 8 | strategy: Webhook 9 | webhook: 10 | clientConfig: 11 | service: 12 | namespace: system 13 | name: webhook-service 14 | path: /convert 15 | conversionReviewVersions: 16 | - v1 17 | -------------------------------------------------------------------------------- /config/crd/patches/webhook_in_nutanixmachinetemplates.yaml: -------------------------------------------------------------------------------- 1 | # The following patch enables a conversion webhook for the CRD 2 | apiVersion: apiextensions.k8s.io/v1 3 | kind: CustomResourceDefinition 4 | metadata: 5 | name: nutanixmachinetemplates.infrastructure.cluster.x-k8s.io 6 | spec: 7 | conversion: 8 | strategy: Webhook 9 | webhook: 10 | clientConfig: 11 | service: 12 | namespace: system 13 | name: webhook-service 14 | path: /convert 15 | conversionReviewVersions: ["v1", "v1beta1"] 16 | -------------------------------------------------------------------------------- /templates/ccm/nutanix-ccm-crs.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: addons.cluster.x-k8s.io/v1beta1 2 | kind: ClusterResourceSet 3 | metadata: 4 | name: nutanix-ccm-crs 5 | spec: 6 | clusterSelector: 7 | matchLabels: 8 | ccm: nutanix 9 | resources: 10 | - kind: ConfigMap 11 | name: nutanix-ccm 12 | - kind: Secret 13 | name: nutanix-ccm-secret 14 | - kind: ConfigMap 15 | name: nutanix-ccm-pc-trusted-ca-bundle 16 | strategy: ApplyOnce 17 | --- 18 | apiVersion: v1 19 | kind: ConfigMap 20 | metadata: 21 | name: nutanix-ccm 22 | data: 23 | -------------------------------------------------------------------------------- /config/rbac/nutanixmachinetemplate_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view nutanixmachinetemplates. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: nutanixmachinetemplate-viewer-role 6 | rules: 7 | - apiGroups: 8 | - infrastructure.cluster.x-k8s.io 9 | resources: 10 | - nutanixmachinetemplates 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - apiGroups: 16 | - infrastructure.cluster.x-k8s.io 17 | resources: 18 | - nutanixmachinetemplates/status 19 | verbs: 20 | - get 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature enhancement request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | /kind feature 8 | 9 | **Describe the solution you'd like** 10 | [A clear and concise description of what you want to happen.] 11 | 12 | 13 | **Anything else you would like to add:** 14 | [Miscellaneous information that will assist in solving the issue.] 15 | 16 | 17 | **Environment:** 18 | 19 | - Cluster-api-provider-nutanix version: 20 | - Kubernetes version: (use `kubectl version`): 21 | - OS (e.g. from `/etc/os-release`): -------------------------------------------------------------------------------- /config/rbac/nutanixcluster_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit nutanixclusters. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: nutanixcluster-editor-role 6 | rules: 7 | - apiGroups: 8 | - infrastructure.cluster.x-k8s.io 9 | resources: 10 | - nutanixclusters 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - infrastructure.cluster.x-k8s.io 21 | resources: 22 | - nutanixclusters/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /config/rbac/nutanixmachine_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit nutanixmachines. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: nutanixmachine-editor-role 6 | rules: 7 | - apiGroups: 8 | - infrastructure.cluster.x-k8s.io 9 | resources: 10 | - nutanixmachines 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - infrastructure.cluster.x-k8s.io 21 | resources: 22 | - nutanixmachines/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-csi/kct.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 3 | kind: KubeadmConfigTemplate 4 | metadata: 5 | name: "${CLUSTER_NAME}-kcfg-0" 6 | namespace: "${NAMESPACE}" 7 | spec: 8 | template: 9 | spec: 10 | preKubeadmCommands: 11 | - echo "before kubeadm call" > /var/log/prekubeadm.log 12 | - hostnamectl set-hostname "{{ ds.meta_data.hostname }}" 13 | - apt update 14 | - apt install -y nfs-common open-iscsi lvm2 xfsprogs 15 | - systemctl enable --now iscsid 16 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-csi3/kct.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 3 | kind: KubeadmConfigTemplate 4 | metadata: 5 | name: "${CLUSTER_NAME}-kcfg-0" 6 | namespace: "${NAMESPACE}" 7 | spec: 8 | template: 9 | spec: 10 | preKubeadmCommands: 11 | - echo "before kubeadm call" > /var/log/prekubeadm.log 12 | - hostnamectl set-hostname "{{ ds.meta_data.hostname }}" 13 | - apt update 14 | - apt install -y nfs-common open-iscsi lvm2 xfsprogs 15 | - systemctl enable --now iscsid 16 | -------------------------------------------------------------------------------- /.github/release.yaml: -------------------------------------------------------------------------------- 1 | # .github/release.yml 2 | 3 | changelog: 4 | exclude: 5 | labels: 6 | - ignore-for-release 7 | categories: 8 | - title: Breaking Changes 🛠 9 | labels: 10 | - Semver-Major 11 | - breaking-change 12 | - title: Exciting New Features 🎉 13 | labels: 14 | - Semver-Minor 15 | - enhancement 16 | - title: Bug Fixes 🐛 17 | labels: 18 | - bug 19 | - title: Documentation 📖 20 | labels: 21 | - documentation 22 | - title: Other Changes 23 | labels: 24 | - "*" 25 | -------------------------------------------------------------------------------- /config/prometheus/monitor.yaml: -------------------------------------------------------------------------------- 1 | # Prometheus Monitor Service (Metrics) 2 | apiVersion: monitoring.coreos.com/v1 3 | kind: ServiceMonitor 4 | metadata: 5 | labels: 6 | control-plane: controller-manager 7 | name: controller-manager-metrics-monitor 8 | namespace: system 9 | spec: 10 | endpoints: 11 | - path: /metrics 12 | port: https 13 | scheme: https 14 | bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token 15 | tlsConfig: 16 | insecureSkipVerify: true 17 | selector: 18 | matchLabels: 19 | control-plane: controller-manager 20 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/no-kubeproxy.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: controlplane.cluster.x-k8s.io/v1beta1 3 | kind: KubeadmControlPlane 4 | metadata: 5 | name: "${CLUSTER_NAME}-kcp" 6 | spec: 7 | kubeadmConfigSpec: 8 | initConfiguration: 9 | skipPhases: 10 | - addon/kube-proxy 11 | --- 12 | apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 13 | kind: KubeadmConfigTemplate 14 | metadata: 15 | name: "${CLUSTER_NAME}-kcfg-0" 16 | spec: 17 | template: 18 | spec: 19 | initConfiguration: 20 | skipPhases: 21 | - addon/kube-proxy 22 | -------------------------------------------------------------------------------- /config/default/manager_config_patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: apps/v1 2 | kind: Deployment 3 | metadata: 4 | name: controller-manager 5 | namespace: system 6 | spec: 7 | template: 8 | spec: 9 | containers: 10 | - name: manager 11 | args: 12 | - "--config=controller_manager_config.yaml" 13 | volumeMounts: 14 | - name: manager-config 15 | mountPath: /controller_manager_config.yaml 16 | subPath: controller_manager_config.yaml 17 | volumes: 18 | - name: manager-config 19 | configMap: 20 | name: manager-config 21 | -------------------------------------------------------------------------------- /config/crd/kustomizeconfig.yaml: -------------------------------------------------------------------------------- 1 | # This file is for teaching kustomize how to substitute name and namespace reference in CRD 2 | nameReference: 3 | - kind: Service 4 | version: v1 5 | fieldSpecs: 6 | - kind: CustomResourceDefinition 7 | version: v1 8 | group: apiextensions.k8s.io 9 | path: spec/conversion/webhook/clientConfig/service/name 10 | 11 | namespace: 12 | - kind: CustomResourceDefinition 13 | version: v1 14 | group: apiextensions.k8s.io 15 | path: spec/conversion/webhook/clientConfig/service/namespace 16 | create: false 17 | 18 | varReference: 19 | - path: metadata/annotations 20 | -------------------------------------------------------------------------------- /config/rbac/nutanixmachinetemplate_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit nutanixmachinetemplates. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | name: nutanixmachinetemplate-editor-role 6 | rules: 7 | - apiGroups: 8 | - infrastructure.cluster.x-k8s.io 9 | resources: 10 | - nutanixmachinetemplates 11 | verbs: 12 | - create 13 | - delete 14 | - get 15 | - list 16 | - patch 17 | - update 18 | - watch 19 | - apiGroups: 20 | - infrastructure.cluster.x-k8s.io 21 | resources: 22 | - nutanixmachinetemplates/status 23 | verbs: 24 | - get 25 | -------------------------------------------------------------------------------- /templates/base/nutanix-cluster.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 2 | kind: NutanixCluster 3 | metadata: 4 | name: "${CLUSTER_NAME}" 5 | spec: 6 | prismCentral: 7 | address: "${NUTANIX_ENDPOINT}" 8 | port: ${NUTANIX_PORT=9440} 9 | insecure: ${NUTANIX_INSECURE=false} 10 | credentialRef: 11 | name: "${CLUSTER_NAME}" 12 | kind: Secret 13 | additionalTrustBundle: 14 | name: ${CLUSTER_NAME}-pc-trusted-ca-bundle 15 | kind: ConfigMap 16 | controlPlaneEndpoint: 17 | host: "${CONTROL_PLANE_ENDPOINT_IP}" 18 | port: ${CONTROL_PLANE_ENDPOINT_PORT=6443} 19 | -------------------------------------------------------------------------------- /hack/boilerplate.go.txt: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 Nutanix 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-image-lookup/kustomization.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Nutanix. All rights reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | apiVersion: kustomize.config.k8s.io/v1beta1 5 | kind: Kustomization 6 | 7 | metadata: 8 | name: nutanix-image-lookup-kustomize 9 | 10 | resources: 11 | - ../../../../../../templates/base/ 12 | - ../base/crs.yaml 13 | 14 | patches: 15 | - path: ../base/cni-patch.yaml 16 | - path: lookup-patch.yaml 17 | - target: 18 | kind: NutanixMachineTemplate 19 | patch: |- 20 | - op: "remove" 21 | path: "/spec/template/spec/image" 22 | -------------------------------------------------------------------------------- /templates/csi3/kustomization.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2023 Nutanix. All rights reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | apiVersion: kustomize.config.k8s.io/v1beta1 5 | kind: Kustomization 6 | 7 | metadata: 8 | name: nutanix-csi-kustomize 9 | 10 | namespace: kube-system 11 | 12 | configMapGenerator: 13 | - behavior: merge 14 | files: 15 | - nutanix-csi-storage.yaml 16 | - nutanix-csi-snapshot.yaml 17 | - nutanix-csi-webhook.yaml 18 | name: nutanix-csi 19 | 20 | resources: 21 | - ../base/ 22 | - nutanix-csi.yaml 23 | - nutanix-csi-crs.yaml 24 | - nutanix-csi-secret.yaml 25 | 26 | patches: 27 | - path: csi-patch.yaml 28 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/no-kubeproxy/no-kubeproxy-clusterclass.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: controlplane.cluster.x-k8s.io/v1beta1 2 | kind: KubeadmControlPlaneTemplate 3 | metadata: 4 | name: "nutanix-quick-start-kcpt" 5 | spec: 6 | template: 7 | spec: 8 | kubeadmConfigSpec: 9 | initConfiguration: 10 | skipPhases: 11 | - addon/kube-proxy 12 | --- 13 | apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 14 | kind: KubeadmConfigTemplate 15 | metadata: 16 | name: "nutanix-quick-start-kcfg-0" 17 | spec: 18 | template: 19 | spec: 20 | initConfiguration: 21 | skipPhases: 22 | - addon/kube-proxy 23 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-additional-categories/nmt.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 3 | kind: NutanixMachineTemplate 4 | metadata: 5 | name: "${CLUSTER_NAME}-mt-0" 6 | namespace: "${NAMESPACE}" 7 | spec: 8 | template: 9 | spec: 10 | additionalCategories: 11 | # Use System category Apptype:Kubernetes 12 | - key: AppType 13 | value: Kubernetes 14 | # Use System category Environment:Dev 15 | - key: Environment 16 | value: Dev 17 | # Use System category Environment:Testing 18 | - key: Environment 19 | value: Testing 20 | -------------------------------------------------------------------------------- /config/rbac/leader_election_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions to do leader election. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: Role 4 | metadata: 5 | name: leader-election-role 6 | rules: 7 | - apiGroups: 8 | - "" 9 | resources: 10 | - configmaps 11 | verbs: 12 | - get 13 | - list 14 | - watch 15 | - create 16 | - update 17 | - patch 18 | - delete 19 | - apiGroups: 20 | - coordination.k8s.io 21 | resources: 22 | - leases 23 | verbs: 24 | - get 25 | - list 26 | - watch 27 | - create 28 | - update 29 | - patch 30 | - delete 31 | - apiGroups: 32 | - "" 33 | resources: 34 | - events 35 | verbs: 36 | - create 37 | - patch 38 | -------------------------------------------------------------------------------- /tools/imagebuilder/terraform/variables.tf: -------------------------------------------------------------------------------- 1 | variable "password" { 2 | type = string 3 | } 4 | variable "endpoint" { 5 | type = string 6 | } 7 | variable "user" { 8 | type = string 9 | } 10 | 11 | variable "image_url" { 12 | default = "https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img" 13 | } 14 | 15 | variable "cluster_name" { 16 | type = string 17 | } 18 | variable "vm_name" { 19 | type = string 20 | } 21 | variable "vm_user" { 22 | type = string 23 | } 24 | variable "subnet_name" { 25 | type = string 26 | } 27 | variable "public_key_file_path" { 28 | type = string 29 | } 30 | variable "private_key_file_path" { 31 | type = string 32 | } 33 | -------------------------------------------------------------------------------- /templates/base/cluster-without-topology.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cluster.x-k8s.io/v1beta1 2 | kind: Cluster 3 | metadata: 4 | labels: 5 | cluster.x-k8s.io/cluster-name: "${CLUSTER_NAME}" 6 | name: "${CLUSTER_NAME}" 7 | spec: 8 | clusterNetwork: 9 | services: 10 | cidrBlocks: ["172.19.0.0/16"] 11 | pods: 12 | cidrBlocks: ["172.20.0.0/16"] 13 | serviceDomain: "cluster.local" 14 | controlPlaneRef: 15 | apiVersion: controlplane.cluster.x-k8s.io/v1beta1 16 | kind: KubeadmControlPlane 17 | name: "${CLUSTER_NAME}-kcp" 18 | infrastructureRef: 19 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 20 | kind: NutanixCluster 21 | name: "${CLUSTER_NAME}" 22 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | # Enable version updates for Go modules 9 | - package-ecosystem: "gomod" 10 | directory: "/" 11 | schedule: 12 | interval: "daily" 13 | 14 | # Enable version updates for GitHub Actions 15 | - package-ecosystem: "github-actions" 16 | directory: "/" 17 | schedule: 18 | interval: "daily" 19 | -------------------------------------------------------------------------------- /.golangci.yaml: -------------------------------------------------------------------------------- 1 | version: "2" 2 | run: 3 | concurrency: 4 4 | build-tags: 5 | - e2e 6 | linters: 7 | enable: 8 | - gocognit 9 | - nolintlint 10 | settings: 11 | nolintlint: 12 | require-explanation: true 13 | require-specific: true 14 | exclusions: 15 | generated: lax 16 | presets: 17 | - comments 18 | - common-false-positives 19 | - legacy 20 | - std-error-handling 21 | paths: 22 | - third_party$ 23 | - builtin$ 24 | - examples$ 25 | formatters: 26 | enable: 27 | - gofmt 28 | - gofumpt 29 | exclusions: 30 | generated: lax 31 | paths: 32 | - third_party$ 33 | - builtin$ 34 | - examples$ 35 | -------------------------------------------------------------------------------- /api/v1beta1/doc.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 Nutanix 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | // Package v1beta1 contains the v1beta1 API implementation. 18 | package v1beta1 19 | -------------------------------------------------------------------------------- /templates/ccm/nutanix-ccm-secret.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: nutanix-ccm-secret 5 | type: addons.cluster.x-k8s.io/resource-set 6 | stringData: 7 | nutanix-ccm-secret.yaml: | 8 | apiVersion: v1 9 | kind: Secret 10 | metadata: 11 | name: nutanix-creds 12 | namespace: kube-system 13 | stringData: 14 | credentials: | 15 | [ 16 | { 17 | "type": "basic_auth", 18 | "data": { 19 | "prismCentral":{ 20 | "username": "${NUTANIX_USER}", 21 | "password": "${NUTANIX_PASSWORD}" 22 | }, 23 | "prismElements": null 24 | } 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /tools/imagebuilder/delete_image_build_vm.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2022 Nutanix 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | pushd ./terraform 17 | terraform destroy 18 | popd -------------------------------------------------------------------------------- /templates/csi3/nutanix-csi-secret.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Secret 3 | metadata: 4 | name: nutanix-csi-secret 5 | type: addons.cluster.x-k8s.io/resource-set 6 | stringData: 7 | nutanix-csi-secret.yaml: | 8 | apiVersion: v1 9 | stringData: 10 | key: ${NUTANIX_ENDPOINT}:${NUTANIX_PORT}:${NUTANIX_USER}:${NUTANIX_PASSWORD} 11 | kind: Secret 12 | metadata: 13 | name: ntnx-pc-secret 14 | namespace: ntnx-system 15 | type: Opaque 16 | --- 17 | apiVersion: v1 18 | stringData: 19 | key: ${NUTANIX_ENDPOINT}:${NUTANIX_PORT}:${NUTANIX_USER}:${NUTANIX_PASSWORD} 20 | kind: Secret 21 | metadata: 22 | name: nutanix-csi-credentials 23 | namespace: ntnx-system 24 | type: Opaque 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Tell us about a problem you are experiencing 4 | 5 | --- 6 | 7 | /kind bug 8 | 9 | **What steps did you take and what happened:** 10 | 11 | _A clear and concise description of what the bug is and how has this been tested. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration_ 12 | 13 | 14 | **What did you expect to happen:** 15 | 16 | 17 | **Anything else you would like to add:** 18 | 19 | _Miscellaneous information that will assist in solving the issue._ 20 | 21 | 22 | **Environment:** 23 | 24 | - Cluster-api-provider-nutanix version: 25 | - Kubernetes version: (use `kubectl version`): 26 | - OS (e.g. from `/etc/os-release`): -------------------------------------------------------------------------------- /config/rbac/nutanixclustertemplate_viewer_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to view nutanixclustertemplates. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: clusterrole 7 | app.kubernetes.io/instance: nutanixclustertemplate-viewer-role 8 | app.kubernetes.io/component: rbac 9 | app.kubernetes.io/created-by: cluster-api-provider-nutanix 10 | app.kubernetes.io/part-of: cluster-api-provider-nutanix 11 | app.kubernetes.io/managed-by: kustomize 12 | name: nutanixclustertemplate-viewer-role 13 | rules: 14 | - apiGroups: 15 | - infrastructure.cluster.x-k8s.io 16 | resources: 17 | - nutanixclustertemplates 18 | verbs: 19 | - get 20 | - list 21 | - watch 22 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-failure-domains/failure-domain-nmt.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 3 | kind: NutanixMachineTemplate 4 | metadata: 5 | name: "${CLUSTER_NAME}-mt-0" 6 | namespace: "${NAMESPACE}" 7 | spec: 8 | template: 9 | spec: 10 | providerID: "nutanix://${CLUSTER_NAME}-m1" 11 | bootType: ${NUTANIX_MACHINE_BOOT_TYPE=legacy} 12 | vcpusPerSocket: ${NUTANIX_MACHINE_VCPU_PER_SOCKET=1} 13 | vcpuSockets: ${NUTANIX_MACHINE_VCPU_SOCKET=2} 14 | memorySize: "${NUTANIX_MACHINE_MEMORY_SIZE=4Gi}" 15 | systemDiskSize: "${NUTANIX_SYSTEMDISK_SIZE=40Gi}" 16 | image: 17 | type: name 18 | name: "${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}" 19 | -------------------------------------------------------------------------------- /devbox.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": [ 3 | "bash@latest", 4 | "coreutils@latest", 5 | "clusterctl@latest", 6 | "envsubst@latest", 7 | "fping@latest", 8 | "gnumake@latest", 9 | "ginkgo@latest", 10 | "go@latest", 11 | "golangci-lint@latest", 12 | "gotestsum@latest", 13 | "kubernetes-helm@latest", 14 | "kind@latest", 15 | "ko@latest", 16 | "kubectl@latest", 17 | "kubernetes-code-generator@latest", 18 | "kubernetes-controller-tools@latest", 19 | "kustomize@latest", 20 | "mockgen@latest", 21 | "yamllint@latest", 22 | "path:./hack/flakes#go-apidiff", 23 | "path:./hack/flakes#go-mod-upgrade", 24 | "path:./hack/flakes#yamllint-checkstyle", 25 | "path:./hack/flakes#setup-envtest" 26 | ] 27 | } 28 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-failure-domains-migration/failure-domain-nmt.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 3 | kind: NutanixMachineTemplate 4 | metadata: 5 | name: "${CLUSTER_NAME}-mt-0" 6 | namespace: "${NAMESPACE}" 7 | spec: 8 | template: 9 | spec: 10 | providerID: "nutanix://${CLUSTER_NAME}-m1" 11 | bootType: ${NUTANIX_MACHINE_BOOT_TYPE=legacy} 12 | vcpusPerSocket: ${NUTANIX_MACHINE_VCPU_PER_SOCKET=1} 13 | vcpuSockets: ${NUTANIX_MACHINE_VCPU_SOCKET=2} 14 | memorySize: "${NUTANIX_MACHINE_MEMORY_SIZE=4Gi}" 15 | systemDiskSize: "${NUTANIX_SYSTEMDISK_SIZE=40Gi}" 16 | image: 17 | type: name 18 | name: "${NUTANIX_MACHINE_TEMPLATE_IMAGE_NAME}" 19 | -------------------------------------------------------------------------------- /test/e2e/README.md: -------------------------------------------------------------------------------- 1 | # Testing 2 | 3 | This document describes the steps to test CAPX end-to-end. 4 | 5 | ### Requirements 6 | 7 | TBD 8 | 9 | ### Environment variables 10 | 11 | TBD 12 | 13 | ### Running the e2e tests 14 | 15 | Run the following command to execute the CAPX e2e tests: 16 | 17 | ```shell 18 | make test-e2e 19 | ``` 20 | 21 | The above command should build the CAPX manager image locally and use that image with the e2e test suite. 22 | 23 | Running e2e with other CNIs can be done by invoking following command: 24 | ```shell 25 | #run e2e with Calico: 26 | make test-e2e-calico 27 | 28 | #run e2e with Flannel: 29 | make test-e2e-flannel 30 | 31 | #run e2e with Cilium: 32 | make test-e2e-cilium 33 | 34 | #run e2e tests with every CNI: 35 | make test-e2e-all-cni 36 | ``` 37 | -------------------------------------------------------------------------------- /test/e2e/data/shared/metadata.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3 2 | kind: Metadata 3 | releaseSeries: 4 | - major: 0 5 | minor: 3 6 | contract: v1alpha3 7 | - major: 0 8 | minor: 4 9 | contract: v1alpha4 10 | - major: 0 11 | minor: 5 12 | contract: v1beta1 13 | - major: 1 14 | minor: 3 15 | contract: v1beta1 16 | - major: 1 17 | minor: 4 18 | contract: v1beta1 19 | - major: 1 20 | minor: 5 21 | contract: v1beta1 22 | - major: 1 23 | minor: 6 24 | contract: v1beta1 25 | - major: 1 26 | minor: 7 27 | contract: v1beta1 28 | - major: 1 29 | minor: 8 30 | contract: v1beta1 31 | - major: 1 32 | minor: 9 33 | contract: v1beta1 34 | - major: 1 35 | minor: 10 36 | contract: v1beta1 37 | -------------------------------------------------------------------------------- /config/rbac/nutanixclustertemplate_editor_role.yaml: -------------------------------------------------------------------------------- 1 | # permissions for end users to edit nutanixclustertemplates. 2 | apiVersion: rbac.authorization.k8s.io/v1 3 | kind: ClusterRole 4 | metadata: 5 | labels: 6 | app.kubernetes.io/name: clusterrole 7 | app.kubernetes.io/instance: nutanixclustertemplate-editor-role 8 | app.kubernetes.io/component: rbac 9 | app.kubernetes.io/created-by: cluster-api-provider-nutanix 10 | app.kubernetes.io/part-of: cluster-api-provider-nutanix 11 | app.kubernetes.io/managed-by: kustomize 12 | name: nutanixclustertemplate-editor-role 13 | rules: 14 | - apiGroups: 15 | - infrastructure.cluster.x-k8s.io 16 | resources: 17 | - nutanixclustertemplates 18 | verbs: 19 | - create 20 | - delete 21 | - get 22 | - list 23 | - patch 24 | - update 25 | - watch 26 | -------------------------------------------------------------------------------- /tools/imagebuilder/create_image_build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2022 Nutanix 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | pushd ./terraform 17 | terraform init 18 | terraform validate 19 | terraform plan 20 | terraform apply 21 | terraform show 22 | popd 23 | -------------------------------------------------------------------------------- /templates/base/mhc.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cluster.x-k8s.io/v1beta1 2 | kind: MachineHealthCheck 3 | metadata: 4 | name: "${CLUSTER_NAME}-mhc" 5 | spec: 6 | clusterName: "${CLUSTER_NAME}" 7 | maxUnhealthy: 40% 8 | nodeStartupTimeout: 10m0s 9 | selector: 10 | matchLabels: 11 | cluster.x-k8s.io/cluster-name: "${CLUSTER_NAME}" 12 | unhealthyConditions: 13 | - type: Ready 14 | status: "False" 15 | timeout: 5m0s 16 | - type: Ready 17 | status: Unknown 18 | timeout: 5m0s 19 | - type: MemoryPressure 20 | status: "True" 21 | timeout: 5m0s 22 | - type: DiskPressure 23 | status: "True" 24 | timeout: 5m0s 25 | - type: PIDPressure 26 | status: "True" 27 | timeout: 5m0s 28 | - type: NetworkUnavailable 29 | status: "True" 30 | timeout: 5m0s 31 | -------------------------------------------------------------------------------- /config/default/manager_auth_proxy_patch.yaml: -------------------------------------------------------------------------------- 1 | # This patch modifies the manager deployment to expose the metrics port securely 2 | # using controller-runtime's built-in authentication and authorization 3 | apiVersion: apps/v1 4 | kind: Deployment 5 | metadata: 6 | name: controller-manager 7 | namespace: system 8 | spec: 9 | template: 10 | spec: 11 | containers: 12 | - name: manager 13 | args: 14 | - "--health-probe-bind-address=:8081" 15 | - "--diagnostics-address=:8443" 16 | - "--leader-elect" 17 | - "--zap-log-level=${NUTANIX_LOG_LEVEL=info}" 18 | - "--zap-devel=${NUTANIX_LOG_DEVELOPMENT=true}" 19 | - "--zap-stacktrace-level=${NUTANIX_LOG_STACKTRACE_LEVEL=panic}" 20 | ports: 21 | - containerPort: 8443 22 | name: https 23 | protocol: TCP 24 | -------------------------------------------------------------------------------- /config/rbac/kustomization.yaml: -------------------------------------------------------------------------------- 1 | # All RBAC will be applied under this service account in 2 | # the deployment namespace. You may comment out this resource 3 | # if your manager will use a service account that exists at 4 | # runtime. Be sure to update RoleBinding and ClusterRoleBinding 5 | # subjects if changing service account names. 6 | # Comment the following 4 lines if you want to disable 7 | # the auth proxy (https://github.com/brancz/kube-rbac-proxy) 8 | # which protects your /metrics endpoint. 9 | resources: 10 | - service_account.yaml 11 | - role.yaml 12 | - role_binding.yaml 13 | - leader_election_role.yaml 14 | - leader_election_role_binding.yaml 15 | - auth_proxy_service.yaml 16 | - auth_proxy_role.yaml 17 | - auth_proxy_role_binding.yaml 18 | - auth_proxy_client_clusterrole.yaml 19 | apiVersion: kustomize.config.k8s.io/v1beta1 20 | kind: Kustomization 21 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-md-remediation/mhc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Source: https://github.com/kubernetes-sigs/cluster-api/blob/main/test/e2e/data/infrastructure-docker/v1beta1/cluster-template-md-remediation/mhc.yaml 3 | 4 | # MachineHealthCheck object with 5 | # - a selector that targets all the machines with label e2e.remediation.label="" 6 | # - unhealthyConditions triggering remediation after 10s the condition is set 7 | apiVersion: cluster.x-k8s.io/v1beta1 8 | kind: MachineHealthCheck 9 | metadata: 10 | name: "${CLUSTER_NAME}-mhc-0" 11 | namespace: "${NAMESPACE}" 12 | spec: 13 | clusterName: "${CLUSTER_NAME}" 14 | maxUnhealthy: 100% 15 | selector: 16 | matchLabels: 17 | e2e.remediation.label: "" 18 | unhealthyConditions: 19 | - type: e2e.remediation.condition 20 | status: "False" 21 | timeout: 10s 22 | -------------------------------------------------------------------------------- /api/v1beta1/nutanixcluster_conversion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 Nutanix 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1beta1 18 | 19 | // Hub marks NutanixCluster as a conversion hub. 20 | func (*NutanixCluster) Hub() {} 21 | 22 | // Hub marks NutanixClusterList as a conversion hub. 23 | func (*NutanixClusterList) Hub() {} 24 | -------------------------------------------------------------------------------- /api/v1beta1/nutanixmachine_conversion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 Nutanix 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1beta1 18 | 19 | // Hub marks NutanixMachine as a conversion hub. 20 | func (*NutanixMachine) Hub() {} 21 | 22 | // Hub marks NutanixMachineList as a conversion hub. 23 | func (*NutanixMachineList) Hub() {} 24 | -------------------------------------------------------------------------------- /templates/failure-domains/failure-domains-patch.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 3 | kind: NutanixCluster 4 | metadata: 5 | name: ${CLUSTER_NAME} 6 | spec: 7 | controlPlaneFailureDomains: 8 | - name: ${NUTANIX_FAILURE_DOMAIN_1_NAME} 9 | - name: ${NUTANIX_FAILURE_DOMAIN_2_NAME} 10 | - name: ${NUTANIX_FAILURE_DOMAIN_3_NAME} 11 | --- 12 | apiVersion: controlplane.cluster.x-k8s.io/v1beta1 13 | kind: KubeadmControlPlane 14 | metadata: 15 | name: ${CLUSTER_NAME}-kcp 16 | spec: 17 | replicas: 3 18 | --- 19 | apiVersion: cluster.x-k8s.io/v1beta1 20 | kind: MachineDeployment 21 | metadata: 22 | labels: 23 | cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME} 24 | name: ${CLUSTER_NAME}-wmd 25 | spec: 26 | replicas: ${WORKER_MACHINE_COUNT=3} 27 | template: 28 | spec: 29 | failureDomain: ${NUTANIX_FAILURE_DOMAIN_1_NAME} 30 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-kcp-remediation/mhc.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # Source: https://github.com/kubernetes-sigs/cluster-api/blob/main/test/e2e/data/infrastructure-docker/v1beta1/cluster-template-kcp-remediation/mhc.yaml 3 | 4 | # MachineHealthCheck object with 5 | # - a selector that targets all the machines with label cluster.x-k8s.io/control-plane="" 6 | # - unhealthyConditions triggering remediation after 10s the condition is set 7 | apiVersion: cluster.x-k8s.io/v1beta1 8 | kind: MachineHealthCheck 9 | metadata: 10 | name: "${CLUSTER_NAME}-mhc-0" 11 | namespace: "${NAMESPACE}" 12 | spec: 13 | clusterName: "${CLUSTER_NAME}" 14 | maxUnhealthy: 100% 15 | selector: 16 | matchLabels: 17 | cluster.x-k8s.io/control-plane: "" 18 | unhealthyConditions: 19 | - type: e2e.remediation.condition 20 | status: "False" 21 | timeout: 10s 22 | -------------------------------------------------------------------------------- /hooks/build-finalize.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2022 Nutanix 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | set -x 17 | set -e 18 | 19 | BUILD_DIR=~/project/package/docker 20 | cp -r ~/project/api $BUILD_DIR 21 | cp -r ~/project/controllers $BUILD_DIR 22 | cp -r ~/project/pkg $BUILD_DIR 23 | cp go.mod go.sum main.go $BUILD_DIR 24 | 25 | -------------------------------------------------------------------------------- /tools/imagebuilder/terraform/scripts/build_os_image.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2022 Nutanix 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | git clone https://github.com/kubernetes-sigs/image-builder.git 17 | export PATH=$PATH:~/.local/bin 18 | cd ~/image-builder/images/capi 19 | chmod +x hack/* 20 | make deps-raw 21 | make build-qemu-ubuntu-2004 -------------------------------------------------------------------------------- /api/v1beta1/nutanixmachinetemplate_conversion.go: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2022 Nutanix 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | package v1beta1 18 | 19 | // Hub marks NutanixMachineTemplate as a conversion hub. 20 | func (*NutanixMachineTemplate) Hub() {} 21 | 22 | // Hub marks NutanixMachineTemplateList as a conversion hub. 23 | func (*NutanixMachineTemplateList) Hub() {} 24 | -------------------------------------------------------------------------------- /templates/base/md.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: cluster.x-k8s.io/v1beta1 2 | kind: MachineDeployment 3 | metadata: 4 | labels: 5 | cluster.x-k8s.io/cluster-name: ${CLUSTER_NAME} 6 | name: "${CLUSTER_NAME}-wmd" 7 | spec: 8 | clusterName: "${CLUSTER_NAME}" 9 | replicas: ${WORKER_MACHINE_COUNT} 10 | selector: 11 | matchLabels: {} 12 | template: 13 | metadata: 14 | labels: 15 | cluster.x-k8s.io/cluster-name: "${CLUSTER_NAME}" 16 | spec: 17 | bootstrap: 18 | configRef: 19 | apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 20 | kind: KubeadmConfigTemplate 21 | name: "${CLUSTER_NAME}-kcfg-0" 22 | clusterName: "${CLUSTER_NAME}" 23 | infrastructureRef: 24 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 25 | kind: NutanixMachineTemplate 26 | name: "${CLUSTER_NAME}-mt-0" 27 | version: "${KUBERNETES_VERSION}" 28 | -------------------------------------------------------------------------------- /.github/workflows/conventional-pr-title.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2025 Nutanix. All rights reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | name: "conventional-pr-title" 5 | permissions: 6 | contents: read 7 | pull-requests: read 8 | on: 9 | pull_request: 10 | types: 11 | - opened 12 | - edited 13 | - synchronize 14 | pull_request_target: 15 | types: 16 | - opened 17 | - edited 18 | - synchronize 19 | jobs: 20 | check: 21 | runs-on: ubuntu-24.04 22 | steps: 23 | - uses: amannn/action-semantic-pull-request@v6 24 | with: 25 | types: | 26 | build 27 | chore 28 | ci 29 | docs 30 | feat 31 | fix 32 | perf 33 | refactor 34 | revert 35 | style 36 | test 37 | env: 38 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 39 | -------------------------------------------------------------------------------- /docs/vscode-integration/README.md: -------------------------------------------------------------------------------- 1 | # VSCode Integration 2 | 3 | Some of the unit tests use the [envtest package](https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/envtest) from the controller-runtime project to create a temporary Kubernetes API server. 4 | 5 | Envtest reads the location of the necessary binaries, i.e. etcd and kube-apiserver, from an environment variable. This environment variable is initialized by our make targets, but VSCode does not run tests using make. 6 | 7 | We can use a VSCode task to write the location to a file, and configure vscode-go, which runs the tests, to initialize its environment from this file. 8 | 9 | To run envtest-based tests from VSCode, follow these steps: 10 | 11 | 1. Install setup-envtest (and other build/test dependencies) by running `devbox install`. 12 | 2. Copy `settings.json` and `tasks.json` in this directory into the `.vscode` folder at the root of the repository. 13 | 3. Restart VSCode. 14 | -------------------------------------------------------------------------------- /templates/image-lookup/lookup-patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 2 | kind: NutanixMachineTemplate 3 | metadata: 4 | name: "${CLUSTER_NAME}-mt-0" 5 | spec: 6 | template: 7 | spec: 8 | providerID: "nutanix://${CLUSTER_NAME}-m1" 9 | # Supported options for boot type: legacy and uefi 10 | # Defaults to legacy if not set 11 | bootType: ${NUTANIX_MACHINE_BOOT_TYPE=legacy} 12 | vcpusPerSocket: ${NUTANIX_MACHINE_VCPU_PER_SOCKET=1} 13 | vcpuSockets: ${NUTANIX_MACHINE_VCPU_SOCKET=2} 14 | memorySize: "${NUTANIX_MACHINE_MEMORY_SIZE=4Gi}" 15 | systemDiskSize: "${NUTANIX_SYSTEMDISK_SIZE=40Gi}" 16 | cluster: 17 | type: name 18 | name: "${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}" 19 | subnet: 20 | - type: name 21 | name: "${NUTANIX_SUBNET_NAME}" 22 | imageLookup: 23 | baseOS: "${IMAGE_LOOKUP_BASE_OS}" 24 | format: "${IMAGE_LOOKUP_FORMAT}" 25 | -------------------------------------------------------------------------------- /package/docker/Dockerfile: -------------------------------------------------------------------------------- 1 | # Build the manager binary 2 | FROM golang:1.24 as builder 3 | 4 | WORKDIR /workspace 5 | # Copy the Go Modules manifests 6 | COPY go.mod go.mod 7 | COPY go.sum go.sum 8 | # cache deps before building and copying source so that we don't need to re-download as much 9 | # and so that source changes don't invalidate our downloaded layer 10 | RUN go mod download 11 | 12 | # Copy the go source 13 | COPY main.go main.go 14 | COPY api/ api/ 15 | COPY controllers/ controllers/ 16 | COPY pkg/ pkg/ 17 | 18 | # Build 19 | RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -a -o manager main.go 20 | 21 | # Use distroless as minimal base image to package the manager binary 22 | # Refer to https://github.com/GoogleContainerTools/distroless for more details 23 | #FROM gcr.io/distroless/static:nonroot 24 | FROM gcr.io/distroless/static:debug 25 | WORKDIR / 26 | COPY --from=builder /workspace/manager . 27 | USER 65532:65532 28 | 29 | ENTRYPOINT ["/manager"] 30 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-no-nmt/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../../../../../templates/base/nutanix-cluster.yaml 5 | - ../../../../../../templates/base/cluster-without-topology.yaml 6 | - ../../../../../../templates/base/kcp.yaml 7 | - ../../../../../../templates/base/kct.yaml 8 | - ../../../../../../templates/base/secret.yaml 9 | - ../../../../../../templates/base/cm.yaml 10 | - ../../../../../../templates/base/md.yaml 11 | - ../../../../../../templates/base/mhc.yaml 12 | - ../../../../../../templates/ccm/nutanix-ccm-crs.yaml 13 | - ../../../../../../templates/ccm/nutanix-ccm-secret.yaml 14 | - ../base/crs.yaml 15 | patches: 16 | - path: ../base/cni-patch.yaml 17 | - path: ../../../../../../templates/base/ccm-patch.yaml 18 | configMapGenerator: 19 | - behavior: merge 20 | files: 21 | - ../../../../../../templates/ccm/nutanix-ccm.yaml 22 | name: nutanix-ccm 23 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-no-secret/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../../../../../templates/base/nutanix-cluster.yaml 5 | - ../../../../../../templates/base/cluster-without-topology.yaml 6 | - ../../../../../../templates/base/kct.yaml 7 | - ../../../../../../templates/base/kcp.yaml 8 | - ../../../../../../templates/base/nmt.yaml 9 | - ../../../../../../templates/base/md.yaml 10 | - ../../../../../../templates/base/mhc.yaml 11 | - ../../../../../../templates/ccm/nutanix-ccm-crs.yaml 12 | - ../../../../../../templates/ccm/nutanix-ccm-secret.yaml 13 | - ../../../../../../templates/base/cm.yaml 14 | - ../base/crs.yaml 15 | patches: 16 | - path: ../base/cni-patch.yaml 17 | - path: ../../../../../../templates/base/ccm-patch.yaml 18 | configMapGenerator: 19 | - behavior: merge 20 | files: 21 | - ../../../../../../templates/ccm/nutanix-ccm.yaml 22 | name: nutanix-ccm 23 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-upgrades/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../../../../../templates/base/nutanix-cluster.yaml 5 | - ../../../../../../templates/base/cluster-without-topology.yaml 6 | - ../../../../../../templates/base/kcp.yaml 7 | - ../../../../../../templates/base/kct.yaml 8 | - ../../../../../../templates/base/secret.yaml 9 | - ../../../../../../templates/base/cm.yaml 10 | - ../../../../../../templates/base/md.yaml 11 | - ../../../../../../templates/base/mhc.yaml 12 | - ../../../../../../templates/ccm/nutanix-ccm-crs.yaml 13 | - ../../../../../../templates/ccm/nutanix-ccm-secret.yaml 14 | - ../base/crs.yaml 15 | - ./nmt.yaml 16 | patches: 17 | - path: ../base/cni-patch.yaml 18 | - path: ../../../../../../templates/base/ccm-patch.yaml 19 | configMapGenerator: 20 | - behavior: merge 21 | files: 22 | - ../../../../../../templates/ccm/nutanix-ccm.yaml 23 | name: nutanix-ccm 24 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-image-lookup/lookup-patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 2 | kind: NutanixMachineTemplate 3 | metadata: 4 | name: "${CLUSTER_NAME}-mt-0" 5 | spec: 6 | template: 7 | spec: 8 | providerID: "nutanix://${CLUSTER_NAME}-m1" 9 | # Supported options for boot type: legacy and uefi 10 | # Defaults to legacy if not set 11 | bootType: ${NUTANIX_MACHINE_BOOT_TYPE=legacy} 12 | vcpusPerSocket: ${NUTANIX_MACHINE_VCPU_PER_SOCKET=1} 13 | vcpuSockets: ${NUTANIX_MACHINE_VCPU_SOCKET=2} 14 | memorySize: "${NUTANIX_MACHINE_MEMORY_SIZE=4Gi}" 15 | systemDiskSize: "${NUTANIX_SYSTEMDISK_SIZE=40Gi}" 16 | cluster: 17 | type: name 18 | name: "${NUTANIX_PRISM_ELEMENT_CLUSTER_NAME}" 19 | subnet: 20 | - type: name 21 | name: "${NUTANIX_SUBNET_NAME}" 22 | imageLookup: 23 | baseOS: "${IMAGE_LOOKUP_BASE_OS}" 24 | format: "${IMAGE_LOOKUP_FORMAT}" 25 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-kcp-remediation/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../../../../../templates/base/nutanix-cluster.yaml 5 | - ../../../../../../templates/base/cluster-without-topology.yaml 6 | - ../../../../../../templates/base/kcp.yaml 7 | - ../../../../../../templates/base/kct.yaml 8 | - ../../../../../../templates/base/secret.yaml 9 | - ../../../../../../templates/base/cm.yaml 10 | - ../../../../../../templates/base/nmt.yaml 11 | - ../../../../../../templates/base/md.yaml 12 | - ../../../../../../templates/ccm/nutanix-ccm-crs.yaml 13 | - ../../../../../../templates/ccm/nutanix-ccm-secret.yaml 14 | - ../base/crs.yaml 15 | - ./mhc.yaml 16 | patches: 17 | - path: ../base/cni-patch.yaml 18 | - path: ../../../../../../templates/base/ccm-patch.yaml 19 | configMapGenerator: 20 | - behavior: merge 21 | files: 22 | - ../../../../../../templates/ccm/nutanix-ccm.yaml 23 | name: nutanix-ccm 24 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-no-nutanix-cluster/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../../../../../templates/base/nutanix-cluster.yaml 5 | - ../../../../../../templates/base/cluster-without-topology.yaml 6 | - ../../../../../../templates/base/kcp.yaml 7 | - ../../../../../../templates/base/kct.yaml 8 | - ../../../../../../templates/base/nmt.yaml 9 | - ../../../../../../templates/base/cm.yaml 10 | - ../../../../../../templates/base/md.yaml 11 | - ../../../../../../templates/base/mhc.yaml 12 | - ../../../../../../templates/ccm/nutanix-ccm-crs.yaml 13 | - ../../../../../../templates/ccm/nutanix-ccm-secret.yaml 14 | - ../base/crs.yaml 15 | patches: 16 | - path: ../base/cni-patch.yaml 17 | - path: ./nc.yaml 18 | - path: ../../../../../../templates/base/ccm-patch.yaml 19 | configMapGenerator: 20 | - behavior: merge 21 | files: 22 | - ../../../../../../templates/ccm/nutanix-ccm.yaml 23 | name: nutanix-ccm 24 | -------------------------------------------------------------------------------- /templates/base/ccm-patch.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: controlplane.cluster.x-k8s.io/v1beta1 2 | kind: KubeadmControlPlane 3 | metadata: 4 | name: "${CLUSTER_NAME}-kcp" 5 | spec: 6 | kubeadmConfigSpec: 7 | clusterConfiguration: 8 | controllerManager: 9 | extraArgs: 10 | cloud-provider: external 11 | initConfiguration: 12 | nodeRegistration: 13 | kubeletExtraArgs: 14 | cloud-provider: external 15 | joinConfiguration: 16 | nodeRegistration: 17 | kubeletExtraArgs: 18 | cloud-provider: external 19 | --- 20 | apiVersion: cluster.x-k8s.io/v1beta1 21 | kind: Cluster 22 | metadata: 23 | labels: 24 | ccm: "nutanix" 25 | name: "${CLUSTER_NAME}" 26 | --- 27 | apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 28 | kind: KubeadmConfigTemplate 29 | metadata: 30 | name: "${CLUSTER_NAME}-kcfg-0" 31 | spec: 32 | template: 33 | spec: 34 | joinConfiguration: 35 | nodeRegistration: 36 | kubeletExtraArgs: 37 | cloud-provider: external 38 | -------------------------------------------------------------------------------- /templates/clusterclass/kct.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 2 | kind: KubeadmConfigTemplate 3 | metadata: 4 | name: "nutanix-quick-start-kcfg-0" 5 | spec: 6 | template: 7 | spec: 8 | joinConfiguration: 9 | nodeRegistration: 10 | kubeletExtraArgs: 11 | cloud-provider: external 12 | eviction-hard: nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<15%,memory.available<100Mi,imagefs.inodesFree<10% 13 | 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 14 | postKubeadmCommands: 15 | - echo "after kubeadm call" > /var/log/postkubeadm.log 16 | preKubeadmCommands: 17 | - echo "before kubeadm call" > /var/log/prekubeadm.log 18 | - hostnamectl set-hostname "{{ ds.meta_data.hostname }}" 19 | verbosity: 10 20 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-md-remediation/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../../../../../templates/base/nutanix-cluster.yaml 5 | - ../../../../../../templates/base/cluster-without-topology.yaml 6 | - ../../../../../../templates/base/kcp.yaml 7 | - ../../../../../../templates/base/kct.yaml 8 | - ../../../../../../templates/base/secret.yaml 9 | - ../../../../../../templates/base/cm.yaml 10 | - ../../../../../../templates/base/nmt.yaml 11 | - ../../../../../../templates/base/md.yaml 12 | - ../../../../../../templates/ccm/nutanix-ccm-crs.yaml 13 | - ../../../../../../templates/ccm/nutanix-ccm-secret.yaml 14 | - ../base/crs.yaml 15 | - ./mhc.yaml 16 | patches: 17 | - path: ../base/cni-patch.yaml 18 | - path: ./md.yaml 19 | - path: ../../../../../../templates/base/ccm-patch.yaml 20 | configMapGenerator: 21 | - behavior: merge 22 | files: 23 | - ../../../../../../templates/ccm/nutanix-ccm.yaml 24 | name: nutanix-ccm 25 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-project/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../../../../../templates/base/nutanix-cluster.yaml 5 | - ../../../../../../templates/base/cluster-without-topology.yaml 6 | - ../../../../../../templates/base/kcp.yaml 7 | - ../../../../../../templates/base/kct.yaml 8 | - ../../../../../../templates/base/secret.yaml 9 | - ../../../../../../templates/base/cm.yaml 10 | - ../../../../../../templates/base/nmt.yaml 11 | - ../../../../../../templates/base/md.yaml 12 | - ../../../../../../templates/base/mhc.yaml 13 | - ../../../../../../templates/ccm/nutanix-ccm-crs.yaml 14 | - ../../../../../../templates/ccm/nutanix-ccm-secret.yaml 15 | - ../base/crs.yaml 16 | patches: 17 | - path: ../base/cni-patch.yaml 18 | - path: ./nmt.yaml 19 | - path: ../../../../../../templates/base/ccm-patch.yaml 20 | configMapGenerator: 21 | - behavior: merge 22 | files: 23 | - ../../../../../../templates/ccm/nutanix-ccm.yaml 24 | name: nutanix-ccm 25 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-failure-domains/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../../../../../templates/base/nutanix-cluster.yaml 5 | - ../../../../../../templates/base/cluster-without-topology.yaml 6 | - ../../../../../../templates/base/kcp.yaml 7 | - ../../../../../../templates/base/kct.yaml 8 | - ../../../../../../templates/base/secret.yaml 9 | - ../../../../../../templates/base/cm.yaml 10 | - ../../../../../../templates/base/md.yaml 11 | - ../../../../../../templates/base/mhc.yaml 12 | - ../../../../../../templates/ccm/nutanix-ccm-crs.yaml 13 | - ../../../../../../templates/ccm/nutanix-ccm-secret.yaml 14 | - ../base/crs.yaml 15 | - failure-domain-nmt.yaml 16 | patches: 17 | - path: ../base/cni-patch.yaml 18 | - path: failure-domain-patch.yaml 19 | - path: ../../../../../../templates/base/ccm-patch.yaml 20 | configMapGenerator: 21 | - behavior: merge 22 | files: 23 | - ../../../../../../templates/ccm/nutanix-ccm.yaml 24 | name: nutanix-ccm 25 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-failure-domains-migration/kustomization.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: kustomize.config.k8s.io/v1beta1 2 | kind: Kustomization 3 | resources: 4 | - ../../../../../../templates/base/nutanix-cluster.yaml 5 | - ../../../../../../templates/base/cluster-without-topology.yaml 6 | - ../../../../../../templates/base/kcp.yaml 7 | - ../../../../../../templates/base/kct.yaml 8 | - ../../../../../../templates/base/secret.yaml 9 | - ../../../../../../templates/base/cm.yaml 10 | - ../../../../../../templates/base/md.yaml 11 | - ../../../../../../templates/base/mhc.yaml 12 | - ../../../../../../templates/ccm/nutanix-ccm-crs.yaml 13 | - ../../../../../../templates/ccm/nutanix-ccm-secret.yaml 14 | - ../base/crs.yaml 15 | - failure-domain-nmt.yaml 16 | patches: 17 | - path: ../base/cni-patch.yaml 18 | - path: failure-domain-patch.yaml 19 | - path: ../../../../../../templates/base/ccm-patch.yaml 20 | configMapGenerator: 21 | - behavior: merge 22 | files: 23 | - ../../../../../../templates/ccm/nutanix-ccm.yaml 24 | name: nutanix-ccm 25 | -------------------------------------------------------------------------------- /tools/imagebuilder/terraform/scripts/install_prerequisites.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2022 Nutanix 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | # https://image-builder.sigs.k8s.io/capi/providers/raw.html 17 | sudo apt-get -y update 18 | sudo apt install -y git unzip make python3-pip qemu-kvm libvirt-daemon-system libvirt-clients virtinst cpu-checker libguestfs-tools libosinfo-bin 19 | sudo usermod -a -G kvm ${USER} 20 | sudo chown root:kvm /dev/kvm 21 | # exit and log back in to make the change take place. 22 | exit 0 -------------------------------------------------------------------------------- /docs/vscode-integration/tasks.json: -------------------------------------------------------------------------------- 1 | { 2 | // See https://go.microsoft.com/fwlink/?LinkId=733558 3 | // for the documentation about the tasks.json format 4 | "version": "2.0.0", 5 | "tasks": [ 6 | { 7 | "type": "shell", 8 | "label": "Prepare vscode to run envtest-based tests", 9 | "detail": "Install envtest and configure the vscode-go test environment.", 10 | "group": { 11 | "kind": "test", 12 | "isDefault": true 13 | }, 14 | "command": [ 15 | "echo $(make print-envtest) > ${workspaceFolder}/.vscode/test.env", 16 | ], 17 | "presentation": { 18 | "echo": true, 19 | "reveal": "silent", 20 | "focus": false, 21 | "panel": "shared", 22 | "showReuseMessage": false, 23 | "clear": false 24 | }, 25 | "runOptions": { 26 | "runOn": "folderOpen", 27 | "instanceLimit": 1, 28 | }, 29 | "promptOnClose": true, 30 | } 31 | ] 32 | } -------------------------------------------------------------------------------- /templates/clusterclass/nmt-cp.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 2 | kind: NutanixMachineTemplate 3 | metadata: 4 | name: "nutanix-quick-start-cp-nmt" 5 | spec: 6 | template: 7 | spec: 8 | # Supported options for boot type: legacy and uefi 9 | # Defaults to legacy if not set 10 | bootType: legacy 11 | vcpusPerSocket: 1 12 | vcpuSockets: 2 13 | memorySize: 4Gi 14 | systemDiskSize: 40Gi 15 | image: 16 | type: name 17 | name: "placeholder-image" 18 | # Adds additional categories to the virtual machines. 19 | # Note: Categories must already be present in Prism Central 20 | # additionalCategories: 21 | # - key: AppType 22 | # value: Kubernetes 23 | # Adds the cluster virtual machines to a project defined in Prism Central. 24 | # Replace NUTANIX_PROJECT_NAME with the correct project defined in Prism Central 25 | # Note: Project must already be present in Prism Central. 26 | # project: 27 | # type: name 28 | # name: "NUTANIX_PROJECT_NAME" 29 | # gpus: 30 | # - type: name 31 | # name: "GPU NAME" 32 | -------------------------------------------------------------------------------- /templates/clusterclass/nmt-md.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 2 | kind: NutanixMachineTemplate 3 | metadata: 4 | name: "nutanix-quick-start-md-nmt" 5 | spec: 6 | template: 7 | spec: 8 | # Supported options for boot type: legacy and uefi 9 | # Defaults to legacy if not set 10 | bootType: legacy 11 | vcpusPerSocket: 1 12 | vcpuSockets: 2 13 | memorySize: 4Gi 14 | systemDiskSize: 40Gi 15 | image: 16 | type: name 17 | name: "placeholder-image" 18 | # Adds additional categories to the virtual machines. 19 | # Note: Categories must already be present in Prism Central 20 | # additionalCategories: 21 | # - key: AppType 22 | # value: Kubernetes 23 | # Adds the cluster virtual machines to a project defined in Prism Central. 24 | # Replace NUTANIX_PROJECT_NAME with the correct project defined in Prism Central 25 | # Note: Project must already be present in Prism Central. 26 | # project: 27 | # type: name 28 | # name: "NUTANIX_PROJECT_NAME" 29 | # gpus: 30 | # - type: name 31 | # name: "GPU NAME" 32 | -------------------------------------------------------------------------------- /tools/imagebuilder/README.md: -------------------------------------------------------------------------------- 1 | # Steps to create raw OS image for NutanixMachineTemplate 2 | 3 | ## To create build vm on Nutanix Cloud Infrastructure 4 | Create terraform/terraform.tfvars file with following information and assiging appropriate values 5 |
6 | endpoint = "" 7 | password = "" 8 | user = "" 9 | image_url = "https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img" 10 | cluster_name = "" 11 | vm_name = "capi_build_vm" 12 | vm_user = "ubuntu" 13 | subnet_name = "" 14 | public_key_file_path = "" 15 | private_key_file_path = "" 16 |17 | 18 | Then run following command 19 |
20 | ./create_image_build.sh 21 |22 | 23 | This will create a ubuntu build vm, build the image and copy it to local output directory from remote vm. 24 | You can find the os image in following dir ./terraform/output/ on your local machine 25 | 26 | Upload this image into Nutanix Image Service and use it for creating cluster by specifying it in NutanixMachineTemplate under image section. 27 | 28 | ## To destroy the build vm 29 | Destroy build vm by running following command 30 |
31 | ./delete_image_build_vm.sh 32 |-------------------------------------------------------------------------------- /templates/base/kct.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 2 | kind: KubeadmConfigTemplate 3 | metadata: 4 | name: "${CLUSTER_NAME}-kcfg-0" 5 | spec: 6 | template: 7 | spec: 8 | joinConfiguration: 9 | nodeRegistration: 10 | kubeletExtraArgs: 11 | cloud-provider: external 12 | eviction-hard: nodefs.available<10%,nodefs.inodesFree<5%,imagefs.available<15%,memory.available<100Mi,imagefs.inodesFree<10% 13 | tls-cipher-suites: ${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} 14 | postKubeadmCommands: 15 | - echo "after kubeadm call" > /var/log/postkubeadm.log 16 | preKubeadmCommands: 17 | - echo "before kubeadm call" > /var/log/prekubeadm.log 18 | - hostnamectl set-hostname "{{ ds.meta_data.hostname }}" 19 | users: 20 | - lockPassword: false 21 | name: capiuser 22 | sshAuthorizedKeys: 23 | - ${NUTANIX_SSH_AUTHORIZED_KEY} 24 | sudo: ALL=(ALL) NOPASSWD:ALL 25 | verbosity: 10 26 | -------------------------------------------------------------------------------- /templates/failure-domains/failure-domains.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 3 | kind: NutanixFailureDomain 4 | metadata: 5 | name: "${NUTANIX_FAILURE_DOMAIN_1_NAME}" 6 | namespace: "${NAMESPACE}" 7 | spec: 8 | prismElementCluster: 9 | type: name 10 | name: "${NUTANIX_FAILURE_DOMAIN_1_PRISM_ELEMENT_NAME}" 11 | subnets: 12 | - type: name 13 | name: "${NUTANIX_FAILURE_DOMAIN_1_SUBNET_NAME}" 14 | --- 15 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 16 | kind: NutanixFailureDomain 17 | metadata: 18 | name: "${NUTANIX_FAILURE_DOMAIN_2_NAME}" 19 | namespace: "${NAMESPACE}" 20 | spec: 21 | prismElementCluster: 22 | type: name 23 | name: "${NUTANIX_FAILURE_DOMAIN_2_PRISM_ELEMENT_NAME}" 24 | subnets: 25 | - type: name 26 | name: "${NUTANIX_FAILURE_DOMAIN_2_SUBNET_NAME}" 27 | --- 28 | apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 29 | kind: NutanixFailureDomain 30 | metadata: 31 | name: "${NUTANIX_FAILURE_DOMAIN_3_NAME}" 32 | namespace: "${NAMESPACE}" 33 | spec: 34 | prismElementCluster: 35 | type: name 36 | name: "${NUTANIX_FAILURE_DOMAIN_3_PRISM_ELEMENT_NAME}" 37 | subnets: 38 | - type: name 39 | name: "${NUTANIX_FAILURE_DOMAIN_3_SUBNET_NAME}" 40 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-csi/kcp.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: controlplane.cluster.x-k8s.io/v1beta1 3 | kind: KubeadmControlPlane 4 | metadata: 5 | name: "${CLUSTER_NAME}-kcp" 6 | namespace: "${NAMESPACE}" 7 | spec: 8 | kubeadmConfigSpec: 9 | preKubeadmCommands: 10 | - echo "before kubeadm call" > /var/log/prekubeadm.log 11 | - hostnamectl set-hostname "{{ ds.meta_data.hostname }}" 12 | - apt update 13 | - apt install -y nfs-common open-iscsi lvm2 xfsprogs 14 | - systemctl enable --now iscsid 15 | - echo "::1 ipv6-localhost ipv6-loopback" >/etc/hosts 16 | - echo "127.0.0.1 localhost" >>/etc/hosts 17 | - echo "127.0.0.1 kubernetes" >>/etc/hosts 18 | - echo "127.0.0.1 {{ ds.meta_data.hostname }}" >> /etc/hosts 19 | - | 20 | KUBERNETES_VERSION_NO_V=${KUBERNETES_VERSION#v} 21 | VERSION_TO_COMPARE=1.29.0 22 | if [ "$(printf '%s\n' "$KUBERNETES_VERSION_NO_V" "$VERSION_TO_COMPARE" | sort -V | head -n1)" != "$KUBERNETES_VERSION_NO_V" ]; then 23 | if [ -f /run/kubeadm/kubeadm.yaml ]; then 24 | sed -i 's#path: /etc/kubernetes/admin.conf#path: /etc/kubernetes/super-admin.conf#' /etc/kubernetes/manifests/kube-vip.yaml; 25 | fi 26 | fi 27 | -------------------------------------------------------------------------------- /test/e2e/data/infrastructure-nutanix/v1beta1/cluster-template-csi3/kcp.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | apiVersion: controlplane.cluster.x-k8s.io/v1beta1 3 | kind: KubeadmControlPlane 4 | metadata: 5 | name: "${CLUSTER_NAME}-kcp" 6 | namespace: "${NAMESPACE}" 7 | spec: 8 | kubeadmConfigSpec: 9 | preKubeadmCommands: 10 | - echo "before kubeadm call" > /var/log/prekubeadm.log 11 | - hostnamectl set-hostname "{{ ds.meta_data.hostname }}" 12 | - apt update 13 | - apt install -y nfs-common open-iscsi lvm2 xfsprogs 14 | - systemctl enable --now iscsid 15 | - echo "::1 ipv6-localhost ipv6-loopback" >/etc/hosts 16 | - echo "127.0.0.1 localhost" >>/etc/hosts 17 | - echo "127.0.0.1 kubernetes" >>/etc/hosts 18 | - echo "127.0.0.1 {{ ds.meta_data.hostname }}" >> /etc/hosts 19 | - | 20 | KUBERNETES_VERSION_NO_V=${KUBERNETES_VERSION#v} 21 | VERSION_TO_COMPARE=1.29.0 22 | if [ "$(printf '%s\n' "$KUBERNETES_VERSION_NO_V" "$VERSION_TO_COMPARE" | sort -V | head -n1)" != "$KUBERNETES_VERSION_NO_V" ]; then 23 | if [ -f /run/kubeadm/kubeadm.yaml ]; then 24 | sed -i 's#path: /etc/kubernetes/admin.conf#path: /etc/kubernetes/super-admin.conf#' /etc/kubernetes/manifests/kube-vip.yaml; 25 | fi 26 | fi 27 | -------------------------------------------------------------------------------- /scripts/csi_nutanix_update.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Copyright 2021 Nutanix. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | NUTANIX_CSI_SNAPSHOT_VERSION=6.3.3 17 | NUTANIX_CSI_STORAGE_VERSION=2.6.10 18 | 19 | helm repo add nutanix https://nutanix.github.io/helm/ --force-update && helm repo update 20 | 21 | helm template -n ntnx-system nutanix-snapshot nutanix/nutanix-csi-snapshot --set tls.source=secret > templates/csi/nutanix-csi-snapshot.yaml 22 | 23 | ex templates/csi/nutanix-csi-snapshot.yaml <