From 3a2f58770997c175174fd09ad9cd4529505c0d11 Mon Sep 17 00:00:00 2001 From: jerger Date: Fri, 18 Mar 2022 11:50:27 +0100 Subject: [PATCH] mob --- project.clj | 4 +- src/main/cljc/dda/c4k_nextcloud/core.cljc | 46 ++++++++++--------- .../cljc/dda/c4k_nextcloud/nextcloud.cljc | 1 + 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/project.clj b/project.clj index 26e07f4..5780d47 100644 --- a/project.clj +++ b/project.clj @@ -4,8 +4,8 @@ :license {:name "Apache License, Version 2.0" :url "https://www.apache.org/licenses/LICENSE-2.0.html"} :dependencies [[org.clojure/clojure "1.10.3"] - [org.clojure/tools.reader "1.3.4"] - [org.domaindrivenarchitecture/c4k-common-clj "1.0.0"]] + [org.clojure/tools.reader "1.3.6"] + [org.domaindrivenarchitecture/c4k-common-clj "1.1.0"]] :target-path "target/%s/" :source-paths ["src/main/cljc" "src/main/clj"] diff --git a/src/main/cljc/dda/c4k_nextcloud/core.cljc b/src/main/cljc/dda/c4k_nextcloud/core.cljc index a0cc664..ebdc1b2 100644 --- a/src/main/cljc/dda/c4k_nextcloud/core.cljc +++ b/src/main/cljc/dda/c4k_nextcloud/core.cljc @@ -25,28 +25,30 @@ (defn-spec k8s-objects any? [config (s/merge config? auth?)] - (into - [] - (concat [(yaml/to-string (postgres/generate-config {:postgres-size :8gb})) - (yaml/to-string (postgres/generate-secret config))] - (when (contains? config :postgres-data-volume-path) - [(yaml/to-string (postgres/generate-persistent-volume config))]) - [(yaml/to-string (postgres/generate-pvc)) - (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-secret config)) - (yaml/to-string (nextcloud/generate-pvc)) - (yaml/to-string (nextcloud/generate-deployment config)) - (yaml/to-string (nextcloud/generate-service)) - (yaml/to-string (nextcloud/generate-certificate config)) - (yaml/to-string (nextcloud/generate-ingress config))] - (when (contains? config :restic-repository) - [(yaml/to-string (backup/generate-config config)) - (yaml/to-string (backup/generate-secret config)) - (yaml/to-string (backup/generate-cron)) - (yaml/to-string (backup/generate-backup-restore-deployment config))])))) + (let [storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path)] + (into + [] + (concat [(yaml/to-string (postgres/generate-config {:postgres-size :8gb})) + (yaml/to-string (postgres/generate-secret config))] + (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})) + (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-secret config)) + (yaml/to-string (nextcloud/generate-pvc config)) + (yaml/to-string (nextcloud/generate-deployment config)) + (yaml/to-string (nextcloud/generate-service)) + (yaml/to-string (nextcloud/generate-certificate config)) + (yaml/to-string (nextcloud/generate-ingress config))] + (when (contains? config :restic-repository) + [(yaml/to-string (backup/generate-config config)) + (yaml/to-string (backup/generate-secret config)) + (yaml/to-string (backup/generate-cron)) + (yaml/to-string (backup/generate-backup-restore-deployment config))]))))) (defn-spec generate any? [my-config config? diff --git a/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc b/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc index 9eddd08..6ee2617 100644 --- a/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc +++ b/src/main/cljc/dda/c4k_nextcloud/nextcloud.cljc @@ -58,6 +58,7 @@ ))) (defn generate-pvc [] + (let [{:keys [nextcloud-data-volume-path storage-size]} config]) (yaml/from-string (yaml/load-resource "nextcloud/pvc.yaml"))) (defn generate-service []