diff --git a/addons/csi-vmware-cloud-director/csi-controller.yaml b/addons/csi-vmware-cloud-director/csi-controller.yaml new file mode 100644 index 000000000..03bd7412d --- /dev/null +++ b/addons/csi-vmware-cloud-director/csi-controller.yaml @@ -0,0 +1,186 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-vcd-controller-sa + namespace: kube-system + +--- +# external attacher +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-attacher-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["storage.k8s.io"] + resources: ["volumeattachments"] + verbs: ["get", "list", "watch", "update", "patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["volumeattachments/status"] + verbs: ["patch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-attacher-binding +subjects: + - kind: ServiceAccount + name: csi-vcd-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-attacher-role + apiGroup: rbac.authorization.k8s.io + +--- +# external Provisioner +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-provisioner-role +rules: + - apiGroups: [""] + resources: ["persistentvolumes"] + verbs: ["get", "list", "watch", "create", "delete", "patch"] + - apiGroups: [""] + resources: ["persistentvolumeclaims"] + verbs: ["get", "list", "watch", "update"] + - apiGroups: ["storage.k8s.io"] + resources: ["storageclasses"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["nodes"] + verbs: ["get", "list", "watch"] + - apiGroups: ["storage.k8s.io"] + resources: ["csinodes"] + verbs: ["get", "list", "watch"] + - apiGroups: [""] + resources: ["events"] + verbs: ["list", "watch", "create", "update", "patch"] + - apiGroups: ["snapshot.storage.k8s.io"] + resources: ["volumesnapshots"] + verbs: ["get", "list"] + - apiGroups: ["snapshot.storage.k8s.io"] + resources: ["volumesnapshotcontents"] + verbs: ["get", "list"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-provisioner-binding +subjects: + - kind: ServiceAccount + name: csi-vcd-controller-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-provisioner-role + apiGroup: rbac.authorization.k8s.io +--- +kind: StatefulSet +apiVersion: apps/v1 +metadata: + name: csi-vcd-controllerplugin + namespace: kube-system +spec: + serviceName: csi-vcd-controller-service + replicas: 1 + selector: + matchLabels: + app: csi-vcd-controllerplugin + template: + metadata: + labels: + app: csi-vcd-controllerplugin + spec: + serviceAccount: csi-vcd-controller-sa + dnsPolicy: Default + containers: + - name: csi-attacher + image: k8s.gcr.io/sig-storage/csi-attacher:v3.2.1 + imagePullPolicy: IfNotPresent + args: + - --csi-address=$(ADDRESS) + - --timeout=180s + - --v=5 + env: + - name: ADDRESS + value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /var/lib/csi/sockets/pluginproxy/ + - name: csi-provisioner + image: k8s.gcr.io/sig-storage/csi-provisioner:v2.2.2 + imagePullPolicy: IfNotPresent + args: + - --csi-address=$(ADDRESS) + - --timeout=300s + - --v=5 + env: + - name: ADDRESS + value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /var/lib/csi/sockets/pluginproxy/ + - name: vcd-csi-plugin + securityContext: + privileged: true + capabilities: + add: ["SYS_ADMIN"] + allowPrivilegeEscalation: true + image: {{ .InternalImages.Get "VMwareCloudDirectorCSI" }} + imagePullPolicy: IfNotPresent + command: + - /opt/vcloud/bin/cloud-director-named-disk-csi-driver + - --cloud-config=/etc/kubernetes/vcloud/vcloud-csi-config.yaml + - --endpoint=$(CSI_ENDPOINT) + - --v=5 + env: + - name: NODE_ID + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: CSI_ENDPOINT + value: unix:///var/lib/csi/sockets/pluginproxy/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /var/lib/csi/sockets/pluginproxy/ + - name: pods-probe-dir + mountPath: /dev + mountPropagation: HostToContainer + - name: pv-dir + mountPath: /var/lib/kubelet/plugins/kubernetes.io/csi/pv + mountPropagation: "Bidirectional" + - name: vcloud-csi-config-volume + mountPath: /etc/kubernetes/vcloud + - name: vcloud-basic-auth-volume + mountPath: /etc/kubernetes/vcloud/basic-auth + volumes: + - name: socket-dir + emptyDir: {} + - name: pods-probe-dir + hostPath: + path: /dev + type: Directory + - name: pv-dir + hostPath: + path: /var/lib/kubelet/plugins/kubernetes.io/csi/pv + type: DirectoryOrCreate + - name: vcloud-csi-config-volume + configMap: + name: vcloud-csi-configmap + - name: vcloud-basic-auth-volume + secret: + secretName: vcloud-basic-auth +--- diff --git a/addons/csi-vmware-cloud-director/csi-driver.yaml b/addons/csi-vmware-cloud-director/csi-driver.yaml new file mode 100644 index 000000000..b206a8054 --- /dev/null +++ b/addons/csi-vmware-cloud-director/csi-driver.yaml @@ -0,0 +1,9 @@ +--- +apiVersion: storage.k8s.io/v1 +kind: CSIDriver +metadata: + name: named-disk.csi.cloud-director.vmware.com +spec: + attachRequired: true + podInfoOnMount: false +--- diff --git a/addons/csi-vmware-cloud-director/csi-node.yaml b/addons/csi-vmware-cloud-director/csi-node.yaml new file mode 100644 index 000000000..d93a2865f --- /dev/null +++ b/addons/csi-vmware-cloud-director/csi-node.yaml @@ -0,0 +1,150 @@ +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: csi-vcd-node-sa + namespace: kube-system +--- +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-nodeplugin-role +rules: + - apiGroups: [""] + resources: ["events"] + verbs: ["get", "list", "watch", "create", "update", "patch"] + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: csi-nodeplugin-binding +subjects: + - kind: ServiceAccount + name: csi-vcd-node-sa + namespace: kube-system +roleRef: + kind: ClusterRole + name: csi-nodeplugin-role + apiGroup: rbac.authorization.k8s.io +--- +kind: DaemonSet +apiVersion: apps/v1 +metadata: + name: csi-vcd-nodeplugin + namespace: kube-system +spec: + selector: + matchLabels: + app: csi-vcd-nodeplugin + template: + metadata: + labels: + app: csi-vcd-nodeplugin + spec: + serviceAccount: csi-vcd-node-sa + hostNetwork: true + dnsPolicy: Default + containers: + - name: node-driver-registrar + image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.2.0 + imagePullPolicy: "IfNotPresent" + args: + - "--v=5" + - "--csi-address=$(ADDRESS)" + - "--kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)" + lifecycle: + preStop: + exec: + command: + [ + "/bin/sh", + "-c", + "rm -rf /registration/named-disk.csi.cloud-director.vmware.com /registration/named-disk.csi.cloud-director.vmware.com-reg.sock", + ] + env: + - name: ADDRESS + value: /csi/csi.sock + - name: DRIVER_REG_SOCK_PATH + value: /var/lib/kubelet/csi-plugins/named-disk.csi.cloud-director.vmware.com/csi.sock + - name: NODE_ID + valueFrom: + fieldRef: + fieldPath: spec.nodeName + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: registration-dir + mountPath: /registration + - name: vcd-csi-plugin + securityContext: + privileged: true + capabilities: + add: ["SYS_ADMIN"] + allowPrivilegeEscalation: true + image: {{ .InternalImages.Get "VMwareCloudDirectorCSI" }} + imagePullPolicy: IfNotPresent + command: + - /opt/vcloud/bin/cloud-director-named-disk-csi-driver + - --nodeid=$(NODE_ID) + - --endpoint=$(CSI_ENDPOINT) + - --cloud-config=/etc/kubernetes/vcloud/vcloud-csi-config.yaml + - --v=5 + env: + - name: NODE_ID + valueFrom: + fieldRef: + fieldPath: spec.nodeName + - name: CSI_ENDPOINT + value: unix://csi/csi.sock + volumeMounts: + - name: socket-dir + mountPath: /csi + - name: kubelet-dir + mountPath: /var/lib/kubelet/pods + mountPropagation: "Bidirectional" + - name: pods-cloud-data + mountPath: /var/lib/cloud/data + readOnly: true + - name: pods-probe-dir + mountPath: /dev + mountPropagation: "HostToContainer" + - name: pv-dir + mountPath: /var/lib/kubelet/plugins/kubernetes.io/csi/pv + mountPropagation: "Bidirectional" + - name: vcloud-csi-config-volume + mountPath: /etc/kubernetes/vcloud + - name: vcloud-basic-auth-volume + mountPath: /etc/kubernetes/vcloud/basic-auth + volumes: + - name: socket-dir + hostPath: + path: /var/lib/kubelet/csi-plugins/named-disk.csi.cloud-director.vmware.com + type: DirectoryOrCreate + - name: registration-dir + hostPath: + path: /var/lib/kubelet/plugins_registry/ + type: DirectoryOrCreate + - name: kubelet-dir + hostPath: + path: /var/lib/kubelet/pods + type: DirectoryOrCreate + - name: pods-cloud-data + hostPath: + path: /var/lib/cloud/data + type: DirectoryOrCreate + - name: pods-probe-dir + hostPath: + path: /dev + type: Directory + - name: pv-dir + hostPath: + path: /var/lib/kubelet/plugins/kubernetes.io/csi/pv + type: DirectoryOrCreate + - name: vcloud-csi-config-volume + configMap: + name: vcloud-csi-configmap + - name: vcloud-basic-auth-volume + secret: + secretName: vcloud-basic-auth +--- diff --git a/addons/csi-vmware-cloud-director/vcloud-basic-auth.yaml b/addons/csi-vmware-cloud-director/vcloud-basic-auth.yaml new file mode 100644 index 000000000..1012e338e --- /dev/null +++ b/addons/csi-vmware-cloud-director/vcloud-basic-auth.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: vcloud-basic-auth + namespace: kube-system +data: + username: {{ required "Please provide VCD_USER" .Credentials.VCD_USER | b64enc }} + password: {{ required "Please provide VCD_PASSWORD" .Credentials.VCD_PASSWORD | b64enc }} diff --git a/addons/csi-vmware-cloud-director/vcloud-csi-config.yaml b/addons/csi-vmware-cloud-director/vcloud-csi-config.yaml new file mode 100644 index 000000000..c75e65877 --- /dev/null +++ b/addons/csi-vmware-cloud-director/vcloud-csi-config.yaml @@ -0,0 +1,16 @@ +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: vcloud-csi-configmap + namespace: kube-system +data: + # host shouldn't have the `/api` suffix. + vcloud-csi-config.yaml: |+ + vcd: + host: {{ required "Please provide VCD_URL" (trimSuffix "/api" .Credentials.VCD_URL) }} + org: {{ required "Please provide VCD_ORG" .Credentials.VCD_ORG }} + vdc: {{ required "Please provide VCD_VDC" .Credentials.VCD_VDC }} + vAppName: {{ .Config.CloudProvider.VMwareCloudDirector.VApp }} + clusterid: {{ .Config.Name }} +--- diff --git a/addons/default-storage-class/storage-class.yaml b/addons/default-storage-class/storage-class.yaml index 814f6ec1a..412574a8a 100644 --- a/addons/default-storage-class/storage-class.yaml +++ b/addons/default-storage-class/storage-class.yaml @@ -206,3 +206,17 @@ metadata: driver: dobs.csi.digitalocean.com deletionPolicy: Delete {{ end }} + +{{ if eq .Config.CloudProvider.CloudProviderName "vmwareCloudDirector" }} +kind: StorageClass +apiVersion: storage.k8s.io/v1 +metadata: + annotations: + storageclass.kubernetes.io/is-default-class: "true" + name: vcd-disk-dev +provisioner: named-disk.csi.cloud-director.vmware.com +reclaimPolicy: Delete +parameters: + storageProfile: {{ default .Config.CloudProvider.VMwareCloudDirector.StorageProfile .Params.storageProfile | quote }} + filesystem: {{ default "ext4" .Params.filesystem | quote }} +{{ end }} diff --git a/docs/api_reference/v1beta2.en.md b/docs/api_reference/v1beta2.en.md index 307cfa7c9..d1a0a1372 100644 --- a/docs/api_reference/v1beta2.en.md +++ b/docs/api_reference/v1beta2.en.md @@ -1,6 +1,6 @@ +++ title = "v1beta2 API Reference" -date = 2022-06-01T15:38:49+02:00 +date = 2022-06-07T19:50:42+05:00 weight = 11 +++ ## v1beta2 @@ -721,6 +721,8 @@ VMwareCloudDirectorSpec defines the VMware Cloud Director provider | Field | Description | Scheme | Required | | ----- | ----------- | ------ | -------- | +| vApp | VApp is the name of vApp for VMs. | string | false | +| storageProfile | StorageProfile is the name of storage profile to be used for disks. | string | true | [Back to Group](#v1beta2) diff --git a/examples/terraform/vmware-cloud-director/output.tf b/examples/terraform/vmware-cloud-director/output.tf index 08efa1a9a..8ad4ea01a 100644 --- a/examples/terraform/vmware-cloud-director/output.tf +++ b/examples/terraform/vmware-cloud-director/output.tf @@ -36,6 +36,8 @@ output "kubeone_hosts" { ssh_port = var.ssh_port ssh_private_key_file = var.ssh_private_key_file ssh_user = var.ssh_username + vapp_name = vcd_vapp.cluster.name + storage_profile = var.worker_disk_storage_profile } } } diff --git a/pkg/addons/ensure.go b/pkg/addons/ensure.go index 51dbe43a5..ad673fcfd 100644 --- a/pkg/addons/ensure.go +++ b/pkg/addons/ensure.go @@ -42,28 +42,29 @@ var ( // embeddedAddons is a list of addons that are embedded in the KubeOne // binary. Those addons are skipped when applying a user-provided addon with the same name. embeddedAddons = map[string]string{ - resources.AddonCCMAws: "", - resources.AddonCCMAzure: "", - resources.AddonCCMDigitalOcean: "", - resources.AddonCCMHetzner: "", - resources.AddonCCMOpenStack: "", - resources.AddonCCMEquinixMetal: "", - resources.AddonCCMPacket: "", - resources.AddonCCMVsphere: "", - resources.AddonCNICanal: "", - resources.AddonCNICilium: "", - resources.AddonCNIWeavenet: "", - resources.AddonCSIAwsEBS: "", - resources.AddonCSIAzureDisk: "", - resources.AddonCSIAzureFile: "", - resources.AddonCSIDigitalOcean: "", - resources.AddonCSIHetzner: "", - resources.AddonCSINutanix: "", - resources.AddonCSIOpenStackCinder: "", - resources.AddonCSIVsphere: "", - resources.AddonMachineController: "", - resources.AddonMetricsServer: "", - resources.AddonNodeLocalDNS: "", + resources.AddonCCMAws: "", + resources.AddonCCMAzure: "", + resources.AddonCCMDigitalOcean: "", + resources.AddonCCMHetzner: "", + resources.AddonCCMOpenStack: "", + resources.AddonCCMEquinixMetal: "", + resources.AddonCCMPacket: "", + resources.AddonCCMVsphere: "", + resources.AddonCNICanal: "", + resources.AddonCNICilium: "", + resources.AddonCNIWeavenet: "", + resources.AddonCSIAwsEBS: "", + resources.AddonCSIAzureDisk: "", + resources.AddonCSIAzureFile: "", + resources.AddonCSIDigitalOcean: "", + resources.AddonCSIHetzner: "", + resources.AddonCSINutanix: "", + resources.AddonCSIOpenStackCinder: "", + resources.AddonCSIVMwareCloudDirector: "", + resources.AddonCSIVsphere: "", + resources.AddonMachineController: "", + resources.AddonMetricsServer: "", + resources.AddonNodeLocalDNS: "", } greaterThan23 = semverutil.MustParseConstraint(greaterThan23Constraint) @@ -376,7 +377,13 @@ func ensureCSIAddons(s *state.State, addonsToDeploy []addonAction) []addonAction name: resources.AddonCSIOpenStackCinder, }, ) - + // Install CSI driver unconditionally + case s.Cluster.CloudProvider.VMwareCloudDirector != nil: + addonsToDeploy = append(addonsToDeploy, + addonAction{ + name: resources.AddonCSIVMwareCloudDirector, + }, + ) // Install CSI driver only if external cloud provider is used case s.Cluster.CloudProvider.Vsphere != nil && s.Cluster.CloudProvider.External: addonsToDeploy = append(addonsToDeploy, diff --git a/pkg/apis/kubeone/types.go b/pkg/apis/kubeone/types.go index 3a04c1b60..2d2d7caa3 100644 --- a/pkg/apis/kubeone/types.go +++ b/pkg/apis/kubeone/types.go @@ -286,7 +286,13 @@ type OpenstackSpec struct{} type EquinixMetalSpec struct{} // VMwareCloudDirectorSpec defines the VMware Cloud Director provider -type VMwareCloudDirectorSpec struct{} +type VMwareCloudDirectorSpec struct { + // VApp is the name of vApp for VMs. + VApp string `json:"vApp,omitempty"` + + // StorageProfile is the name of storage profile to be used for disks. + StorageProfile string `json:"storageProfile"` +} // VsphereSpec defines the vSphere provider type VsphereSpec struct{} diff --git a/pkg/apis/kubeone/v1beta2/types.go b/pkg/apis/kubeone/v1beta2/types.go index 4653a8121..b718a33c5 100644 --- a/pkg/apis/kubeone/v1beta2/types.go +++ b/pkg/apis/kubeone/v1beta2/types.go @@ -284,7 +284,13 @@ type OpenstackSpec struct{} type EquinixMetalSpec struct{} // VMwareCloudDirectorSpec defines the VMware Cloud Director provider -type VMwareCloudDirectorSpec struct{} +type VMwareCloudDirectorSpec struct { + // VApp is the name of vApp for VMs. + VApp string `json:"vApp,omitempty"` + + // StorageProfile is the name of storage profile to be used for disks. + StorageProfile string `json:"storageProfile"` +} // VsphereSpec defines the vSphere provider type VsphereSpec struct{} diff --git a/pkg/apis/kubeone/v1beta2/zz_generated.conversion.go b/pkg/apis/kubeone/v1beta2/zz_generated.conversion.go index 70fec6831..d5c541f58 100644 --- a/pkg/apis/kubeone/v1beta2/zz_generated.conversion.go +++ b/pkg/apis/kubeone/v1beta2/zz_generated.conversion.go @@ -1976,6 +1976,8 @@ func Convert_kubeone_SystemPackages_To_v1beta2_SystemPackages(in *kubeone.System } func autoConvert_v1beta2_VMwareCloudDirectorSpec_To_kubeone_VMwareCloudDirectorSpec(in *VMwareCloudDirectorSpec, out *kubeone.VMwareCloudDirectorSpec, s conversion.Scope) error { + out.VApp = in.VApp + out.StorageProfile = in.StorageProfile return nil } @@ -1985,6 +1987,8 @@ func Convert_v1beta2_VMwareCloudDirectorSpec_To_kubeone_VMwareCloudDirectorSpec( } func autoConvert_kubeone_VMwareCloudDirectorSpec_To_v1beta2_VMwareCloudDirectorSpec(in *kubeone.VMwareCloudDirectorSpec, out *VMwareCloudDirectorSpec, s conversion.Scope) error { + out.VApp = in.VApp + out.StorageProfile = in.StorageProfile return nil } diff --git a/pkg/templates/images/images.go b/pkg/templates/images/images.go index 812a6d802..5749f1873 100644 --- a/pkg/templates/images/images.go +++ b/pkg/templates/images/images.go @@ -157,6 +157,9 @@ const ( EquinixMetalCCM VsphereCCM + // VMwareCloud Director CSI + VMwareCloudDirectorCSI + // vSphere CSI VsphereCSIDriver VsphereCSISyncer @@ -318,6 +321,9 @@ func optionalResources() map[Resource]map[string]string { ">= 1.23.0": "gcr.io/cloud-provider-vsphere/cpi/release/manager:v1.23.0", }, + // VMware Cloud Director CSI + VMwareCloudDirectorCSI: {"*": "projects.registry.vmware.com/vmware-cloud-director/cloud-director-named-disk-csi-driver:1.2.0.latest"}, + // vSphere CSI VsphereCSIDriver: {"*": "gcr.io/cloud-provider-vsphere/csi/release/driver:v2.5.1"}, VsphereCSISyncer: {"*": "gcr.io/cloud-provider-vsphere/csi/release/syncer:v2.5.1"}, diff --git a/pkg/templates/images/resource_string.go b/pkg/templates/images/resource_string.go index 04d07073c..45c2c32f6 100644 --- a/pkg/templates/images/resource_string.go +++ b/pkg/templates/images/resource_string.go @@ -89,24 +89,25 @@ func _() { _ = x[OpenstackCCM-79] _ = x[EquinixMetalCCM-80] _ = x[VsphereCCM-81] - _ = x[VsphereCSIDriver-82] - _ = x[VsphereCSISyncer-83] - _ = x[VsphereCSIAttacher-84] - _ = x[VsphereCSILivenessProbe-85] - _ = x[VsphereCSINodeDriverRegistar-86] - _ = x[VsphereCSIProvisioner-87] - _ = x[VsphereCSIResizer-88] - _ = x[VsphereCSISnapshotter-89] - _ = x[VsphereCSISnapshotController-90] - _ = x[VsphereCSISnapshotValidationWebhook-91] - _ = x[CalicoVXLANCNI-92] - _ = x[CalicoVXLANController-93] - _ = x[CalicoVXLANNode-94] + _ = x[VMwareCloudDirectorCSI-82] + _ = x[VsphereCSIDriver-83] + _ = x[VsphereCSISyncer-84] + _ = x[VsphereCSIAttacher-85] + _ = x[VsphereCSILivenessProbe-86] + _ = x[VsphereCSINodeDriverRegistar-87] + _ = x[VsphereCSIProvisioner-88] + _ = x[VsphereCSIResizer-89] + _ = x[VsphereCSISnapshotter-90] + _ = x[VsphereCSISnapshotController-91] + _ = x[VsphereCSISnapshotValidationWebhook-92] + _ = x[CalicoVXLANCNI-93] + _ = x[CalicoVXLANController-94] + _ = x[CalicoVXLANNode-95] } -const _Resource_name = "CalicoCNICalicoControllerCalicoNodeFlannelCiliumCiliumOperatorHubbleRelayHubbleUIHubbleUIBackendHubbleProxyCiliumCertGenWeaveNetCNIKubeWeaveNetCNINPCDNSNodeCacheMachineControllerMetricsServerOperatingSystemManagerClusterAutoscalerCSIAttacherCSINodeDriverRegistarCSIProvisionerCSISnapshotterCSIResizerCSILivenessProbeAwsCCMAzureCCMAzureCNMAwsEbsCSIAwsEbsCSIAttacherAwsEbsCSILivenessProbeAwsEbsCSINodeDriverRegistrarAwsEbsCSIProvisionerAwsEbsCSIResizerAwsEbsCSISnapshotterAwsEbsCSISnapshotControllerAzureFileCSIAzureFileCSIAttacherAzureFileCSILivenessProbeAzureFileCSINodeDriverRegistarAzureFileCSIProvisionerAzureFileCSIResizerAzureFileCSISnapshotterAzureFileCSISnapshotterControllerAzureDiskCSIAzureDiskCSIAttacherAzureDiskCSILivenessProbeAzureDiskCSINodeDriverRegistarAzureDiskCSIProvisionerAzureDiskCSIResizerAzureDiskCSISnapshotterAzureDiskCSISnapshotterControllerNutanixCSILivenessProbeNutanixCSINutanixCSIProvisionerNutanixCSIRegistrarNutanixCSIResizerNutanixCSISnapshotterNutanixCSISnapshotControllerNutanixCSISnapshotValidationWebhookDigitalOceanCSIDigitalOceanCSIAlpineDigitalOceanCSIAttacherDigitalOceanCSINodeDriverRegistarDigitalOceanCSIProvisionerDigitalOceanCSIResizerDigitalOceanCSISnapshotControllerDigitalOceanCSISnapshotValidationWebhookDigitalOceanCSISnapshotterOpenstackCSIOpenstackCSINodeDriverRegistarOpenstackCSILivenessProbeOpenstackCSIAttacherOpenstackCSIProvisionerOpenstackCSIResizerOpenstackCSISnapshotterDigitaloceanCCMHetznerCCMHetznerCSIOpenstackCCMEquinixMetalCCMVsphereCCMVsphereCSIDriverVsphereCSISyncerVsphereCSIAttacherVsphereCSILivenessProbeVsphereCSINodeDriverRegistarVsphereCSIProvisionerVsphereCSIResizerVsphereCSISnapshotterVsphereCSISnapshotControllerVsphereCSISnapshotValidationWebhookCalicoVXLANCNICalicoVXLANControllerCalicoVXLANNode" +const _Resource_name = "CalicoCNICalicoControllerCalicoNodeFlannelCiliumCiliumOperatorHubbleRelayHubbleUIHubbleUIBackendHubbleProxyCiliumCertGenWeaveNetCNIKubeWeaveNetCNINPCDNSNodeCacheMachineControllerMetricsServerOperatingSystemManagerClusterAutoscalerCSIAttacherCSINodeDriverRegistarCSIProvisionerCSISnapshotterCSIResizerCSILivenessProbeAwsCCMAzureCCMAzureCNMAwsEbsCSIAwsEbsCSIAttacherAwsEbsCSILivenessProbeAwsEbsCSINodeDriverRegistrarAwsEbsCSIProvisionerAwsEbsCSIResizerAwsEbsCSISnapshotterAwsEbsCSISnapshotControllerAzureFileCSIAzureFileCSIAttacherAzureFileCSILivenessProbeAzureFileCSINodeDriverRegistarAzureFileCSIProvisionerAzureFileCSIResizerAzureFileCSISnapshotterAzureFileCSISnapshotterControllerAzureDiskCSIAzureDiskCSIAttacherAzureDiskCSILivenessProbeAzureDiskCSINodeDriverRegistarAzureDiskCSIProvisionerAzureDiskCSIResizerAzureDiskCSISnapshotterAzureDiskCSISnapshotterControllerNutanixCSILivenessProbeNutanixCSINutanixCSIProvisionerNutanixCSIRegistrarNutanixCSIResizerNutanixCSISnapshotterNutanixCSISnapshotControllerNutanixCSISnapshotValidationWebhookDigitalOceanCSIDigitalOceanCSIAlpineDigitalOceanCSIAttacherDigitalOceanCSINodeDriverRegistarDigitalOceanCSIProvisionerDigitalOceanCSIResizerDigitalOceanCSISnapshotControllerDigitalOceanCSISnapshotValidationWebhookDigitalOceanCSISnapshotterOpenstackCSIOpenstackCSINodeDriverRegistarOpenstackCSILivenessProbeOpenstackCSIAttacherOpenstackCSIProvisionerOpenstackCSIResizerOpenstackCSISnapshotterDigitaloceanCCMHetznerCCMHetznerCSIOpenstackCCMEquinixMetalCCMVsphereCCMVMwareCloudDirectorCSIVsphereCSIDriverVsphereCSISyncerVsphereCSIAttacherVsphereCSILivenessProbeVsphereCSINodeDriverRegistarVsphereCSIProvisionerVsphereCSIResizerVsphereCSISnapshotterVsphereCSISnapshotControllerVsphereCSISnapshotValidationWebhookCalicoVXLANCNICalicoVXLANControllerCalicoVXLANNode" -var _Resource_index = [...]uint16{0, 9, 25, 35, 42, 48, 62, 73, 81, 96, 107, 120, 135, 149, 161, 178, 191, 213, 230, 241, 262, 276, 290, 300, 316, 322, 330, 338, 347, 364, 386, 414, 434, 450, 470, 497, 509, 529, 554, 584, 607, 626, 649, 682, 694, 714, 739, 769, 792, 811, 834, 867, 890, 900, 921, 940, 957, 978, 1006, 1041, 1056, 1077, 1100, 1133, 1159, 1181, 1214, 1254, 1280, 1292, 1322, 1347, 1367, 1390, 1409, 1432, 1447, 1457, 1467, 1479, 1494, 1504, 1520, 1536, 1554, 1577, 1605, 1626, 1643, 1664, 1692, 1727, 1741, 1762, 1777} +var _Resource_index = [...]uint16{0, 9, 25, 35, 42, 48, 62, 73, 81, 96, 107, 120, 135, 149, 161, 178, 191, 213, 230, 241, 262, 276, 290, 300, 316, 322, 330, 338, 347, 364, 386, 414, 434, 450, 470, 497, 509, 529, 554, 584, 607, 626, 649, 682, 694, 714, 739, 769, 792, 811, 834, 867, 890, 900, 921, 940, 957, 978, 1006, 1041, 1056, 1077, 1100, 1133, 1159, 1181, 1214, 1254, 1280, 1292, 1322, 1347, 1367, 1390, 1409, 1432, 1447, 1457, 1467, 1479, 1494, 1504, 1526, 1542, 1558, 1576, 1599, 1627, 1648, 1665, 1686, 1714, 1749, 1763, 1784, 1799} func (i Resource) String() string { i -= 1 diff --git a/pkg/templates/resources/resources.go b/pkg/templates/resources/resources.go index a0075d7e8..4f5b22c91 100644 --- a/pkg/templates/resources/resources.go +++ b/pkg/templates/resources/resources.go @@ -39,6 +39,7 @@ const ( AddonCSIHetzner = "csi-hetzner" AddonCSINutanix = "csi-nutanix" AddonCSIOpenStackCinder = "csi-openstack-cinder" + AddonCSIVMwareCloudDirector = "csi-vmware-cloud-director" AddonCSIVsphere = "csi-vsphere" AddonCNICanal = "cni-canal" AddonCNICilium = "cni-cilium" diff --git a/pkg/terraform/v1beta2/config.go b/pkg/terraform/v1beta2/config.go index fe0ccfcf6..a25bc8378 100644 --- a/pkg/terraform/v1beta2/config.go +++ b/pkg/terraform/v1beta2/config.go @@ -75,11 +75,13 @@ type Config struct { } type controlPlane struct { - ClusterName string `json:"cluster_name"` - CloudProvider *string `json:"cloud_provider"` - LeaderIP string `json:"leader_ip"` - Untaint bool `json:"untaint"` - NetworkID string `json:"network_id"` + ClusterName string `json:"cluster_name"` + CloudProvider *string `json:"cloud_provider"` + LeaderIP string `json:"leader_ip"` + Untaint bool `json:"untaint"` + NetworkID string `json:"network_id"` + VAppName string `json:"vapp_name"` + StorageProfile string `json:"storage_profile"` hostsSpec } @@ -263,6 +265,20 @@ func (output *Config) Apply(cluster *kubeonev1beta2.KubeOneCluster) error { cluster.CloudProvider.Hetzner.NetworkID = cp.NetworkID } + if cluster.CloudProvider.VMwareCloudDirector != nil { + // VAppName is used only for VMware Cloud Director. + if len(cp.VAppName) > 0 { + cluster.CloudProvider.VMwareCloudDirector.VApp = cp.VAppName + } else { + cluster.CloudProvider.VMwareCloudDirector.VApp = cluster.Name + } + + // Set StorageProfile. + if len(cp.StorageProfile) > 0 { + cluster.CloudProvider.VMwareCloudDirector.VApp = cp.VAppName + } + } + // Walk through all configued workersets from terraform and apply their config // by either merging it into an existing workerSet or creating a new one for workersetName, workersetValue := range output.KubeOneWorkers.Value {