adjusted configs
This commit is contained in:
parent
d3dd3ca5ef
commit
0055eb3435
1 changed files with 36 additions and 37 deletions
|
@ -9,7 +9,14 @@
|
||||||
[dda.c4k-common.postgres :as postgres]
|
[dda.c4k-common.postgres :as postgres]
|
||||||
[dda.c4k-common.namespace :as ns]))
|
[dda.c4k-common.namespace :as ns]))
|
||||||
|
|
||||||
(def config-defaults {:issuer "staging", :deploy-federated "false"})
|
(def config-defaults {:namespace "forgejo"
|
||||||
|
:issuer "staging"
|
||||||
|
:deploy-federated "false"
|
||||||
|
:db-name "forgejo"
|
||||||
|
:pv-storage-size-gb 5
|
||||||
|
:pvc-storage-class-name ""
|
||||||
|
:postgres-image "postgres:14"
|
||||||
|
:postgres-size :2gb})
|
||||||
(def rate-limit-defaults {:max-rate 10, :max-concurrent-requests 5})
|
(def rate-limit-defaults {:max-rate 10, :max-concurrent-requests 5})
|
||||||
|
|
||||||
(def config? (s/keys :req-un [::forgejo/fqdn
|
(def config? (s/keys :req-un [::forgejo/fqdn
|
||||||
|
@ -33,48 +40,40 @@
|
||||||
|
|
||||||
(def vol? (s/keys :req-un [::forgejo/volume-total-storage-size]))
|
(def vol? (s/keys :req-un [::forgejo/volume-total-storage-size]))
|
||||||
|
|
||||||
(def postgres-config {:db-name "forgejo"
|
|
||||||
:pv-storage-size-gb 5
|
|
||||||
:pvc-storage-class-name ""
|
|
||||||
:postgres-image "postgres:14"
|
|
||||||
:postgres-size :2gb})
|
|
||||||
|
|
||||||
(defn config-objects [config] ; ToDo: ADR for generate functions - vector or no vector?
|
(defn config-objects [config] ; ToDo: ADR for generate functions - vector or no vector?
|
||||||
(let [storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path)
|
(let [storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path)]
|
||||||
resolved-config (merge {:namespace "forgejo"} postgres-config config)]
|
|
||||||
(map yaml/to-string
|
(map yaml/to-string
|
||||||
(filter #(not (nil? %))
|
(filter #(not (nil? %))
|
||||||
(cm/concat-vec
|
(cm/concat-vec
|
||||||
(ns/generate resolved-config)
|
(ns/generate config)
|
||||||
[(postgres/generate-config resolved-config)
|
[(postgres/generate-config-configmap config)
|
||||||
(when (contains? resolved-config :postgres-data-volume-path)
|
(when (contains? config :postgres-data-volume-path)
|
||||||
(postgres/generate-persistent-volume (select-keys resolved-config [:postgres-data-volume-path :pv-storage-size-gb])))
|
(postgres/generate-persistent-volume (select-keys config [:postgres-data-volume-path :pv-storage-size-gb])))
|
||||||
(postgres/generate-pvc (merge resolved-config {:pvc-storage-class-name storage-class}))
|
(postgres/generate-pvc (merge config {:pvc-storage-class-name storage-class}))
|
||||||
(postgres/generate-deployment resolved-config)
|
(postgres/generate-deployment config)
|
||||||
(postgres/generate-service resolved-config)
|
(postgres/generate-service config)
|
||||||
(forgejo/generate-deployment resolved-config)
|
(forgejo/generate-deployment config)
|
||||||
(forgejo/generate-service)
|
(forgejo/generate-service)
|
||||||
(forgejo/generate-service-ssh)
|
(forgejo/generate-service-ssh)
|
||||||
(forgejo/generate-data-volume resolved-config)
|
(forgejo/generate-data-volume config)
|
||||||
(forgejo/generate-appini-env resolved-config)]
|
(forgejo/generate-appini-env config)]
|
||||||
(forgejo/generate-ratelimit-ingress-and-cert resolved-config) ; this function has a vector as output
|
(forgejo/generate-ratelimit-ingress-and-cert config) ; this function has a vector as output
|
||||||
(when (contains? resolved-config :restic-repository)
|
(when (contains? config :restic-repository)
|
||||||
[(backup/generate-config resolved-config)
|
[(backup/generate-config config)
|
||||||
(backup/generate-cron)
|
(backup/generate-cron)
|
||||||
(backup/generate-backup-restore-deployment resolved-config)])
|
(backup/generate-backup-restore-deployment config)])
|
||||||
(when (:contains? resolved-config :mon-cfg)
|
(when (contains? config :mon-cfg)
|
||||||
(mon/generate-config)))))))
|
(mon/generate-config)))))))
|
||||||
|
|
||||||
(defn auth-objects [config auth] ; ToDo: ADR for generate functions - vector or no vector?
|
; REVIEW gec: In general, how do we handle config and auth for auth-objects?
|
||||||
(let [storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path)
|
(defn auth-objects [config] ; ToDo: ADR for generate functions - vector or no vector?
|
||||||
resolved-config (merge {:namespace "forgejo"} postgres-config config)]
|
(map yaml/to-string
|
||||||
(map yaml/to-string
|
(filter #(not (nil? %))
|
||||||
(filter #(not (nil? %))
|
(cm/concat-vec
|
||||||
(cm/concat-vec
|
(ns/generate config)
|
||||||
(ns/generate resolved-config)
|
[(postgres/generate-secret config config) ; "config config" seems not right
|
||||||
[(postgres/generate-secret {:namespace "forgejo"} auth)
|
(forgejo/generate-secrets config)]
|
||||||
(forgejo/generate-secrets auth)]
|
(when (contains? config :restic-repository)
|
||||||
(when (contains? resolved-config :restic-repository)
|
[(backup/generate-secret config)])
|
||||||
[(backup/generate-secret auth)])
|
(when (contains? config :mon-cfg)
|
||||||
(when (:contains? resolved-config :mon-cfg)
|
(mon/generate-auth (:mon-cfg config) (:mon-auth config))))))) ; Here also "config config" seems not right
|
||||||
(mon/generate-auth (:mon-cfg resolved-config) (:mon-auth auth))))))))
|
|
||||||
|
|
Loading…
Reference in a new issue