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
|
sorted-auth
|
||||||
(assoc-in [:websiteauths] (rest (sorted-auth :websiteauths))))
|
(assoc-in [:websiteauths] (rest (sorted-auth :websiteauths))))
|
||||||
(let [final-config
|
(let [curr-flat-websiteconfig
|
||||||
(merge
|
(merge
|
||||||
website-config-defaults
|
website-config-defaults
|
||||||
(flatten-and-reduce-config sorted-config))
|
(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
|
(cm/concat-vec
|
||||||
result
|
result
|
||||||
(ns/generate (merge {:namespace name} final-config))
|
(ns/generate (merge {:namespace name} curr-flat-websiteconfig))
|
||||||
[(web/generate-nginx-deployment final-config)
|
[(web/generate-nginx-deployment curr-flat-websiteconfig)
|
||||||
(web/generate-nginx-configmap final-config)
|
(web/generate-nginx-configmap curr-flat-websiteconfig)
|
||||||
(web/generate-nginx-service final-config)
|
(web/generate-nginx-service curr-flat-websiteconfig)
|
||||||
(web/generate-content-pvc final-config)
|
(web/generate-content-pvc curr-flat-websiteconfig)
|
||||||
(web/generate-hash-state-pvc final-config)
|
(web/generate-hash-state-pvc curr-flat-websiteconfig)
|
||||||
(web/generate-build-cron final-config)
|
(web/generate-build-cron curr-flat-websiteconfig)
|
||||||
(web/generate-build-secret final-config
|
(web/generate-build-configmap curr-flat-websiteconfig)
|
||||||
(flatten-and-reduce-auth auth))]
|
(web/generate-build-secret (flatten-and-reduce-auth auth))]
|
||||||
(generate-ingress final-config)))))))
|
(generate-ingress curr-flat-websiteconfig)))))))
|
||||||
|
|
||||||
(defn-spec k8s-objects cp/map-or-seq?
|
(defn-spec k8s-objects cp/map-or-seq?
|
||||||
[config config?
|
[config config?
|
||||||
|
|
|
@ -104,7 +104,7 @@
|
||||||
#"REDIRECTS"
|
#"REDIRECTS"
|
||||||
(generate-redirects config 2)))))))
|
(generate-redirects config 2)))))))
|
||||||
|
|
||||||
; TODO add test
|
; TODO add test & add to build-cron env
|
||||||
(defn-spec generate-build-configmap pred/map-or-seq?
|
(defn-spec generate-build-configmap pred/map-or-seq?
|
||||||
[config websiteconfig?]
|
[config websiteconfig?]
|
||||||
(let [{:keys [unique-name
|
(let [{:keys [unique-name
|
||||||
|
@ -127,12 +127,10 @@
|
||||||
forgejo-host
|
forgejo-host
|
||||||
forgejo-repo
|
forgejo-repo
|
||||||
repo-user))))))
|
repo-user))))))
|
||||||
; TODO: remove config
|
|
||||||
(defn-spec generate-build-secret pred/map-or-seq?
|
(defn-spec generate-build-secret pred/map-or-seq?
|
||||||
[config websiteconfig?
|
[auth websiteauth?]
|
||||||
auth websiteauth?]
|
(let [{:keys [unique-name
|
||||||
(let [{:keys [unique-name]} config
|
|
||||||
{:keys [unique-name
|
|
||||||
authtoken]} auth
|
authtoken]} auth
|
||||||
name (replace-dots-by-minus unique-name)]
|
name (replace-dots-by-minus unique-name)]
|
||||||
(->
|
(->
|
||||||
|
|
|
@ -131,7 +131,7 @@
|
||||||
(cut/flatten-and-reduce-auth (cut/sort-auth auth2)))))
|
(cut/flatten-and-reduce-auth (cut/sort-auth auth2)))))
|
||||||
|
|
||||||
(deftest test-generate
|
(deftest test-generate
|
||||||
(is (= 22
|
(is (= 24
|
||||||
(count (cut/generate
|
(count (cut/generate
|
||||||
(yaml/load-as-edn "website-test/valid-config.yaml")
|
(yaml/load-as-edn "website-test/valid-config.yaml")
|
||||||
(yaml/load-as-edn "website-test/valid-auth.yaml"))))))
|
(yaml/load-as-edn "website-test/valid-auth.yaml"))))))
|
||||||
|
|
|
@ -228,20 +228,7 @@
|
||||||
:labels {:app.kubernetes.part-of "test-io-website"}},
|
:labels {:app.kubernetes.part-of "test-io-website"}},
|
||||||
:data
|
:data
|
||||||
{:AUTHTOKEN "YWJlZGpnYmFzZG9kag=="}}
|
{:AUTHTOKEN "YWJlZGpnYmFzZG9kag=="}}
|
||||||
(cut/generate-build-secret {:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
(cut/generate-build-secret {:unique-name "test.io",
|
||||||
: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",
|
|
||||||
:authtoken "abedjgbasdodj"}))))
|
:authtoken "abedjgbasdodj"}))))
|
||||||
|
|
||||||
(deftest should-generate-content-pvc
|
(deftest should-generate-content-pvc
|
||||||
|
|
Loading…
Reference in a new issue