From 70062503758a01c0be3f0dd2a4e2e23a646c1eef Mon Sep 17 00:00:00 2001 From: see Date: Fri, 18 Mar 2022 14:28:20 +0100 Subject: [PATCH] mob --- src/main/cljc/dda/c4k_nextcloud/core.cljc | 11 +++++++---- src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc | 4 +--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/cljc/dda/c4k_nextcloud/core.cljc b/src/main/cljc/dda/c4k_nextcloud/core.cljc index 7616fc4..20b57e2 100644 --- a/src/main/cljc/dda/c4k_nextcloud/core.cljc +++ b/src/main/cljc/dda/c4k_nextcloud/core.cljc @@ -18,7 +18,10 @@ (defn-spec k8s-objects any? [config (s/merge nextcloud/config? auth?)] - (let [storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path)] + (let [postgres-storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path) + nextcloud-storage-class (if (contains? config :nextcloud-data-volume-path) :manual :local-path) + nextcloud-default-storage-config {:pvc-storage-class-name nextcloud-storage-class :pv-storage-size-gb 200}] + (into [] (concat [(yaml/to-string (postgres/generate-config {:postgres-size :8gb})) @@ -26,13 +29,13 @@ (when (contains? config :postgres-data-volume-path) [(yaml/to-string (postgres/generate-persistent-volume config))]) [(yaml/to-string (postgres/generate-pvc {:pv-storage-size-gb 50 - :pvc-storage-class-name storage-class})) + :pvc-storage-class-name postgres-storage-class})) (yaml/to-string (postgres/generate-deployment)) (yaml/to-string (postgres/generate-service))] (when (contains? config :nextcloud-data-volume-path) - [(yaml/to-string (nextcloud/generate-persistent-volume config))]) + [(yaml/to-string (nextcloud/generate-persistent-volume (merge nextcloud-default-storage-config config)))]) [(yaml/to-string (nextcloud/generate-secret config)) - (yaml/to-string (nextcloud/generate-pvc config)) + (yaml/to-string (nextcloud/generate-pvc (merge nextcloud-default-storage-config config))) (yaml/to-string (nextcloud/generate-deployment config)) (yaml/to-string (nextcloud/generate-service)) (yaml/to-string (nextcloud/generate-certificate config)) diff --git a/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc b/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc index e99967b..1c0b49f 100644 --- a/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc +++ b/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc @@ -69,9 +69,7 @@ (defn-spec generate-pvc cp/map-or-seq? [config config?] - (let [{:keys [pv-storage-size-gb pvc-storage-class-name] - :or {pv-storage-size-gb 50 - pvc-storage-class-name :manual}} config] + (let [{:keys [pv-storage-size-gb pvc-storage-class-name]} config] (-> (yaml/from-string (yaml/load-resource "nextcloud/pvc.yaml")) (assoc-in [:spec :resources :requests :storage] (str pv-storage-size-gb "Gi"))