Added volume-size to config and added todo
This commit is contained in:
parent
54ce871333
commit
ac2a4da7b4
3 changed files with 15 additions and 13 deletions
|
@ -5,7 +5,7 @@
|
|||
:url "https://www.apache.org/licenses/LICENSE-2.0.html"}
|
||||
:dependencies [[org.clojure/clojure "1.10.3"]
|
||||
[org.clojure/tools.reader "1.3.6"]
|
||||
[org.domaindrivenarchitecture/c4k-common-clj "3.0.1"]
|
||||
[org.domaindrivenarchitecture/c4k-common-clj "3.0.2-SNAPSHOT"]
|
||||
[hickory "0.7.1"]]
|
||||
:target-path "target/%s/"
|
||||
:source-paths ["src/main/cljc"
|
||||
|
|
|
@ -5,13 +5,14 @@
|
|||
[dda.c4k-common.common :as cm]
|
||||
[dda.c4k-website.website :as website]))
|
||||
|
||||
(def config-defaults {:issuer "staging"})
|
||||
(def config-defaults {:issuer "staging"
|
||||
:volume-size "3"})
|
||||
|
||||
; TODO: gec 2022/10/28: That does only work if the :websites and :auth collections have the same order regarding :unique-name!
|
||||
; There must be a check or the config must be sorted first!
|
||||
(defn flatten-and-reduce-config
|
||||
[config]
|
||||
(merge (-> config :websites first) (-> config :auth first) {:issuer (config :issuer)}))
|
||||
(merge (-> config :websites first) (-> config :auth first) (dissoc config :issuer :volume-size)))
|
||||
|
||||
(defn generate-configs [config]
|
||||
(loop [config config
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
|
||||
(s/def ::unique-name string?)
|
||||
(s/def ::issuer pred/letsencrypt-issuer?)
|
||||
(s/def ::volume-size pred/integer-string?)
|
||||
(s/def ::authtoken pred/bash-env-string?)
|
||||
(s/def ::fqdns (s/coll-of pred/fqdn-string?))
|
||||
(s/def ::gitea-host pred/fqdn-string?)
|
||||
|
@ -38,10 +39,7 @@
|
|||
(def auth? (s/keys :req-un [::auth]))
|
||||
|
||||
(def config? (s/keys :req-un [::websites]
|
||||
:opt-un [::issuer]))
|
||||
|
||||
; TODO: Review jem 2022/10/26: move default to core/default
|
||||
(def volume-size 3)
|
||||
:opt-un [::issuer ::volume-size]))
|
||||
|
||||
(defn-spec replace-dots-by-minus string?
|
||||
[fqdn pred/fqdn-string?]
|
||||
|
@ -99,6 +97,9 @@
|
|||
(defmethod yaml/load-as-edn :website [resource-name]
|
||||
(yaml/from-string (yaml/load-resource resource-name))))
|
||||
|
||||
; TODO: gec 2022/10/28: The specs for config in the following functions are not correct,
|
||||
; since config is the result of "flatten-and-reduce-config".
|
||||
; Use correct specs!
|
||||
(defn-spec generate-website-http-ingress pred/map-or-seq?
|
||||
[config websitedata?]
|
||||
(let [{:keys [unique-name fqdns]} config]
|
||||
|
@ -151,11 +152,11 @@
|
|||
|
||||
(defn-spec generate-website-content-volume pred/map-or-seq?
|
||||
[config websitedata?]
|
||||
(let [{:keys [unique-name]} config]
|
||||
(let [{:keys [unique-name volume-size]} config]
|
||||
(->
|
||||
(yaml/load-as-edn "website/website-content-volume.yaml")
|
||||
(replace-all-matching-subvalues-in-string-start "NAME" (replace-dots-by-minus unique-name))
|
||||
(cm/replace-all-matching-values-by-new-value "WEBSITESTORAGESIZE" (str (str volume-size) "Gi")))))
|
||||
(cm/replace-all-matching-values-by-new-value "WEBSITESTORAGESIZE" (str volume-size "Gi")))))
|
||||
|
||||
(defn-spec generate-website-build-cron pred/map-or-seq?
|
||||
[config websitedata?]
|
||||
|
|
Loading…
Reference in a new issue