From b509bb4228e921a7d6eb8bc13875e6668779e322 Mon Sep 17 00:00:00 2001 From: bom Date: Fri, 18 Mar 2022 15:43:36 +0100 Subject: [PATCH] added local-path-provisioner config --- .../provs/server/infrastructure/K3s.kt | 7 +++++++ .../k3s/local-path-provisioner-config.yaml | 15 +++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 src/main/resources/org/domaindrivenarchitecture/provs/server/infrastructure/k3s/local-path-provisioner-config.yaml diff --git a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K3s.kt b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K3s.kt index abfa613..61b6637 100644 --- a/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K3s.kt +++ b/src/main/kotlin/org/domaindrivenarchitecture/provs/server/infrastructure/K3s.kt @@ -32,6 +32,8 @@ private val certManagerIssuer = File(k3sManualManifestsDir, "le-issuer.yaml") private val k3sEcho = File(k3sManualManifestsDir, "echo.yaml") private val selfSignedCertificate = File(k3sManualManifestsDir, "selfsigned-certificate.yaml") +private val localPathProvisionerConfig = File(k3sManualManifestsDir, "local-path-provisioner-config.yaml") + // ----------------------------------- public functions -------------------------------- @@ -57,6 +59,8 @@ fun Prov.installK3s(k3sConfig: K3sConfig) = task { createDirs(k8sCredentialsDir, sudo = true) createDirs(k3sAutomatedManifestsDir, sudo = true) createDirs(k3sManualManifestsDir, sudo = true) + createDirs("/var/pvc1", sudo = true) + createDirs("/var/pvc2", sudo = true) var k3sConfigMap: Map = mapOf( "loopback_ipv4" to k3sConfig.loopback.ipv4, @@ -96,6 +100,9 @@ fun Prov.installK3s(k3sConfig: K3sConfig) = task { } else { ProvResult(true) } + + applyK3sFileFromResource(localPathProvisionerConfig) + cmd("ln -sf $k3sKubeConfig " + k8sCredentialsDir + "admin.conf", sudo = true) } diff --git a/src/main/resources/org/domaindrivenarchitecture/provs/server/infrastructure/k3s/local-path-provisioner-config.yaml b/src/main/resources/org/domaindrivenarchitecture/provs/server/infrastructure/k3s/local-path-provisioner-config.yaml new file mode 100644 index 0000000..bd90799 --- /dev/null +++ b/src/main/resources/org/domaindrivenarchitecture/provs/server/infrastructure/k3s/local-path-provisioner-config.yaml @@ -0,0 +1,15 @@ +kind: ConfigMap +apiVersion: v1 +metadata: + name: local-path-config + namespace: kube-system +data: + config.json: |- + { + "nodePathMap":[ + { + "node":"DEFAULT_PATH_FOR_NON_LISTED_NODES", + "paths":["/var/pvc1","/var/pvc2"] + } + ] + }