commit
07cea8cfeb
16 changed files with 217 additions and 137 deletions
|
@ -28,12 +28,12 @@ websiteconfigs:
|
||||||
- unique-name: "test.io"
|
- unique-name: "test.io"
|
||||||
fqdns: ["test.de", "test.org", "www.test.de", "www.test.org"]
|
fqdns: ["test.de", "test.org", "www.test.de", "www.test.org"]
|
||||||
forgejo-host: "codeberg.org"
|
forgejo-host: "codeberg.org"
|
||||||
forgejo-repo: "repo"
|
repo-name: "repo"
|
||||||
branchname: "main"
|
branchname: "main"
|
||||||
- unique-name: "example.io"
|
- unique-name: "example.io"
|
||||||
fqdns: ["example.org", "www.example.com"]
|
fqdns: ["example.org", "www.example.com"]
|
||||||
forgejo-host: "fineForgejoHost.net"
|
forgejo-host: "fineForgejoHost.net"
|
||||||
forgejo-repo: "repo"
|
repo-name: "repo"
|
||||||
branchname: "main"
|
branchname: "main"
|
||||||
mon-cfg:
|
mon-cfg:
|
||||||
grafana-cloud-url: "url-for-your-prom-remote-write-endpoint"
|
grafana-cloud-url: "url-for-your-prom-remote-write-endpoint"
|
||||||
|
|
|
@ -20,6 +20,8 @@ if [[ $currentHash == $newHash ]]
|
||||||
echo "Nothing to do"
|
echo "Nothing to do"
|
||||||
else
|
else
|
||||||
echo $currentHash > $HASHFILEDIR/$hashfilename
|
echo $currentHash > $HASHFILEDIR/$hashfilename
|
||||||
|
echo "Generate .netrc file"
|
||||||
|
generate-netrc-file
|
||||||
echo "Downloading website data"
|
echo "Downloading website data"
|
||||||
get-website-data $filename
|
get-website-data $filename
|
||||||
unzip-website-data $filename
|
unzip-website-data $filename
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
function generate-netrc-file() {
|
||||||
|
echo "machine $GITHOST password $AUTHTOKEN" > ~/.netrc
|
||||||
|
}
|
||||||
|
|
||||||
function get-website-data() {
|
function get-website-data() {
|
||||||
curl -H "Authorization: token $AUTHTOKEN" -o $SOURCEDIR/$1 $GITREPOURL
|
curl -H "Authorization: token $AUTHTOKEN" -o $SOURCEDIR/$1 $GITREPOURL
|
||||||
}
|
}
|
||||||
|
@ -17,7 +21,7 @@ function unzip-website-data() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function build-website() {
|
function build-website() {
|
||||||
(cd $BUILDDIR; dir=$(ls); cd $dir; ./generate.sh;)
|
(cd $BUILDDIR; dir=$(ls); cd $dir; bash generate.sh;)
|
||||||
}
|
}
|
||||||
|
|
||||||
function move-website-files-to-target() {
|
function move-website-files-to-target() {
|
||||||
|
|
|
@ -6,7 +6,7 @@ function main()
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
upgradeSystem
|
upgradeSystem
|
||||||
apt-get install -qqy unzip rsync jq imagemagick curl
|
apt-get install -qqy unzip rsync jq imagemagick curl hugo
|
||||||
|
|
||||||
install -d /etc/lein/
|
install -d /etc/lein/
|
||||||
install -m 0700 /tmp/entrypoint.sh /
|
install -m 0700 /tmp/entrypoint.sh /
|
||||||
|
|
12
project.clj
12
project.clj
|
@ -33,4 +33,16 @@
|
||||||
["vcs" "commit"]
|
["vcs" "commit"]
|
||||||
["vcs" "tag" "v" "--no-sign"]
|
["vcs" "tag" "v" "--no-sign"]
|
||||||
["change" "version" "leiningen.release/bump-version"]]
|
["change" "version" "leiningen.release/bump-version"]]
|
||||||
|
:aliases {"native" ["shell"
|
||||||
|
"native-image"
|
||||||
|
"--report-unsupported-elements-at-runtime"
|
||||||
|
"--initialize-at-build-time"
|
||||||
|
"-jar" "target/uberjar/c4k-website-standalone.jar"
|
||||||
|
"-H:ResourceConfigurationFiles=graalvm-resource-config.json"
|
||||||
|
"-H:Log=registerResource"
|
||||||
|
"-H:Name=target/graalvm/${:name}"]
|
||||||
|
"inst" ["shell"
|
||||||
|
"sh"
|
||||||
|
"-c"
|
||||||
|
"lein uberjar && sudo install -m=755 target/uberjar/c4k-website-standalone.jar /usr/local/bin/c4k-website-standalone.jar"]}
|
||||||
)
|
)
|
||||||
|
|
|
@ -16,36 +16,46 @@
|
||||||
(s/def ::unique-name ::web/unique-name)
|
(s/def ::unique-name ::web/unique-name)
|
||||||
(s/def ::issuer ::web/issuer)
|
(s/def ::issuer ::web/issuer)
|
||||||
(s/def ::volume-size ::web/volume-size)
|
(s/def ::volume-size ::web/volume-size)
|
||||||
|
(s/def ::average-rate ::ing/average-rate)
|
||||||
|
(s/def ::burst-rate ::ing/burst-rate)
|
||||||
|
|
||||||
(s/def ::authtoken ::web/authtoken)
|
(s/def ::authtoken ::web/authtoken)
|
||||||
(s/def ::fqdns ::web/fqdns)
|
(s/def ::fqdns ::web/fqdns)
|
||||||
(s/def ::forgejo-host ::web/forgejo-host)
|
(s/def ::forgejo-host ::web/forgejo-host)
|
||||||
(s/def ::forgejo-repo ::web/forgejo-repo)
|
(s/def ::repo-owner ::web/repo-owner)
|
||||||
|
(s/def ::repo-name ::web/repo-name)
|
||||||
(s/def ::branchname ::web/branchname)
|
(s/def ::branchname ::web/branchname)
|
||||||
(s/def ::username ::web/username)
|
|
||||||
(s/def ::build-cpu-request ::web/build-cpu-request)
|
(s/def ::build-cpu-request ::web/build-cpu-request)
|
||||||
(s/def ::build-memory-request ::web/build-memory-request)
|
(s/def ::build-memory-request ::web/build-memory-request)
|
||||||
(s/def ::build-cpu-limit ::web/build-cpu-limit)
|
(s/def ::build-cpu-limit ::web/build-cpu-limit)
|
||||||
(s/def ::build-memory-limit ::web/build-memory-limit)
|
(s/def ::build-memory-limit ::web/build-memory-limit)
|
||||||
|
(s/def ::redirects ::web/redirects)
|
||||||
|
|
||||||
(def websiteconfig? (s/keys :req-un [::unique-name
|
(def websiteconfig? (s/keys :req-un [::unique-name
|
||||||
::fqdns
|
::fqdns
|
||||||
::forgejo-host
|
::forgejo-host
|
||||||
::forgejo-repo
|
::repo-owner
|
||||||
|
::repo-name
|
||||||
::branchname]
|
::branchname]
|
||||||
:opt-un [::issuer
|
:opt-un [::issuer
|
||||||
::volume-size
|
::volume-size
|
||||||
::build-cpu-request
|
::build-cpu-request
|
||||||
::build-cpu-limit
|
::build-cpu-limit
|
||||||
::build-memory-request
|
::build-memory-request
|
||||||
::build-memory-limit]))
|
::build-memory-limit
|
||||||
(def websiteauth? (s/keys :req-un [::unique-name ::username ::authtoken]))
|
::redirects]))
|
||||||
|
(def websiteauth? web/websiteauth?)
|
||||||
|
(def websiteauths? (s/keys :req-un [::websiteauths]))
|
||||||
|
|
||||||
(s/def ::websiteconfigs (s/coll-of websiteconfig?))
|
(s/def ::websiteconfigs (s/coll-of websiteconfig?))
|
||||||
(s/def ::websiteauths (s/coll-of websiteauth?))
|
(s/def ::websiteauths (s/coll-of websiteauth?))
|
||||||
|
|
||||||
(def config? (s/keys :req-un [::websiteconfigs]
|
(def config? (s/keys :req-un [::websiteconfigs]
|
||||||
:opt-un [::issuer
|
:opt-un [::issuer
|
||||||
::volume-size
|
::volume-size
|
||||||
::mon-cfg]))
|
::mon-cfg
|
||||||
|
::average-rate
|
||||||
|
::burst-rate]))
|
||||||
|
|
||||||
(def auth? (s/keys :req-un [::websiteauths]
|
(def auth? (s/keys :req-un [::websiteauths]
|
||||||
:opt-un [::mon-auth]))
|
:opt-un [::mon-auth]))
|
||||||
|
@ -58,7 +68,9 @@
|
||||||
:build-memory-request "256Mi"
|
:build-memory-request "256Mi"
|
||||||
:build-memory-limit "512Mi"
|
:build-memory-limit "512Mi"
|
||||||
:volume-size "3"
|
:volume-size "3"
|
||||||
:redirects []})
|
:redirects []
|
||||||
|
:average-rate 20
|
||||||
|
:burst-rate 40})
|
||||||
|
|
||||||
(defn-spec sort-config map?
|
(defn-spec sort-config map?
|
||||||
[unsorted-config config?]
|
[unsorted-config config?]
|
||||||
|
@ -80,7 +92,11 @@
|
||||||
(when (contains? config :issuer)
|
(when (contains? config :issuer)
|
||||||
{:issuer (config :issuer)})
|
{:issuer (config :issuer)})
|
||||||
(when (contains? config :volume-size)
|
(when (contains? config :volume-size)
|
||||||
{:volume-size (config :volume-size)}))))
|
{:volume-size (config :volume-size)})
|
||||||
|
(when (contains? config :average-rate)
|
||||||
|
{:average-rate (config :average-rate)})
|
||||||
|
(when (contains? config :burst-rate)
|
||||||
|
{:burst-rate (config :burst-rate)}))))
|
||||||
|
|
||||||
(defn-spec flatten-and-reduce-auth map?
|
(defn-spec flatten-and-reduce-auth map?
|
||||||
[auth auth?]
|
[auth auth?]
|
||||||
|
@ -99,35 +115,35 @@
|
||||||
(defn-spec generate seq?
|
(defn-spec generate seq?
|
||||||
[config config?
|
[config config?
|
||||||
auth auth?]
|
auth auth?]
|
||||||
(loop [config (sort-config config)
|
(loop [sorted-config (sort-config config)
|
||||||
sorted-auth (sort-auth auth)
|
sorted-auth (sort-auth auth)
|
||||||
result []]
|
result []]
|
||||||
|
|
||||||
(if (and (empty? (config :websiteconfigs)) (empty? (sorted-auth :websiteauths)))
|
(if (and (empty? (sorted-config :websiteconfigs)) (empty? (sorted-auth :websiteauths)))
|
||||||
result
|
result
|
||||||
(recur (->
|
(recur (->
|
||||||
config
|
sorted-config
|
||||||
(assoc-in [:websiteconfigs] (rest (config :websiteconfigs))))
|
(assoc-in [:websiteconfigs] (rest (sorted-config :websiteconfigs))))
|
||||||
(->
|
(->
|
||||||
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 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 sorted-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?
|
||||||
|
|
|
@ -20,9 +20,9 @@
|
||||||
(s/def ::authtoken pred/bash-env-string?)
|
(s/def ::authtoken pred/bash-env-string?)
|
||||||
(s/def ::fqdns (s/coll-of pred/fqdn-string?))
|
(s/def ::fqdns (s/coll-of pred/fqdn-string?))
|
||||||
(s/def ::forgejo-host pred/fqdn-string?)
|
(s/def ::forgejo-host pred/fqdn-string?)
|
||||||
(s/def ::forgejo-repo string?)
|
(s/def ::repo-name string?)
|
||||||
(s/def ::branchname string?)
|
(s/def ::branchname string?)
|
||||||
(s/def ::username string?)
|
(s/def ::repo-owner string?)
|
||||||
(s/def ::build-cpu-request string?)
|
(s/def ::build-cpu-request string?)
|
||||||
(s/def ::build-memory-request string?)
|
(s/def ::build-memory-request string?)
|
||||||
(s/def ::build-cpu-limit string?)
|
(s/def ::build-cpu-limit string?)
|
||||||
|
@ -30,29 +30,21 @@
|
||||||
(s/def ::redirect (s/tuple string? string?))
|
(s/def ::redirect (s/tuple string? string?))
|
||||||
(s/def ::redirects (s/coll-of ::redirect))
|
(s/def ::redirects (s/coll-of ::redirect))
|
||||||
|
|
||||||
|
|
||||||
(def websiteconfig? (s/keys :req-un [::unique-name
|
(def websiteconfig? (s/keys :req-un [::unique-name
|
||||||
::fqdns
|
::fqdns
|
||||||
::forgejo-host
|
::forgejo-host
|
||||||
::forgejo-repo
|
::repo-owner
|
||||||
|
::repo-name
|
||||||
::branchname
|
::branchname
|
||||||
::issuer
|
|
||||||
::volume-size
|
|
||||||
::build-cpu-request
|
::build-cpu-request
|
||||||
::build-cpu-limit
|
::build-cpu-limit
|
||||||
::build-memory-request
|
::build-memory-request
|
||||||
::build-memory-limit
|
::build-memory-limit
|
||||||
|
::issuer
|
||||||
|
::volume-size
|
||||||
::redirects]))
|
::redirects]))
|
||||||
|
|
||||||
(def websiteauth? (s/keys :req-un [::unique-name ::username ::authtoken]))
|
(def websiteauth? (s/keys :req-un [::unique-name ::authtoken]))
|
||||||
|
|
||||||
(s/def ::websiteconfigs (s/coll-of websiteconfig?))
|
|
||||||
|
|
||||||
(s/def ::websiteauths (s/coll-of websiteauth?))
|
|
||||||
|
|
||||||
(def websiteconfigs? (s/keys :req-un [::websiteconfigs]))
|
|
||||||
|
|
||||||
(def auth? (s/keys :req-un [::websiteauths]))
|
|
||||||
|
|
||||||
(defn-spec replace-dots-by-minus string?
|
(defn-spec replace-dots-by-minus string?
|
||||||
[fqdn pred/fqdn-string?]
|
[fqdn pred/fqdn-string?]
|
||||||
|
@ -61,17 +53,17 @@
|
||||||
; https://your.gitea.host/api/v1/repos/<owner>/<repo>/archive/<branch>.zip
|
; https://your.gitea.host/api/v1/repos/<owner>/<repo>/archive/<branch>.zip
|
||||||
(defn-spec generate-gitrepourl string?
|
(defn-spec generate-gitrepourl string?
|
||||||
[host pred/fqdn-string?
|
[host pred/fqdn-string?
|
||||||
|
owner string?
|
||||||
repo string?
|
repo string?
|
||||||
user string?
|
|
||||||
branch string?]
|
branch string?]
|
||||||
(str "https://" host "/api/v1/repos/" user "/" repo "/archive/" branch ".zip"))
|
(str "https://" host "/api/v1/repos/" owner "/" repo "/archive/" branch ".zip"))
|
||||||
|
|
||||||
; https://your.gitea.host/api/v1/repos/<owner>/<repo>/git/commits/HEAD
|
; https://your.gitea.host/api/v1/repos/<owner>/<repo>/git/commits/HEAD
|
||||||
(defn-spec generate-gitcommiturl string?
|
(defn-spec generate-gitcommiturl string?
|
||||||
[host pred/fqdn-string?
|
[host pred/fqdn-string?
|
||||||
repo string?
|
owner string?
|
||||||
user string?]
|
repo string?]
|
||||||
(str "https://" host "/api/v1/repos/" user "/" repo "/git/" "commits/" "HEAD"))
|
(str "https://" host "/api/v1/repos/" owner "/" repo "/git/" "commits/" "HEAD"))
|
||||||
|
|
||||||
|
|
||||||
(defn-spec replace-all-matching-prefixes map?
|
(defn-spec replace-all-matching-prefixes map?
|
||||||
|
@ -94,7 +86,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
|
||||||
|
@ -113,32 +104,37 @@
|
||||||
#"REDIRECTS"
|
#"REDIRECTS"
|
||||||
(generate-redirects config 2)))))))
|
(generate-redirects config 2)))))))
|
||||||
|
|
||||||
|
(defn-spec generate-build-configmap pred/map-or-seq?
|
||||||
(defn-spec generate-build-secret pred/map-or-seq?
|
[config websiteconfig?]
|
||||||
[config websiteconfig?
|
|
||||||
auth websiteauth?]
|
|
||||||
(let [{:keys [unique-name
|
(let [{:keys [unique-name
|
||||||
forgejo-host
|
forgejo-host
|
||||||
forgejo-repo
|
repo-owner
|
||||||
|
repo-name
|
||||||
branchname]} config
|
branchname]} config
|
||||||
{:keys [authtoken
|
name (replace-dots-by-minus unique-name)]
|
||||||
username]} auth
|
(->
|
||||||
|
(yaml/load-as-edn "website/build-configmap.yaml")
|
||||||
|
(replace-all-matching-prefixes "NAME" name)
|
||||||
|
(cm/replace-all-matching-values-by-new-value "GITHOST" forgejo-host)
|
||||||
|
(cm/replace-all-matching-values-by-new-value "REPOURL" (generate-gitrepourl
|
||||||
|
forgejo-host
|
||||||
|
repo-owner
|
||||||
|
repo-name
|
||||||
|
branchname))
|
||||||
|
(cm/replace-all-matching-values-by-new-value "COMMITURL" (generate-gitcommiturl
|
||||||
|
forgejo-host
|
||||||
|
repo-owner
|
||||||
|
repo-name)))))
|
||||||
|
|
||||||
|
(defn-spec generate-build-secret pred/map-or-seq?
|
||||||
|
[auth websiteauth?]
|
||||||
|
(let [{:keys [unique-name
|
||||||
|
authtoken]} auth
|
||||||
name (replace-dots-by-minus unique-name)]
|
name (replace-dots-by-minus unique-name)]
|
||||||
(->
|
(->
|
||||||
(yaml/load-as-edn "website/build-secret.yaml")
|
(yaml/load-as-edn "website/build-secret.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 "TOKEN" (b64/encode authtoken)))))
|
||||||
(cm/replace-all-matching-values-by-new-value "REPOURL" (b64/encode
|
|
||||||
(generate-gitrepourl
|
|
||||||
forgejo-host
|
|
||||||
forgejo-repo
|
|
||||||
username
|
|
||||||
branchname)))
|
|
||||||
(cm/replace-all-matching-values-by-new-value "COMMITURL" (b64/encode
|
|
||||||
(generate-gitcommiturl
|
|
||||||
forgejo-host
|
|
||||||
forgejo-repo
|
|
||||||
username))))))
|
|
||||||
|
|
||||||
|
|
||||||
(defn-spec generate-content-pvc map?
|
(defn-spec generate-content-pvc map?
|
||||||
|
|
|
@ -28,14 +28,16 @@
|
||||||
"{ :websiteconfigs
|
"{ :websiteconfigs
|
||||||
[{:unique-name \"test.io\",
|
[{:unique-name \"test.io\",
|
||||||
:fqdns [\"test.de\" \"www.test.de\"],
|
:fqdns [\"test.de\" \"www.test.de\"],
|
||||||
:gitea-host \"githost.de\",
|
:forgejo-host \"githost.de\",
|
||||||
:gitea-repo \"repo\",
|
:repo-owner \"someuser\",
|
||||||
|
:repo-name \"repo\",
|
||||||
:branchname \"main\",
|
:branchname \"main\",
|
||||||
:sha256sum-output \"123456789ab123cd345de script-file-name.sh\"}
|
:sha256sum-output \"123456789ab123cd345de script-file-name.sh\"}
|
||||||
{:unique-name \"example.io \",
|
{:unique-name \"example.io \",
|
||||||
:fqdns [\"example.org\" \"www.example.org\"],
|
:fqdns [\"example.org\" \"www.example.org\"],
|
||||||
:gitea-host \"githost.org\",
|
:forgejo-host \"githost.org\",
|
||||||
:gitea-repo \"repo\",
|
:repo-owner \"someuser\",
|
||||||
|
:repo-name \"repo\",
|
||||||
:branchname \"main\",
|
:branchname \"main\",
|
||||||
:build-cpu-request \"1500m\",
|
:build-cpu-request \"1500m\",
|
||||||
:build-cpu-limit \"3000m\",
|
:build-cpu-limit \"3000m\",
|
||||||
|
@ -51,10 +53,8 @@
|
||||||
:grafana-cloud-password \"your-cloud-password\"}
|
:grafana-cloud-password \"your-cloud-password\"}
|
||||||
:websiteauths
|
:websiteauths
|
||||||
[{:unique-name \"test.io\",
|
[{:unique-name \"test.io\",
|
||||||
:username \"someuser\",
|
|
||||||
:authtoken \"abedjgbasdodj\"}
|
:authtoken \"abedjgbasdodj\"}
|
||||||
{:unique-name \"example.io\",
|
{:unique-name \"example.io\",
|
||||||
:username \"someuser\",
|
|
||||||
:authtoken \"abedjgbasdodj\"}]}"
|
:authtoken \"abedjgbasdodj\"}]}"
|
||||||
"7"))
|
"7"))
|
||||||
[(br/generate-br)]
|
[(br/generate-br)]
|
||||||
|
@ -84,12 +84,12 @@
|
||||||
:grafana-cloud-url mon-cloud-url}}))))
|
:grafana-cloud-url mon-cloud-url}}))))
|
||||||
|
|
||||||
(defn validate-all! []
|
(defn validate-all! []
|
||||||
(br/validate! "websiteconfigs" website/websiteconfigs? :deserializer edn/read-string)
|
(br/validate! "websiteconfigs" core/websiteconfigs? :deserializer edn/read-string)
|
||||||
(br/validate! "issuer" ::website/issuer :optional true)
|
(br/validate! "issuer" ::core/issuer :optional true)
|
||||||
(br/validate! "mon-cluster-name" ::mon/cluster-name :optional true)
|
(br/validate! "mon-cluster-name" ::mon/cluster-name :optional true)
|
||||||
(br/validate! "mon-cluster-stage" ::mon/cluster-stage :optional true)
|
(br/validate! "mon-cluster-stage" ::mon/cluster-stage :optional true)
|
||||||
(br/validate! "mon-cloud-url" ::mon/grafana-cloud-url :optional true)
|
(br/validate! "mon-cloud-url" ::mon/grafana-cloud-url :optional true)
|
||||||
(br/validate! "auth" website/auth? :deserializer edn/read-string)
|
(br/validate! "auth" core/websiteauths? :deserializer edn/read-string)
|
||||||
(br/set-form-validated!))
|
(br/set-form-validated!))
|
||||||
|
|
||||||
(defn add-validate-listener [name]
|
(defn add-validate-listener [name]
|
||||||
|
|
11
src/main/resources/website/build-configmap.yaml
Normal file
11
src/main/resources/website/build-configmap.yaml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ConfigMap
|
||||||
|
metadata:
|
||||||
|
name: build-configmap
|
||||||
|
namespace: NAME
|
||||||
|
labels:
|
||||||
|
app.kubernetes.part-of: NAME-website
|
||||||
|
data:
|
||||||
|
GITHOST: GITHOST
|
||||||
|
GITREPOURL: REPOURL
|
||||||
|
GITCOMMITURL: COMMITURL
|
|
@ -31,6 +31,8 @@ spec:
|
||||||
memory: BUILD_MEMORY_LIMIT
|
memory: BUILD_MEMORY_LIMIT
|
||||||
command: ["/entrypoint.sh"]
|
command: ["/entrypoint.sh"]
|
||||||
envFrom:
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: build-configmap
|
||||||
- secretRef:
|
- secretRef:
|
||||||
name: build-secret
|
name: build-secret
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
|
|
|
@ -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
|
|
||||||
|
|
|
@ -46,6 +46,8 @@ spec:
|
||||||
memory: BUILD_MEMORY_LIMIT
|
memory: BUILD_MEMORY_LIMIT
|
||||||
command: ["/entrypoint.sh"]
|
command: ["/entrypoint.sh"]
|
||||||
envFrom:
|
envFrom:
|
||||||
|
- configMapRef:
|
||||||
|
name: build-configmap
|
||||||
- secretRef:
|
- secretRef:
|
||||||
name: build-secret
|
name: build-secret
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
|
|
|
@ -30,12 +30,14 @@
|
||||||
[{:unique-name "example.io"
|
[{:unique-name "example.io"
|
||||||
:fqdns ["example.org", "www.example.com"]
|
:fqdns ["example.org", "www.example.com"]
|
||||||
:forgejo-host "finegitehost.net"
|
:forgejo-host "finegitehost.net"
|
||||||
:forgejo-repo "repo"
|
:repo-owner "someuser"
|
||||||
|
:repo-name "repo"
|
||||||
:branchname "main"}
|
:branchname "main"}
|
||||||
{:unique-name "test.io"
|
{:unique-name "test.io"
|
||||||
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"]
|
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"]
|
||||||
:forgejo-host "gitlab.de"
|
:forgejo-host "gitlab.de"
|
||||||
:forgejo-repo "repo"
|
:repo-owner "someuser"
|
||||||
|
:repo-name "repo"
|
||||||
:branchname "main"}]})
|
:branchname "main"}]})
|
||||||
|
|
||||||
(def websites2
|
(def websites2
|
||||||
|
@ -43,42 +45,40 @@
|
||||||
[{:unique-name "test.io"
|
[{:unique-name "test.io"
|
||||||
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"]
|
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"]
|
||||||
:forgejo-host "gitlab.de"
|
:forgejo-host "gitlab.de"
|
||||||
:forgejo-repo "repo"
|
:repo-owner "someuser"
|
||||||
|
:repo-name "repo"
|
||||||
:branchname "main"}
|
:branchname "main"}
|
||||||
{:unique-name "example.io"
|
{:unique-name "example.io"
|
||||||
:fqdns ["example.org", "www.example.com"]
|
:fqdns ["example.org", "www.example.com"]
|
||||||
:forgejo-host "finegitehost.net"
|
:forgejo-host "finegitehost.net"
|
||||||
:forgejo-repo "repo"
|
:repo-owner "someuser"
|
||||||
|
:repo-name "repo"
|
||||||
:branchname "main"}]})
|
:branchname "main"}]})
|
||||||
|
|
||||||
(def auth1
|
(def auth1
|
||||||
{:websiteauths
|
{:websiteauths
|
||||||
[{:unique-name "example.io"
|
[{:unique-name "example.io"
|
||||||
:username "someuser"
|
|
||||||
:authtoken "abedjgbasdodj"}
|
:authtoken "abedjgbasdodj"}
|
||||||
{:unique-name "test.io"
|
{:unique-name "test.io"
|
||||||
:username "someuser"
|
|
||||||
:authtoken "abedjgbasdodj"}]})
|
:authtoken "abedjgbasdodj"}]})
|
||||||
|
|
||||||
(def auth2
|
(def auth2
|
||||||
{:websiteauths
|
{:websiteauths
|
||||||
[{:unique-name "test.io"
|
[{:unique-name "test.io"
|
||||||
:username "someuser"
|
|
||||||
:authtoken "abedjgbasdodj"}
|
:authtoken "abedjgbasdodj"}
|
||||||
{:unique-name "example.io"
|
{:unique-name "example.io"
|
||||||
:username "someuser"
|
|
||||||
:authtoken "abedjgbasdodj"}]})
|
:authtoken "abedjgbasdodj"}]})
|
||||||
|
|
||||||
(def flattened-and-reduced-config
|
(def flattened-and-reduced-config
|
||||||
{:unique-name "example.io",
|
{:unique-name "example.io",
|
||||||
:fqdns ["example.org" "www.example.com"],
|
:fqdns ["example.org" "www.example.com"],
|
||||||
:forgejo-host "finegitehost.net",
|
:forgejo-host "finegitehost.net",
|
||||||
:forgejo-repo "repo",
|
:repo-owner "someuser",
|
||||||
|
:repo-name "repo",
|
||||||
:branchname "main"})
|
:branchname "main"})
|
||||||
|
|
||||||
(def flattened-and-reduced-auth
|
(def flattened-and-reduced-auth
|
||||||
{:unique-name "example.io",
|
{:unique-name "example.io",
|
||||||
:username "someuser",
|
|
||||||
:authtoken "abedjgbasdodj"})
|
:authtoken "abedjgbasdodj"})
|
||||||
|
|
||||||
(deftest sorts-config
|
(deftest sorts-config
|
||||||
|
@ -87,12 +87,14 @@
|
||||||
[{:unique-name "example.io",
|
[{:unique-name "example.io",
|
||||||
:fqdns ["example.org" "www.example.com"],
|
:fqdns ["example.org" "www.example.com"],
|
||||||
:forgejo-host "finegitehost.net",
|
:forgejo-host "finegitehost.net",
|
||||||
:forgejo-repo "repo",
|
:repo-owner "someuser",
|
||||||
|
:repo-name "repo",
|
||||||
:branchname "main"},
|
:branchname "main"},
|
||||||
{:unique-name "test.io",
|
{:unique-name "test.io",
|
||||||
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
||||||
:forgejo-host "gitlab.de",
|
:forgejo-host "gitlab.de",
|
||||||
:forgejo-repo "repo",
|
:repo-owner "someuser",
|
||||||
|
:repo-name "repo",
|
||||||
:branchname "main",
|
:branchname "main",
|
||||||
:sha256sum-output "123456789ab123cd345de script-file-name.sh"}],
|
:sha256sum-output "123456789ab123cd345de script-file-name.sh"}],
|
||||||
:mon-cfg {:grafana-cloud-url "url-for-your-prom-remote-write-endpoint", :cluster-name "jitsi", :cluster-stage "test"}}
|
:mon-cfg {:grafana-cloud-url "url-for-your-prom-remote-write-endpoint", :cluster-name "jitsi", :cluster-stage "test"}}
|
||||||
|
@ -102,13 +104,15 @@
|
||||||
[{:unique-name "test.io",
|
[{:unique-name "test.io",
|
||||||
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
||||||
:forgejo-host "gitlab.de",
|
:forgejo-host "gitlab.de",
|
||||||
:forgejo-repo "repo",
|
:repo-owner "someuser",
|
||||||
|
:repo-name "repo",
|
||||||
:branchname "main",
|
:branchname "main",
|
||||||
:sha256sum-output "123456789ab123cd345de script-file-name.sh"}
|
:sha256sum-output "123456789ab123cd345de script-file-name.sh"}
|
||||||
{:unique-name "example.io",
|
{:unique-name "example.io",
|
||||||
:fqdns ["example.org" "www.example.com"],
|
:fqdns ["example.org" "www.example.com"],
|
||||||
:forgejo-host "finegitehost.net",
|
:forgejo-host "finegitehost.net",
|
||||||
:forgejo-repo "repo",
|
:repo-owner "someuser",
|
||||||
|
:repo-name "repo",
|
||||||
:branchname "main"}],
|
:branchname "main"}],
|
||||||
:mon-cfg {:grafana-cloud-url "url-for-your-prom-remote-write-endpoint", :cluster-name "jitsi", :cluster-stage "test"}}))))
|
:mon-cfg {:grafana-cloud-url "url-for-your-prom-remote-write-endpoint", :cluster-name "jitsi", :cluster-stage "test"}}))))
|
||||||
|
|
||||||
|
@ -127,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"))))))
|
||||||
|
@ -158,13 +162,14 @@
|
||||||
:path "/",
|
:path "/",
|
||||||
:backend {:service {:name "test-io", :port {:number 80}}}}]}}]
|
:backend {:service {:name "test-io", :port {:number 80}}}}]}}]
|
||||||
(get-in
|
(get-in
|
||||||
(cut/generate-ingress {:forgejo-host "gitlab.de",
|
(cut/generate-ingress {:unique-name "test.io",
|
||||||
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
||||||
:forgejo-repo "repo",
|
:forgejo-host "gitlab.de",
|
||||||
|
:repo-owner "someuser",
|
||||||
|
:repo-name "repo",
|
||||||
:sha256sum-output "123456789ab123cd345de script-file-name.sh",
|
:sha256sum-output "123456789ab123cd345de script-file-name.sh",
|
||||||
:issuer "staging",
|
:issuer "staging",
|
||||||
:branchname "main",
|
:branchname "main",
|
||||||
:unique-name "test.io"
|
|
||||||
:build-cpu-request "500m"
|
:build-cpu-request "500m"
|
||||||
:build-cpu-limit "1700m"
|
:build-cpu-limit "1700m"
|
||||||
:build-memory-request "256Mi"
|
:build-memory-request "256Mi"
|
||||||
|
@ -174,13 +179,14 @@
|
||||||
[2 :spec :rules])))
|
[2 :spec :rules])))
|
||||||
(is (= "test-io"
|
(is (= "test-io"
|
||||||
(get-in
|
(get-in
|
||||||
(cut/generate-ingress {:forgejo-host "gitlab.de",
|
(cut/generate-ingress {:unique-name "test.io",
|
||||||
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
||||||
:forgejo-repo "repo",
|
:forgejo-host "gitlab.de",
|
||||||
|
:repo-owner "someuser",
|
||||||
|
:repo-name "repo",
|
||||||
:sha256sum-output "123456789ab123cd345de script-file-name.sh",
|
:sha256sum-output "123456789ab123cd345de script-file-name.sh",
|
||||||
:issuer "staging",
|
:issuer "staging",
|
||||||
:branchname "main",
|
:branchname "main",
|
||||||
:unique-name "test.io"
|
|
||||||
:build-cpu-request "500m"
|
:build-cpu-request "500m"
|
||||||
:build-cpu-limit "1700m"
|
:build-cpu-limit "1700m"
|
||||||
:build-memory-request "256Mi"
|
:build-memory-request "256Mi"
|
||||||
|
|
|
@ -19,6 +19,14 @@
|
||||||
(st/instrument `cut/generate-nginx-service)
|
(st/instrument `cut/generate-nginx-service)
|
||||||
|
|
||||||
|
|
||||||
|
(deftest should-generate-gitrepourl
|
||||||
|
(is (= "https://mygit.de/api/v1/repos/someuser/repo/archive/main.zip"
|
||||||
|
(cut/generate-gitrepourl "mygit.de" "someuser" "repo" "main"))))
|
||||||
|
|
||||||
|
(deftest should-generate-gitcommiturl
|
||||||
|
(is (= "https://mygit.de/api/v1/repos/someuser/repo/git/commits/HEAD"
|
||||||
|
(cut/generate-gitcommiturl "mygit.de" "someuser" "repo"))))
|
||||||
|
|
||||||
(deftest should-generate-redirects
|
(deftest should-generate-redirects
|
||||||
(is (= "rewrite ^/products.html\\$ /offer.html permanent;\n rewrite ^/one-more\\$ /redirect permanent;"
|
(is (= "rewrite ^/products.html\\$ /offer.html permanent;\n rewrite ^/one-more\\$ /redirect permanent;"
|
||||||
(cut/generate-redirects {:issuer "staging"
|
(cut/generate-redirects {:issuer "staging"
|
||||||
|
@ -31,7 +39,8 @@
|
||||||
:redirects [["/products.html", "/offer.html"]
|
:redirects [["/products.html", "/offer.html"]
|
||||||
["/one-more", "/redirect"]]
|
["/one-more", "/redirect"]]
|
||||||
:forgejo-host "gitea.evilorg",
|
:forgejo-host "gitea.evilorg",
|
||||||
:forgejo-repo "none",
|
:repo-owner "someuser",
|
||||||
|
:repo-name "none",
|
||||||
:branchname "mablain",
|
:branchname "mablain",
|
||||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]}
|
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]}
|
||||||
2)))
|
2)))
|
||||||
|
@ -45,7 +54,8 @@
|
||||||
:unique-name "test.io",
|
:unique-name "test.io",
|
||||||
:redirects []
|
:redirects []
|
||||||
:forgejo-host "gitea.evilorg",
|
:forgejo-host "gitea.evilorg",
|
||||||
:forgejo-repo "none",
|
:repo-owner "someuser",
|
||||||
|
:repo-name "none",
|
||||||
:branchname "mablain",
|
:branchname "mablain",
|
||||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]}
|
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]}
|
||||||
0))))
|
0))))
|
||||||
|
@ -54,8 +64,9 @@
|
||||||
(deftest should-generate-resource-requests
|
(deftest should-generate-resource-requests
|
||||||
(is (= {:requests {:cpu "1500m", :memory "512Mi"}, :limits {:cpu "3000m", :memory "1024Mi"}}
|
(is (= {:requests {:cpu "1500m", :memory "512Mi"}, :limits {:cpu "3000m", :memory "1024Mi"}}
|
||||||
(-> (cut/generate-nginx-deployment {:forgejo-host "gitlab.de",
|
(-> (cut/generate-nginx-deployment {:forgejo-host "gitlab.de",
|
||||||
|
:repo-owner "someuser",
|
||||||
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
||||||
:forgejo-repo "repo",
|
:repo-name "repo",
|
||||||
:issuer "staging",
|
:issuer "staging",
|
||||||
:branchname "main",
|
:branchname "main",
|
||||||
:unique-name "test.io",
|
:unique-name "test.io",
|
||||||
|
@ -68,8 +79,9 @@
|
||||||
:spec :template :spec :initContainers first :resources)))
|
:spec :template :spec :initContainers first :resources)))
|
||||||
(is (= "test-io"
|
(is (= "test-io"
|
||||||
(-> (cut/generate-nginx-deployment {:forgejo-host "gitlab.de",
|
(-> (cut/generate-nginx-deployment {:forgejo-host "gitlab.de",
|
||||||
|
:repo-owner "someuser",
|
||||||
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
||||||
:forgejo-repo "repo",
|
:repo-name "repo",
|
||||||
:issuer "staging",
|
:issuer "staging",
|
||||||
:branchname "main",
|
:branchname "main",
|
||||||
:unique-name "test.io",
|
:unique-name "test.io",
|
||||||
|
@ -92,7 +104,8 @@
|
||||||
:redirects [["/products.html", "/offer.html"]
|
:redirects [["/products.html", "/offer.html"]
|
||||||
["/one-more", "/redirect"]]
|
["/one-more", "/redirect"]]
|
||||||
:forgejo-host "gitea.evilorg",
|
:forgejo-host "gitea.evilorg",
|
||||||
:forgejo-repo "none",
|
:repo-owner "someuser",
|
||||||
|
:repo-name "none",
|
||||||
:branchname "mablain",
|
:branchname "mablain",
|
||||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})))
|
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})))
|
||||||
" /offer.html permanent;\n"))
|
" /offer.html permanent;\n"))
|
||||||
|
@ -107,7 +120,8 @@
|
||||||
:redirects [["/products.html", "/offer.html"]
|
:redirects [["/products.html", "/offer.html"]
|
||||||
["/one-more", "/redirect"]]
|
["/one-more", "/redirect"]]
|
||||||
:forgejo-host "gitea.evilorg",
|
:forgejo-host "gitea.evilorg",
|
||||||
:forgejo-repo "none",
|
:repo-owner "someuser",
|
||||||
|
:repo-name "none",
|
||||||
:branchname "mablain",
|
:branchname "mablain",
|
||||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})))
|
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})))
|
||||||
" /redirect permanent;\n"))
|
" /redirect permanent;\n"))
|
||||||
|
@ -121,7 +135,8 @@
|
||||||
:unique-name "test.io",
|
:unique-name "test.io",
|
||||||
:redirects [],
|
:redirects [],
|
||||||
:forgejo-host "gitea.evilorg",
|
:forgejo-host "gitea.evilorg",
|
||||||
:forgejo-repo "none",
|
:repo-owner "someuser",
|
||||||
|
:repo-name "none",
|
||||||
:branchname "mablain",
|
:branchname "mablain",
|
||||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})))
|
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})))
|
||||||
"server_name test.de www.test.de test-it.de www.test-it.de;"))
|
"server_name test.de www.test.de test-it.de www.test-it.de;"))
|
||||||
|
@ -139,7 +154,8 @@
|
||||||
:unique-name "test.io",
|
:unique-name "test.io",
|
||||||
:redirects [],
|
:redirects [],
|
||||||
:forgejo-host "gitea.evilorg",
|
:forgejo-host "gitea.evilorg",
|
||||||
:forgejo-repo "none",
|
:repo-owner "someuser",
|
||||||
|
:repo-name "none",
|
||||||
:branchname "mablain",
|
:branchname "mablain",
|
||||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})
|
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})
|
||||||
:data))))
|
:data))))
|
||||||
|
@ -162,7 +178,8 @@
|
||||||
:unique-name "test.io",
|
:unique-name "test.io",
|
||||||
:redirects [],
|
:redirects [],
|
||||||
:forgejo-host "gitea.evilorg",
|
:forgejo-host "gitea.evilorg",
|
||||||
:forgejo-repo "none",
|
:repo-owner "someuser",
|
||||||
|
:repo-name "none",
|
||||||
:branchname "mablain",
|
:branchname "mablain",
|
||||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]}))))
|
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]}))))
|
||||||
|
|
||||||
|
@ -191,7 +208,8 @@
|
||||||
:imagePullPolicy "IfNotPresent",
|
:imagePullPolicy "IfNotPresent",
|
||||||
:resources {:requests {:cpu "500m", :memory "256Mi"}, :limits {:cpu "1700m", :memory "512Mi"}},
|
:resources {:requests {:cpu "500m", :memory "256Mi"}, :limits {:cpu "1700m", :memory "512Mi"}},
|
||||||
:command ["/entrypoint.sh"],
|
:command ["/entrypoint.sh"],
|
||||||
:envFrom [{:secretRef {:name "build-secret"}}],
|
:envFrom [{:configMapRef {:name "build-configmap"}}
|
||||||
|
{:secretRef {:name "build-secret"}}],
|
||||||
:volumeMounts [{:name "content-volume", :mountPath "/var/www/html/website"}
|
:volumeMounts [{:name "content-volume", :mountPath "/var/www/html/website"}
|
||||||
{:name "hash-state-volume", :mountPath "/var/hashfile.d"}]}],
|
{:name "hash-state-volume", :mountPath "/var/hashfile.d"}]}],
|
||||||
:volumes [{:name "content-volume", :persistentVolumeClaim {:claimName "content-volume"}}
|
:volumes [{:name "content-volume", :persistentVolumeClaim {:claimName "content-volume"}}
|
||||||
|
@ -204,8 +222,33 @@
|
||||||
:build-memory-limit "512Mi"
|
:build-memory-limit "512Mi"
|
||||||
:volume-size "3"
|
:volume-size "3"
|
||||||
:forgejo-host "gitlab.de",
|
:forgejo-host "gitlab.de",
|
||||||
|
:repo-owner "someuser",
|
||||||
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
||||||
:forgejo-repo "repo",
|
:repo-name "repo",
|
||||||
|
:branchname "main",
|
||||||
|
:unique-name "test.io",
|
||||||
|
:redirects []}))))
|
||||||
|
|
||||||
|
(deftest should-generate-build-configmap
|
||||||
|
(is (= {:apiVersion "v1",
|
||||||
|
:kind "ConfigMap",
|
||||||
|
:metadata {:name "build-configmap",
|
||||||
|
:namespace "test-io",
|
||||||
|
:labels {:app.kubernetes.part-of "test-io-website"}},
|
||||||
|
:data
|
||||||
|
{:GITHOST "mygit.de"
|
||||||
|
:GITREPOURL "https://mygit.de/api/v1/repos/someuser/repo/archive/main.zip"
|
||||||
|
:GITCOMMITURL "https://mygit.de/api/v1/repos/someuser/repo/git/commits/HEAD"}}
|
||||||
|
(cut/generate-build-configmap {:issuer "staging"
|
||||||
|
:build-cpu-request "500m"
|
||||||
|
:build-cpu-limit "1700m"
|
||||||
|
:build-memory-request "256Mi"
|
||||||
|
:build-memory-limit "512Mi"
|
||||||
|
:volume-size "3"
|
||||||
|
:forgejo-host "mygit.de",
|
||||||
|
:repo-owner "someuser",
|
||||||
|
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"],
|
||||||
|
:repo-name "repo",
|
||||||
:branchname "main",
|
:branchname "main",
|
||||||
:unique-name "test.io",
|
:unique-name "test.io",
|
||||||
:redirects []}))))
|
:redirects []}))))
|
||||||
|
@ -217,24 +260,9 @@
|
||||||
: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==",
|
(cut/generate-build-secret {:unique-name "test.io",
|
||||||
:GITCOMMITURL "aHR0cHM6Ly9naXRsYWIuZGUvYXBpL3YxL3JlcG9zL3NvbWV1c2VyL3JlcG8vZ2l0L2NvbW1pdHMvSEVBRA=="}}
|
:authtoken "abedjgbasdodj"}))))
|
||||||
(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"
|
|
||||||
: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",
|
|
||||||
:username "someuser"}))))
|
|
||||||
|
|
||||||
(deftest should-generate-content-pvc
|
(deftest should-generate-content-pvc
|
||||||
(is (= {:apiVersion "v1",
|
(is (= {:apiVersion "v1",
|
||||||
|
@ -256,7 +284,8 @@
|
||||||
:unique-name "test.io",
|
:unique-name "test.io",
|
||||||
:redirects [],
|
:redirects [],
|
||||||
:forgejo-host "gitea.evilorg",
|
:forgejo-host "gitea.evilorg",
|
||||||
:forgejo-repo "none",
|
:repo-owner "someuser",
|
||||||
|
:repo-name "none",
|
||||||
:branchname "mablain",
|
:branchname "mablain",
|
||||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]}))))
|
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]}))))
|
||||||
|
|
||||||
|
@ -280,6 +309,7 @@
|
||||||
:unique-name "test.io",
|
:unique-name "test.io",
|
||||||
:redirects [],
|
:redirects [],
|
||||||
:forgejo-host "gitea.evilorg",
|
:forgejo-host "gitea.evilorg",
|
||||||
:forgejo-repo "none",
|
:repo-owner "someuser",
|
||||||
|
:repo-name "none",
|
||||||
:branchname "mablain",
|
:branchname "mablain",
|
||||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]}))))
|
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]}))))
|
|
@ -1,9 +1,7 @@
|
||||||
websiteauths:
|
websiteauths:
|
||||||
- unique-name: "test.io"
|
- unique-name: "test.io"
|
||||||
username: "someuser"
|
|
||||||
authtoken: "abedjgbasdodj"
|
authtoken: "abedjgbasdodj"
|
||||||
- unique-name: "example.io"
|
- unique-name: "example.io"
|
||||||
username: "someuser"
|
|
||||||
authtoken: "abedjgbasdodj"
|
authtoken: "abedjgbasdodj"
|
||||||
mon-auth:
|
mon-auth:
|
||||||
grafana-cloud-user: "user"
|
grafana-cloud-user: "user"
|
||||||
|
|
|
@ -3,7 +3,8 @@ websiteconfigs:
|
||||||
- unique-name: "test.io"
|
- unique-name: "test.io"
|
||||||
fqdns: ["test.de", "test.org", "www.test.de", "www.test.org"]
|
fqdns: ["test.de", "test.org", "www.test.de", "www.test.org"]
|
||||||
forgejo-host: "codeberg.org"
|
forgejo-host: "codeberg.org"
|
||||||
forgejo-repo: "repo"
|
repo-owner: "someuser"
|
||||||
|
repo-name: "repo"
|
||||||
branchname: "main"
|
branchname: "main"
|
||||||
redirects:
|
redirects:
|
||||||
- ["/products.html", "/offer.html"]
|
- ["/products.html", "/offer.html"]
|
||||||
|
@ -11,9 +12,11 @@ websiteconfigs:
|
||||||
- unique-name: "example.io"
|
- unique-name: "example.io"
|
||||||
fqdns: ["example.org", "www.example.com"]
|
fqdns: ["example.org", "www.example.com"]
|
||||||
forgejo-host: "fineForgejoHost.net"
|
forgejo-host: "fineForgejoHost.net"
|
||||||
forgejo-repo: "repo"
|
repo-owner: "someotheruser"
|
||||||
|
repo-name: "repo"
|
||||||
branchname: "main"
|
branchname: "main"
|
||||||
mon-cfg:
|
mon-cfg:
|
||||||
grafana-cloud-url: "url-for-your-prom-remote-write-endpoint"
|
grafana-cloud-url: "url-for-your-prom-remote-write-endpoint"
|
||||||
cluster-name: "website"
|
cluster-name: "website"
|
||||||
cluster-stage: "test"
|
cluster-stage: "test"
|
||||||
|
average-rate: 50
|
||||||
|
|
Loading…
Reference in a new issue