use the new pcv defaults

This commit is contained in:
Michael Jerger 2024-05-31 16:43:06 +02:00
parent 8aef785bdc
commit 4764d1db67

View file

@ -11,35 +11,33 @@
[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))))))))