started splitting build-secret and build-configmap
This commit is contained in:
parent
600dd1c30a
commit
248c33613a
4 changed files with 31 additions and 14 deletions
|
@ -94,7 +94,6 @@
|
||||||
#(str "rewrite ^" (first %1) "\\$ " (second %1) " permanent;")
|
#(str "rewrite ^" (first %1) "\\$ " (second %1) " permanent;")
|
||||||
redirects))))
|
redirects))))
|
||||||
|
|
||||||
|
|
||||||
(defn-spec generate-nginx-configmap map?
|
(defn-spec generate-nginx-configmap map?
|
||||||
[config websiteconfig?]
|
[config websiteconfig?]
|
||||||
(let [{:keys [fqdns unique-name]} config
|
(let [{:keys [fqdns unique-name]} config
|
||||||
|
@ -114,20 +113,20 @@
|
||||||
(generate-redirects config 2)))))))
|
(generate-redirects config 2)))))))
|
||||||
|
|
||||||
|
|
||||||
(defn-spec generate-build-secret pred/map-or-seq?
|
|
||||||
[config websiteconfig?
|
; TODO generate git path without username
|
||||||
auth websiteauth?]
|
; TODO add test
|
||||||
|
(defn-spec generate-build-configmap pred/map-or-seq?
|
||||||
|
[config websiteconfig?]
|
||||||
(let [{:keys [unique-name
|
(let [{:keys [unique-name
|
||||||
forgejo-host
|
forgejo-host
|
||||||
forgejo-repo
|
forgejo-repo
|
||||||
branchname]} config
|
branchname]} config
|
||||||
{:keys [authtoken
|
name (replace-dots-by-minus unique-name)
|
||||||
username]} auth
|
username "TODO"]
|
||||||
name (replace-dots-by-minus unique-name)]
|
|
||||||
(->
|
(->
|
||||||
(yaml/load-as-edn "website/build-secret.yaml")
|
(yaml/load-as-edn "website/build-configmap.yaml")
|
||||||
(replace-all-matching-prefixes "NAME" name)
|
(replace-all-matching-prefixes "NAME" name)
|
||||||
(cm/replace-all-matching-values-by-new-value "TOKEN" (b64/encode authtoken))
|
|
||||||
(cm/replace-all-matching-values-by-new-value "REPOURL" (b64/encode
|
(cm/replace-all-matching-values-by-new-value "REPOURL" (b64/encode
|
||||||
(generate-gitrepourl
|
(generate-gitrepourl
|
||||||
forgejo-host
|
forgejo-host
|
||||||
|
@ -140,6 +139,18 @@
|
||||||
forgejo-repo
|
forgejo-repo
|
||||||
username))))))
|
username))))))
|
||||||
|
|
||||||
|
(defn-spec generate-build-secret pred/map-or-seq?
|
||||||
|
[config websiteconfig?
|
||||||
|
auth websiteauth?]
|
||||||
|
(let [{:keys [unique-name]} config
|
||||||
|
{:keys [authtoken
|
||||||
|
username]} auth
|
||||||
|
name (replace-dots-by-minus unique-name)]
|
||||||
|
(->
|
||||||
|
(yaml/load-as-edn "website/build-secret.yaml")
|
||||||
|
(replace-all-matching-prefixes "NAME" name)
|
||||||
|
(cm/replace-all-matching-values-by-new-value "TOKEN" (b64/encode authtoken)))))
|
||||||
|
|
||||||
|
|
||||||
(defn-spec generate-content-pvc map?
|
(defn-spec generate-content-pvc map?
|
||||||
[config websiteconfig?]
|
[config websiteconfig?]
|
||||||
|
|
10
src/main/resources/website/build-configmap.yaml
Normal file
10
src/main/resources/website/build-configmap.yaml
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: build-configmap
|
||||||
|
namespace: NAME
|
||||||
|
labels:
|
||||||
|
app.kubernetes.part-of: NAME-website
|
||||||
|
data:
|
||||||
|
GITREPOURL: REPOURL
|
||||||
|
GITCOMMITURL: COMMITURL
|
|
@ -7,5 +7,3 @@ metadata:
|
||||||
app.kubernetes.part-of: NAME-website
|
app.kubernetes.part-of: NAME-website
|
||||||
data:
|
data:
|
||||||
AUTHTOKEN: TOKEN
|
AUTHTOKEN: TOKEN
|
||||||
GITREPOURL: REPOURL
|
|
||||||
GITCOMMITURL: COMMITURL
|
|
||||||
|
|
|
@ -217,9 +217,7 @@
|
||||||
:namespace "test-io",
|
:namespace "test-io",
|
||||||
:labels {:app.kubernetes.part-of "test-io-website"}},
|
:labels {:app.kubernetes.part-of "test-io-website"}},
|
||||||
:data
|
:data
|
||||||
{:AUTHTOKEN "YWJlZGpnYmFzZG9kag==",
|
{:AUTHTOKEN "YWJlZGpnYmFzZG9kag=="}}
|
||||||
:GITREPOURL "aHR0cHM6Ly9naXRsYWIuZGUvYXBpL3YxL3JlcG9zL3NvbWV1c2VyL3JlcG8vYXJjaGl2ZS9tYWluLnppcA==",
|
|
||||||
:GITCOMMITURL "aHR0cHM6Ly9naXRsYWIuZGUvYXBpL3YxL3JlcG9zL3NvbWV1c2VyL3JlcG8vZ2l0L2NvbW1pdHMvSEVBRA=="}}
|
|
||||||
(cut/generate-build-secret {:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
(cut/generate-build-secret {:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
||||||
:forgejo-repo "repo",
|
:forgejo-repo "repo",
|
||||||
:issuer "staging",
|
:issuer "staging",
|
||||||
|
|
Loading…
Reference in a new issue