From 6d09be8e9968797db29c4e5cf7078201923b40a4 Mon Sep 17 00:00:00 2001 From: Dimitri Koshkin Date: Fri, 5 Apr 2024 10:47:18 -0700 Subject: [PATCH] build: add CSI configuration to Nutanix examples --- .../nutanix-cluster-calico-crs.yaml | 22 +++++++++++++++++++ .../nutanix-cluster-calico-helm-addon.yaml | 22 +++++++++++++++++++ .../nutanix-cluster-cilium-crs.yaml | 22 +++++++++++++++++++ .../nutanix-cluster-cilium-helm-addon.yaml | 22 +++++++++++++++++++ .../nutanix/csi-secret.yaml | 10 +++++++++ .../nutanix/cluster/kustomization.yaml.tmpl | 4 ++++ hack/examples/patches/nutanix/csi.yaml | 18 +++++++++++++++ 7 files changed, 120 insertions(+) create mode 100644 hack/examples/additional-resources/nutanix/csi-secret.yaml create mode 100644 hack/examples/patches/nutanix/csi.yaml diff --git a/examples/capi-quick-start/nutanix-cluster-calico-crs.yaml b/examples/capi-quick-start/nutanix-cluster-calico-crs.yaml index 710f1a31c..3c52b964e 100644 --- a/examples/capi-quick-start/nutanix-cluster-calico-crs.yaml +++ b/examples/capi-quick-start/nutanix-cluster-calico-crs.yaml @@ -1,4 +1,13 @@ apiVersion: v1 +kind: Secret +metadata: + labels: + cluster.x-k8s.io/provider: nutanix + name: ${CLUSTER_NAME}-pe-creds-for-csi +stringData: + key: ${NUTANIX_PRISM_ELEMENT_ENDPOINT}:${NUTANIX_PORT}:${NUTANIX_USER}:${NUTANIX_PASSWORD} +--- +apiVersion: v1 data: nutanix-ccm.yaml: | --- @@ -317,6 +326,19 @@ spec: cni: provider: Calico strategy: ClusterResourceSet + csi: + defaultStorage: + providerName: nutanix + storageClassConfigName: nutanix-volume + providers: + - credentials: + name: ${CLUSTER_NAME}-pe-creds-for-csi + name: nutanix + storageClassConfig: + - name: nutanix-volume + parameters: + storageContainer: ${NUTANIX_STORAGE_CONTAINER_NAME} + strategy: HelmAddon nfd: strategy: ClusterResourceSet controlPlane: diff --git a/examples/capi-quick-start/nutanix-cluster-calico-helm-addon.yaml b/examples/capi-quick-start/nutanix-cluster-calico-helm-addon.yaml index e49994c81..b28a8f68d 100644 --- a/examples/capi-quick-start/nutanix-cluster-calico-helm-addon.yaml +++ b/examples/capi-quick-start/nutanix-cluster-calico-helm-addon.yaml @@ -1,4 +1,13 @@ apiVersion: v1 +kind: Secret +metadata: + labels: + cluster.x-k8s.io/provider: nutanix + name: ${CLUSTER_NAME}-pe-creds-for-csi +stringData: + key: ${NUTANIX_PRISM_ELEMENT_ENDPOINT}:${NUTANIX_PORT}:${NUTANIX_USER}:${NUTANIX_PASSWORD} +--- +apiVersion: v1 data: nutanix-ccm.yaml: | --- @@ -317,6 +326,19 @@ spec: cni: provider: Calico strategy: HelmAddon + csi: + defaultStorage: + providerName: nutanix + storageClassConfigName: nutanix-volume + providers: + - credentials: + name: ${CLUSTER_NAME}-pe-creds-for-csi + name: nutanix + storageClassConfig: + - name: nutanix-volume + parameters: + storageContainer: ${NUTANIX_STORAGE_CONTAINER_NAME} + strategy: HelmAddon nfd: strategy: HelmAddon controlPlane: diff --git a/examples/capi-quick-start/nutanix-cluster-cilium-crs.yaml b/examples/capi-quick-start/nutanix-cluster-cilium-crs.yaml index f089aa951..fb90c9254 100644 --- a/examples/capi-quick-start/nutanix-cluster-cilium-crs.yaml +++ b/examples/capi-quick-start/nutanix-cluster-cilium-crs.yaml @@ -1,4 +1,13 @@ apiVersion: v1 +kind: Secret +metadata: + labels: + cluster.x-k8s.io/provider: nutanix + name: ${CLUSTER_NAME}-pe-creds-for-csi +stringData: + key: ${NUTANIX_PRISM_ELEMENT_ENDPOINT}:${NUTANIX_PORT}:${NUTANIX_USER}:${NUTANIX_PASSWORD} +--- +apiVersion: v1 data: nutanix-ccm.yaml: | --- @@ -317,6 +326,19 @@ spec: cni: provider: Cilium strategy: ClusterResourceSet + csi: + defaultStorage: + providerName: nutanix + storageClassConfigName: nutanix-volume + providers: + - credentials: + name: ${CLUSTER_NAME}-pe-creds-for-csi + name: nutanix + storageClassConfig: + - name: nutanix-volume + parameters: + storageContainer: ${NUTANIX_STORAGE_CONTAINER_NAME} + strategy: HelmAddon nfd: strategy: ClusterResourceSet controlPlane: diff --git a/examples/capi-quick-start/nutanix-cluster-cilium-helm-addon.yaml b/examples/capi-quick-start/nutanix-cluster-cilium-helm-addon.yaml index 209c73674..7a5e4b048 100644 --- a/examples/capi-quick-start/nutanix-cluster-cilium-helm-addon.yaml +++ b/examples/capi-quick-start/nutanix-cluster-cilium-helm-addon.yaml @@ -1,4 +1,13 @@ apiVersion: v1 +kind: Secret +metadata: + labels: + cluster.x-k8s.io/provider: nutanix + name: ${CLUSTER_NAME}-pe-creds-for-csi +stringData: + key: ${NUTANIX_PRISM_ELEMENT_ENDPOINT}:${NUTANIX_PORT}:${NUTANIX_USER}:${NUTANIX_PASSWORD} +--- +apiVersion: v1 data: nutanix-ccm.yaml: | --- @@ -317,6 +326,19 @@ spec: cni: provider: Cilium strategy: HelmAddon + csi: + defaultStorage: + providerName: nutanix + storageClassConfigName: nutanix-volume + providers: + - credentials: + name: ${CLUSTER_NAME}-pe-creds-for-csi + name: nutanix + storageClassConfig: + - name: nutanix-volume + parameters: + storageContainer: ${NUTANIX_STORAGE_CONTAINER_NAME} + strategy: HelmAddon nfd: strategy: HelmAddon controlPlane: diff --git a/hack/examples/additional-resources/nutanix/csi-secret.yaml b/hack/examples/additional-resources/nutanix/csi-secret.yaml new file mode 100644 index 000000000..0011bfbe1 --- /dev/null +++ b/hack/examples/additional-resources/nutanix/csi-secret.yaml @@ -0,0 +1,10 @@ +# Copyright 2023 D2iQ, Inc. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +--- +apiVersion: v1 +kind: Secret +metadata: + name: ${CLUSTER_NAME}-pe-creds-for-csi +stringData: + key: "${NUTANIX_PRISM_ELEMENT_ENDPOINT}:${NUTANIX_PORT}:${NUTANIX_USER}:${NUTANIX_PASSWORD}" diff --git a/hack/examples/bases/nutanix/cluster/kustomization.yaml.tmpl b/hack/examples/bases/nutanix/cluster/kustomization.yaml.tmpl index c957ef734..73844b6ac 100644 --- a/hack/examples/bases/nutanix/cluster/kustomization.yaml.tmpl +++ b/hack/examples/bases/nutanix/cluster/kustomization.yaml.tmpl @@ -5,6 +5,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: +- ../../../additional-resources/nutanix/csi-secret.yaml - https://raw.githubusercontent.com/nutanix-cloud-native/cluster-api-provider-nutanix/1a7cd69ba35de01e56dcf2dda7f31973111d2317/templates/cluster-template-topology.yaml sortOptions: @@ -25,6 +26,9 @@ patches: - target: kind: Cluster path: ../../../patches/cluster-autoscaler.yaml +- target: + kind: Cluster + path: ../../../patches/nutanix/csi.yaml - target: kind: Cluster path: ../../../patches/nutanix/initialize-variables.yaml diff --git a/hack/examples/patches/nutanix/csi.yaml b/hack/examples/patches/nutanix/csi.yaml new file mode 100644 index 000000000..fffac03ef --- /dev/null +++ b/hack/examples/patches/nutanix/csi.yaml @@ -0,0 +1,18 @@ +# Copyright 2024 D2iQ, Inc. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +- op: "add" + path: "/spec/topology/variables/0/value/addons/csi" + value: + defaultStorage: + providerName: nutanix + storageClassConfigName: nutanix-volume + providers: + - name: nutanix + storageClassConfig: + - name: nutanix-volume + parameters: + storageContainer: ${NUTANIX_STORAGE_CONTAINER_NAME} + strategy: HelmAddon + credentials: + name: ${CLUSTER_NAME}-pe-creds-for-csi