From 25c6b0aebbc26df046e23f2ed35488010bb4044c Mon Sep 17 00:00:00 2001 From: Miguel Caballer Date: Mon, 20 May 2024 12:29:08 +0200 Subject: [PATCH] Enable multiple csi --- defaults/main.yml | 6 +++++- templates/longhorn.j2 | 2 ++ templates/nfs-client.j2 | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 952a01b3..74989243 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -67,6 +67,8 @@ kube_nfs_path: /pv kube_nfs_server: kubeserver.localdomain # Set reclaimPolicy of NFS StorageClass Delete or Retain kube_nfs_reclaim_policy: Delete +# Set default storage class +kube_nfs_set_default: true # Extra options for the flannel plugin kube_flanneld_extra_args: [] # Enable to install and manage Certificates with Cert-manager @@ -143,7 +145,7 @@ cilium_hubble_ui_ingress_host: "" cilium_hubble_ui_ingress_tls_host: "" cilium_hubble_ui_ingress_annotations: {} -# Longhorn support, if it is activated, the NFS client will be not installed +# Longhorn support kube_install_longhorn: false # Install ingress for Longhorn UI kube_install_longhorn_ingress: false @@ -153,3 +155,5 @@ kube_longhorn_ingress_auth: "longhorn:$apr1$e6BbrO3Q$llbCJ6cWJS/RWnLGYQhxX." longhorn_num_replicas: 3 # Set reclaimPolicy of Longhorn StorageClass Delete or Retain longhorn_reclaim_policy: Delete +# Set default storage class +longhorn_set_default: false \ No newline at end of file diff --git a/templates/longhorn.j2 b/templates/longhorn.j2 index 25c11273..120b1e38 100644 --- a/templates/longhorn.j2 +++ b/templates/longhorn.j2 @@ -83,8 +83,10 @@ data: apiVersion: storage.k8s.io/v1 metadata: name: longhorn +{% if longhorn_set_default %} annotations: storageclass.kubernetes.io/is-default-class: "true" +{% endif %} provisioner: driver.longhorn.io allowVolumeExpansion: true reclaimPolicy: "{{ longhorn_reclaim_policy }}" diff --git a/templates/nfs-client.j2 b/templates/nfs-client.j2 index 88d94bfa..cfdffa77 100644 --- a/templates/nfs-client.j2 +++ b/templates/nfs-client.j2 @@ -118,8 +118,10 @@ apiVersion: storage.k8s.io/v1 kind: StorageClass metadata: name: managed-nfs-storage +{% if kube_nfs_set_default %} annotations: storageclass.kubernetes.io/is-default-class: "true" +{% endif %} provisioner: fuseim.pri/ifs # or choose another name, must match deployment's env PROVISIONER_NAME' parameters: archiveOnDelete: "false"