From 1a040c92a1958317ffc52211574063f472f4b0a6 Mon Sep 17 00:00:00 2001 From: Tine Date: Tue, 28 Jan 2025 18:28:32 +0100 Subject: [PATCH] feat(k8s.tjo.cloud): setup hybrid csi --- k8s.tjo.cloud/modules/cluster/components.tf | 38 ++++++++++++--------- k8s.tjo.cloud/modules/cluster/main.tf | 35 +++++++++++++++++-- 2 files changed, 54 insertions(+), 19 deletions(-) diff --git a/k8s.tjo.cloud/modules/cluster/components.tf b/k8s.tjo.cloud/modules/cluster/components.tf index 4068ae0..d0885f8 100644 --- a/k8s.tjo.cloud/modules/cluster/components.tf +++ b/k8s.tjo.cloud/modules/cluster/components.tf @@ -111,23 +111,6 @@ data "helm_template" "proxmox-csi" { token_secret: "${split("=", proxmox_virtual_environment_user_token.csi.value)[1]}" region: "${var.proxmox.name}" - storageClass: - - name: proxmox-local-nvme - storage: local-nvme - reclaimPolicy: Delete - fstype: ext4 - cache: none - - name: proxmox-local - storage: local - reclaimPolicy: Delete - fstype: ext4 - cache: none - - name: proxmox-local-nvme-lvm - storage: local-nvme-lvm - reclaimPolicy: Delete - fstype: ext4 - cache: none - nodeSelector: node-role.kubernetes.io/control-plane: "" node.cloudprovider.kubernetes.io/platform: nocloud @@ -145,6 +128,27 @@ data "helm_template" "proxmox-csi" { ] } +data "helm_template" "hybrid-csi" { + provider = helm.template + + name = "hybrid-csi-plugin" + chart = "hybrid-csi-plugin" + repository = "oci://ghcr.io/sergelogvinov/charts" + version = "0.1.5" + namespace = "kube-system" + + kube_version = var.talos.kubernetes + + values = [<<-EOF + nodeSelector: + node-role.kubernetes.io/control-plane: "" + tolerations: + - key: node-role.kubernetes.io/control-plane + effect: NoSchedule + EOF + ] +} + data "helm_template" "proxmox-ccm" { provider = helm.template name = "proxmox-cloud-controller-manager" diff --git a/k8s.tjo.cloud/modules/cluster/main.tf b/k8s.tjo.cloud/modules/cluster/main.tf index 71d5e3f..88fd9d3 100644 --- a/k8s.tjo.cloud/modules/cluster/main.tf +++ b/k8s.tjo.cloud/modules/cluster/main.tf @@ -54,6 +54,10 @@ locals { name = "promxmox-csi-plugin" contents = data.helm_template.proxmox-csi.manifest }, + { + name = "hubrid-csi-plugin" + contents = data.helm_template.hybrid-csi.manifest + }, { name = "gateway-api-crds" contents = file("${path.module}/manifests/gateway-api.crds.yaml") @@ -162,8 +166,35 @@ locals { peerConfigRef: name: "default" EOF - } - ] + }], + [for name, attributes in var.hosts : { + name = "proxmox-cni-storage-class-${name}" + contents = <<-EOF + apiVersion: storage.k8s.io/v1 + kind: StorageClass + metadata: + name: ${name} + annotations: + k8s.tjo.cloud/host: ${name} + k8s.tjo.cloud/proxmox: ${var.proxmox.name} + parameters: + storage: ${attributes.storage} + csi.storage.k8s.io/fstype: ext4 + cache: none + provisioner: csi.proxmox.sinextra.dev + allowVolumeExpansion: true + reclaimPolicy: Delete + volumeBindingMode: WaitForFirstConsumer + allowedTopologies: + - matchLabelExpressions: + - key: topology.kubernetes.io/region + values: + - ${var.proxmox.name} + - key: topology.kubernetes.io/zone + values: + - ${name} + EOF + }], ) } }