This commit is contained in:
see 2022-03-18 14:28:20 +01:00
parent 4538cc5a24
commit 7006250375
2 changed files with 8 additions and 7 deletions

View file

@ -18,7 +18,10 @@
(defn-spec k8s-objects any? (defn-spec k8s-objects any?
[config (s/merge nextcloud/config? auth?)] [config (s/merge nextcloud/config? auth?)]
(let [storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path)] (let [postgres-storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path)
nextcloud-storage-class (if (contains? config :nextcloud-data-volume-path) :manual :local-path)
nextcloud-default-storage-config {:pvc-storage-class-name nextcloud-storage-class :pv-storage-size-gb 200}]
(into (into
[] []
(concat [(yaml/to-string (postgres/generate-config {:postgres-size :8gb})) (concat [(yaml/to-string (postgres/generate-config {:postgres-size :8gb}))
@ -26,13 +29,13 @@
(when (contains? config :postgres-data-volume-path) (when (contains? config :postgres-data-volume-path)
[(yaml/to-string (postgres/generate-persistent-volume config))]) [(yaml/to-string (postgres/generate-persistent-volume config))])
[(yaml/to-string (postgres/generate-pvc {:pv-storage-size-gb 50 [(yaml/to-string (postgres/generate-pvc {:pv-storage-size-gb 50
:pvc-storage-class-name storage-class})) :pvc-storage-class-name postgres-storage-class}))
(yaml/to-string (postgres/generate-deployment)) (yaml/to-string (postgres/generate-deployment))
(yaml/to-string (postgres/generate-service))] (yaml/to-string (postgres/generate-service))]
(when (contains? config :nextcloud-data-volume-path) (when (contains? config :nextcloud-data-volume-path)
[(yaml/to-string (nextcloud/generate-persistent-volume config))]) [(yaml/to-string (nextcloud/generate-persistent-volume (merge nextcloud-default-storage-config config)))])
[(yaml/to-string (nextcloud/generate-secret config)) [(yaml/to-string (nextcloud/generate-secret config))
(yaml/to-string (nextcloud/generate-pvc config)) (yaml/to-string (nextcloud/generate-pvc (merge nextcloud-default-storage-config config)))
(yaml/to-string (nextcloud/generate-deployment config)) (yaml/to-string (nextcloud/generate-deployment config))
(yaml/to-string (nextcloud/generate-service)) (yaml/to-string (nextcloud/generate-service))
(yaml/to-string (nextcloud/generate-certificate config)) (yaml/to-string (nextcloud/generate-certificate config))

View file

@ -69,9 +69,7 @@
(defn-spec generate-pvc cp/map-or-seq? (defn-spec generate-pvc cp/map-or-seq?
[config config?] [config config?]
(let [{:keys [pv-storage-size-gb pvc-storage-class-name] (let [{:keys [pv-storage-size-gb pvc-storage-class-name]} config]
:or {pv-storage-size-gb 50
pvc-storage-class-name :manual}} config]
(-> (->
(yaml/from-string (yaml/load-resource "nextcloud/pvc.yaml")) (yaml/from-string (yaml/load-resource "nextcloud/pvc.yaml"))
(assoc-in [:spec :resources :requests :storage] (str pv-storage-size-gb "Gi")) (assoc-in [:spec :resources :requests :storage] (str pv-storage-size-gb "Gi"))