merge-requests/4/merge
jerger 2 years ago
parent 8b8a39ceb3
commit 3a2f587709

@ -4,8 +4,8 @@
:license {:name "Apache License, Version 2.0" :license {:name "Apache License, Version 2.0"
:url "https://www.apache.org/licenses/LICENSE-2.0.html"} :url "https://www.apache.org/licenses/LICENSE-2.0.html"}
:dependencies [[org.clojure/clojure "1.10.3"] :dependencies [[org.clojure/clojure "1.10.3"]
[org.clojure/tools.reader "1.3.4"] [org.clojure/tools.reader "1.3.6"]
[org.domaindrivenarchitecture/c4k-common-clj "1.0.0"]] [org.domaindrivenarchitecture/c4k-common-clj "1.1.0"]]
:target-path "target/%s/" :target-path "target/%s/"
:source-paths ["src/main/cljc" :source-paths ["src/main/cljc"
"src/main/clj"] "src/main/clj"]

@ -25,28 +25,30 @@
(defn-spec k8s-objects any? (defn-spec k8s-objects any?
[config (s/merge config? auth?)] [config (s/merge config? auth?)]
(into (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))] (concat [(yaml/to-string (postgres/generate-config {:postgres-size :8gb}))
(when (contains? config :postgres-data-volume-path) (yaml/to-string (postgres/generate-secret config))]
[(yaml/to-string (postgres/generate-persistent-volume config))]) (when (contains? config :postgres-data-volume-path)
[(yaml/to-string (postgres/generate-pvc)) [(yaml/to-string (postgres/generate-persistent-volume config))])
(yaml/to-string (postgres/generate-deployment)) [(yaml/to-string (postgres/generate-pvc {:pv-storage-size-gb 50
(yaml/to-string (postgres/generate-service))] :pvc-storage-class-name storage-class}))
(when (contains? config :nextcloud-data-volume-path) (yaml/to-string (postgres/generate-deployment))
[(yaml/to-string (nextcloud/generate-persistent-volume config))]) (yaml/to-string (postgres/generate-service))]
[(yaml/to-string (nextcloud/generate-secret config)) (when (contains? config :nextcloud-data-volume-path)
(yaml/to-string (nextcloud/generate-pvc)) [(yaml/to-string (nextcloud/generate-persistent-volume config))])
(yaml/to-string (nextcloud/generate-deployment config)) [(yaml/to-string (nextcloud/generate-secret config))
(yaml/to-string (nextcloud/generate-service)) (yaml/to-string (nextcloud/generate-pvc config))
(yaml/to-string (nextcloud/generate-certificate config)) (yaml/to-string (nextcloud/generate-deployment config))
(yaml/to-string (nextcloud/generate-ingress config))] (yaml/to-string (nextcloud/generate-service))
(when (contains? config :restic-repository) (yaml/to-string (nextcloud/generate-certificate config))
[(yaml/to-string (backup/generate-config config)) (yaml/to-string (nextcloud/generate-ingress config))]
(yaml/to-string (backup/generate-secret config)) (when (contains? config :restic-repository)
(yaml/to-string (backup/generate-cron)) [(yaml/to-string (backup/generate-config config))
(yaml/to-string (backup/generate-backup-restore-deployment 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? (defn-spec generate any?
[my-config config? [my-config config?

@ -58,6 +58,7 @@
))) )))
(defn generate-pvc [] (defn generate-pvc []
(let [{:keys [nextcloud-data-volume-path storage-size]} config])
(yaml/from-string (yaml/load-resource "nextcloud/pvc.yaml"))) (yaml/from-string (yaml/load-resource "nextcloud/pvc.yaml")))
(defn generate-service [] (defn generate-service []

Loading…
Cancel
Save