fix service names

This commit is contained in:
Michael Jerger 2024-02-27 10:09:47 +01:00
parent 1790487d6e
commit 53fc7a990d
3 changed files with 13 additions and 25 deletions

View file

@ -102,7 +102,6 @@
name (replace-dots-by-minus unique-name)] name (replace-dots-by-minus unique-name)]
(-> (->
(yaml/load-as-edn "website/nginx-configmap.yaml") (yaml/load-as-edn "website/nginx-configmap.yaml")
(assoc-in [:metadata :labels :app.kubernetes.part-of] name)
(assoc-in [:metadata :namespace] name) (assoc-in [:metadata :namespace] name)
(replace-all-matching-substrings-beginning-with "NAME" name) (replace-all-matching-substrings-beginning-with "NAME" name)
(#(assoc-in % (#(assoc-in %
@ -117,7 +116,6 @@
name (replace-dots-by-minus unique-name)] name (replace-dots-by-minus unique-name)]
(-> (->
(yaml/load-as-edn "website/nginx-service.yaml") (yaml/load-as-edn "website/nginx-service.yaml")
(assoc-in [:metadata :labels :app.kubernetes.part-of] name)
(assoc-in [:metadata :namespace] name) (assoc-in [:metadata :namespace] name)
(replace-all-matching-substrings-beginning-with "NAME" name)))) (replace-all-matching-substrings-beginning-with "NAME" name))))

View file

@ -5,10 +5,10 @@ metadata:
namespace: default namespace: default
labels: labels:
app: NAME app: NAME
app.kubernetes.part-of: NAME app.kubernetes.part-of: NAME-website
spec: spec:
selector: selector:
app: NAME app: nginx
ports: ports:
- name: nginx-http - name: nginx-http
port: 80 port: 80

View file

@ -83,7 +83,7 @@
: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"]})))))
(is (= {:apiVersion "v1", (is (= {:apiVersion "v1",
:kind "ConfigMap", :kind "ConfigMap",
:metadata {:labels {:app.kubernetes.part-of "test-io"}, :metadata {:labels {:app.kubernetes.part-of "test-io-website"},
:namespace "test-io", :namespace "test-io",
:name "etc-nginx"}} :name "etc-nginx"}}
(dissoc (cut/generate-nginx-configmap {:issuer "staging" (dissoc (cut/generate-nginx-configmap {:issuer "staging"
@ -99,15 +99,15 @@
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]}) :data)))) :fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]}) :data))))
(deftest should-generate-nginx-service (deftest should-generate-nginx-service
(is (= {:name-c1 "test-io", (is (= {:kind "Service",
:name-c2 "test-org", :apiVersion "v1",
:app-c1 "test-io", :metadata
:app-c2 "test-org", {:name "test-io",
:app.kubernetes.part-of-c1 "test-io", :namespace "test-io",
:app.kubernetes.part-of-c2 "test-org" :labels {:app "test-io", :app.kubernetes.part-of "test-io-website"}},
:namespace-c1 "test-io", :spec
:namespace-c2 "test-org"} {:selector {:app "nginx"}, :ports [{:name "nginx-http", :port 80}]}}
(th/map-diff (cut/generate-nginx-service {:issuer "staging" (cut/generate-nginx-service {:issuer "staging"
:build-cpu-request "500m" :build-cpu-request "500m"
:build-cpu-limit "1700m" :build-cpu-limit "1700m"
:build-memory-request "256Mi" :build-memory-request "256Mi"
@ -118,17 +118,7 @@
:forgejo-repo "none", :forgejo-repo "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"]})
(cut/generate-nginx-service {:issuer "staging" )))
:build-cpu-request "500m"
:build-cpu-limit "1700m"
:build-memory-request "256Mi"
:build-memory-limit "512Mi"
:volume-size "3"
:unique-name "test.org",
:forgejo-host "gitea.evilorg",
:forgejo-repo "none",
:branchname "mablain",
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})))))
(deftest should-generate-website-build-cron (deftest should-generate-website-build-cron
(is (= {:apiVersion "batch/v1", (is (= {:apiVersion "batch/v1",