added build-configmap generation
This commit is contained in:
parent
e02f4949fc
commit
9e75c22337
4 changed files with 18 additions and 33 deletions
|
@ -118,23 +118,23 @@
|
|||
(->
|
||||
sorted-auth
|
||||
(assoc-in [:websiteauths] (rest (sorted-auth :websiteauths))))
|
||||
(let [final-config
|
||||
(let [curr-flat-websiteconfig
|
||||
(merge
|
||||
website-config-defaults
|
||||
(flatten-and-reduce-config sorted-config))
|
||||
name (web/replace-dots-by-minus (:unique-name final-config))]
|
||||
name (web/replace-dots-by-minus (:unique-name curr-flat-websiteconfig))]
|
||||
(cm/concat-vec
|
||||
result
|
||||
(ns/generate (merge {:namespace name} final-config))
|
||||
[(web/generate-nginx-deployment final-config)
|
||||
(web/generate-nginx-configmap final-config)
|
||||
(web/generate-nginx-service final-config)
|
||||
(web/generate-content-pvc final-config)
|
||||
(web/generate-hash-state-pvc final-config)
|
||||
(web/generate-build-cron final-config)
|
||||
(web/generate-build-secret final-config
|
||||
(flatten-and-reduce-auth auth))]
|
||||
(generate-ingress final-config)))))))
|
||||
(ns/generate (merge {:namespace name} curr-flat-websiteconfig))
|
||||
[(web/generate-nginx-deployment curr-flat-websiteconfig)
|
||||
(web/generate-nginx-configmap curr-flat-websiteconfig)
|
||||
(web/generate-nginx-service curr-flat-websiteconfig)
|
||||
(web/generate-content-pvc curr-flat-websiteconfig)
|
||||
(web/generate-hash-state-pvc curr-flat-websiteconfig)
|
||||
(web/generate-build-cron curr-flat-websiteconfig)
|
||||
(web/generate-build-configmap curr-flat-websiteconfig)
|
||||
(web/generate-build-secret (flatten-and-reduce-auth auth))]
|
||||
(generate-ingress curr-flat-websiteconfig)))))))
|
||||
|
||||
(defn-spec k8s-objects cp/map-or-seq?
|
||||
[config config?
|
||||
|
|
|
@ -104,7 +104,7 @@
|
|||
#"REDIRECTS"
|
||||
(generate-redirects config 2)))))))
|
||||
|
||||
; TODO add test
|
||||
; TODO add test & add to build-cron env
|
||||
(defn-spec generate-build-configmap pred/map-or-seq?
|
||||
[config websiteconfig?]
|
||||
(let [{:keys [unique-name
|
||||
|
@ -127,12 +127,10 @@
|
|||
forgejo-host
|
||||
forgejo-repo
|
||||
repo-user))))))
|
||||
; TODO: remove config
|
||||
|
||||
(defn-spec generate-build-secret pred/map-or-seq?
|
||||
[config websiteconfig?
|
||||
auth websiteauth?]
|
||||
(let [{:keys [unique-name]} config
|
||||
{:keys [unique-name
|
||||
[auth websiteauth?]
|
||||
(let [{:keys [unique-name
|
||||
authtoken]} auth
|
||||
name (replace-dots-by-minus unique-name)]
|
||||
(->
|
||||
|
|
|
@ -131,7 +131,7 @@
|
|||
(cut/flatten-and-reduce-auth (cut/sort-auth auth2)))))
|
||||
|
||||
(deftest test-generate
|
||||
(is (= 22
|
||||
(is (= 24
|
||||
(count (cut/generate
|
||||
(yaml/load-as-edn "website-test/valid-config.yaml")
|
||||
(yaml/load-as-edn "website-test/valid-auth.yaml"))))))
|
||||
|
|
|
@ -228,20 +228,7 @@
|
|||
:labels {:app.kubernetes.part-of "test-io-website"}},
|
||||
:data
|
||||
{:AUTHTOKEN "YWJlZGpnYmFzZG9kag=="}}
|
||||
(cut/generate-build-secret {:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
||||
:forgejo-repo "repo",
|
||||
:issuer "staging",
|
||||
:branchname "main",
|
||||
:unique-name "test.io",
|
||||
:redirects [],
|
||||
:forgejo-host "gitlab.de"
|
||||
:repo-user "someuser",
|
||||
:build-cpu-request "500m"
|
||||
:build-cpu-limit "1700m"
|
||||
:build-memory-request "256Mi"
|
||||
:build-memory-limit "512Mi"
|
||||
:volume-size "3"}
|
||||
{:unique-name "test.io",
|
||||
(cut/generate-build-secret {:unique-name "test.io",
|
||||
:authtoken "abedjgbasdodj"}))))
|
||||
|
||||
(deftest should-generate-content-pvc
|
||||
|
|
Loading…
Reference in a new issue