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.namespace :as ns]))
(def default-storage-class "local-path")
(def config-defaults {:issuer "staging"})
(def config-defaults {:namespace "nextcloud"
:issuer "staging"
:pvc-storage-class-name "hcloud-volumes-encrypted"
:pv-storage-size-gb 200})
(defn-spec k8s-objects cp/map-or-seq?
[config nextcloud/config?
auth nextcloud/auth?]
(let [nextcloud-default-storage-config {:pvc-storage-class-name default-storage-class
:pv-storage-size-gb 200}]
(let [resolved-config (merge config-defaults config)]
(map yaml/to-string
(filter
#(not (nil? %))
(cm/concat-vec
(ns/generate (merge {:namespace "nextcloud"} config))
(postgres/generate {:postgres-size :8gb
(ns/generate resolved-config)
(postgres/generate (merge resolved-config {:postgres-size :8gb
:db-name "cloud"
:pv-storage-size-gb 50
:pvc-storage-class-name default-storage-class
:namespace "nextcloud"}
:pv-storage-size-gb 50})
auth)
[(nextcloud/generate-secret auth)
(nextcloud/generate-pvc (merge nextcloud-default-storage-config config))
(nextcloud/generate-deployment config)
(nextcloud/generate-pvc resolved-config)
(nextcloud/generate-deployment resolved-config)
(nextcloud/generate-service)]
(nextcloud/generate-ingress-and-cert (merge {:namespace "nextcloud"} config))
(when (:contains? config :restic-repository)
[(backup/generate-config config)
(nextcloud/generate-ingress-and-cert resolved-config)
(when (:contains? resolved-config :restic-repository)
[(backup/generate-config resolved-config)
(backup/generate-secret auth)
(backup/generate-cron)
(backup/generate-backup-restore-deployment config)])
(when (:contains? config :mon-cfg)
(mon/generate (:mon-cfg config) (:mon-auth auth))))))))
(backup/generate-backup-restore-deployment resolved-config)])
(when (:contains? resolved-config :mon-cfg)
(mon/generate (:mon-cfg resolved-config) (:mon-auth auth))))))))