use the new pcv defaults
This commit is contained in:
parent
8aef785bdc
commit
4764d1db67
1 changed files with 28 additions and 30 deletions
|
@ -1,45 +1,43 @@
|
||||||
(ns dda.c4k-nextcloud.core
|
(ns dda.c4k-nextcloud.core
|
||||||
(:require
|
(:require
|
||||||
#?(:clj [orchestra.core :refer [defn-spec]]
|
#?(:clj [orchestra.core :refer [defn-spec]]
|
||||||
:cljs [orchestra.core :refer-macros [defn-spec]])
|
:cljs [orchestra.core :refer-macros [defn-spec]])
|
||||||
[dda.c4k-common.common :as cm]
|
[dda.c4k-common.common :as cm]
|
||||||
[dda.c4k-common.predicate :as cp]
|
[dda.c4k-common.predicate :as cp]
|
||||||
[dda.c4k-common.yaml :as yaml]
|
[dda.c4k-common.yaml :as yaml]
|
||||||
[dda.c4k-common.postgres :as postgres]
|
[dda.c4k-common.postgres :as postgres]
|
||||||
[dda.c4k-nextcloud.nextcloud :as nextcloud]
|
[dda.c4k-nextcloud.nextcloud :as nextcloud]
|
||||||
[dda.c4k-nextcloud.backup :as backup]
|
[dda.c4k-nextcloud.backup :as backup]
|
||||||
[dda.c4k-common.monitoring :as mon]
|
[dda.c4k-common.monitoring :as mon]
|
||||||
[dda.c4k-common.namespace :as ns]))
|
[dda.c4k-common.namespace :as ns]))
|
||||||
|
|
||||||
(def default-storage-class "local-path")
|
(def config-defaults {:namespace "nextcloud"
|
||||||
|
:issuer "staging"
|
||||||
(def config-defaults {:issuer "staging"})
|
:pvc-storage-class-name "hcloud-volumes-encrypted"
|
||||||
|
:pv-storage-size-gb 200})
|
||||||
|
|
||||||
(defn-spec k8s-objects cp/map-or-seq?
|
(defn-spec k8s-objects cp/map-or-seq?
|
||||||
[config nextcloud/config?
|
[config nextcloud/config?
|
||||||
auth nextcloud/auth?]
|
auth nextcloud/auth?]
|
||||||
(let [nextcloud-default-storage-config {:pvc-storage-class-name default-storage-class
|
(let [resolved-config (merge config-defaults config)]
|
||||||
:pv-storage-size-gb 200}]
|
|
||||||
(map yaml/to-string
|
(map yaml/to-string
|
||||||
(filter
|
(filter
|
||||||
#(not (nil? %))
|
#(not (nil? %))
|
||||||
(cm/concat-vec
|
(cm/concat-vec
|
||||||
(ns/generate (merge {:namespace "nextcloud"} config))
|
(ns/generate resolved-config)
|
||||||
(postgres/generate {:postgres-size :8gb
|
(postgres/generate (merge resolved-config {:postgres-size :8gb
|
||||||
:db-name "cloud"
|
:db-name "cloud"
|
||||||
:pv-storage-size-gb 50
|
:pv-storage-size-gb 50})
|
||||||
:pvc-storage-class-name default-storage-class
|
|
||||||
:namespace "nextcloud"}
|
|
||||||
auth)
|
auth)
|
||||||
[(nextcloud/generate-secret auth)
|
[(nextcloud/generate-secret auth)
|
||||||
(nextcloud/generate-pvc (merge nextcloud-default-storage-config config))
|
(nextcloud/generate-pvc resolved-config)
|
||||||
(nextcloud/generate-deployment config)
|
(nextcloud/generate-deployment resolved-config)
|
||||||
(nextcloud/generate-service)]
|
(nextcloud/generate-service)]
|
||||||
(nextcloud/generate-ingress-and-cert (merge {:namespace "nextcloud"} config))
|
(nextcloud/generate-ingress-and-cert resolved-config)
|
||||||
(when (:contains? config :restic-repository)
|
(when (:contains? resolved-config :restic-repository)
|
||||||
[(backup/generate-config config)
|
[(backup/generate-config resolved-config)
|
||||||
(backup/generate-secret auth)
|
(backup/generate-secret auth)
|
||||||
(backup/generate-cron)
|
(backup/generate-cron)
|
||||||
(backup/generate-backup-restore-deployment config)])
|
(backup/generate-backup-restore-deployment resolved-config)])
|
||||||
(when (:contains? config :mon-cfg)
|
(when (:contains? resolved-config :mon-cfg)
|
||||||
(mon/generate (:mon-cfg config) (:mon-auth auth))))))))
|
(mon/generate (:mon-cfg resolved-config) (:mon-auth auth))))))))
|
||||||
|
|
Loading…
Reference in a new issue