Compare commits
No commits in common. "6504668953629d69102630f250f7fed59e8335c7" and "5d3621f6f82047434adfd4c0eefa23411628417b" have entirely different histories.
6504668953
...
5d3621f6f8
9 changed files with 120 additions and 110 deletions
|
@ -87,6 +87,7 @@
|
||||||
name (replace-dots-by-minus unique-name)]
|
name (replace-dots-by-minus unique-name)]
|
||||||
(->
|
(->
|
||||||
(yaml/load-as-edn "website/nginx-deployment.yaml")
|
(yaml/load-as-edn "website/nginx-deployment.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)
|
||||||
(cm/replace-all-matching-values-by-new-value "BUILD_CPU_REQUEST" build-cpu-request)
|
(cm/replace-all-matching-values-by-new-value "BUILD_CPU_REQUEST" build-cpu-request)
|
||||||
|
@ -101,6 +102,7 @@
|
||||||
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 %
|
||||||
|
@ -115,24 +117,48 @@
|
||||||
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))))
|
||||||
|
|
||||||
|
|
||||||
|
(defn-spec generate-website-content-volume map?
|
||||||
|
[config websiteconfig?]
|
||||||
|
(let [{:keys [unique-name volume-size]} config
|
||||||
|
name (replace-dots-by-minus unique-name)]
|
||||||
|
(->
|
||||||
|
(yaml/load-as-edn "website/website-content-volume.yaml")
|
||||||
|
(assoc-in [:metadata :labels :app.kubernetes.part-of] name)
|
||||||
|
(replace-all-matching-substrings-beginning-with "NAME" name)
|
||||||
|
(cm/replace-all-matching-values-by-new-value "WEBSITESTORAGESIZE" (str volume-size "Gi")))))
|
||||||
|
|
||||||
|
|
||||||
|
(defn-spec generate-hashfile-volume map?
|
||||||
|
[config websiteconfig?]
|
||||||
|
(let [{:keys [unique-name]} config
|
||||||
|
name (replace-dots-by-minus unique-name)]
|
||||||
|
(->
|
||||||
|
(yaml/load-as-edn "website/hashfile-volume.yaml")
|
||||||
|
(assoc-in [:metadata :labels :app.kubernetes.part-of] name)
|
||||||
|
(replace-all-matching-substrings-beginning-with "NAME" name))))
|
||||||
|
|
||||||
|
|
||||||
(defn-spec generate-website-build-cron map?
|
(defn-spec generate-website-build-cron map?
|
||||||
[config websiteconfig?]
|
[config websiteconfig?]
|
||||||
(let [{:keys [unique-name build-cpu-request build-cpu-limit build-memory-request
|
(let [{:keys [unique-name build-cpu-request build-cpu-limit build-memory-request
|
||||||
build-memory-limit]} config
|
build-memory-limit]} config
|
||||||
name (replace-dots-by-minus unique-name)]
|
name (replace-dots-by-minus unique-name)]
|
||||||
(->
|
(->
|
||||||
(yaml/load-as-edn "website/build-cron.yaml")
|
(yaml/load-as-edn "website/website-build-cron.yaml")
|
||||||
(replace-all-matching-substrings-beginning-with "NAME" name)
|
(assoc-in [:metadata :labels :app.kubernetes.part-of] name)
|
||||||
(cm/replace-all-matching-values-by-new-value "BUILD_CPU_REQUEST" build-cpu-request)
|
(replace-all-matching-substrings-beginning-with "NAME" name)
|
||||||
(cm/replace-all-matching-values-by-new-value "BUILD_CPU_LIMIT" build-cpu-limit)
|
(cm/replace-all-matching-values-by-new-value "BUILD_CPU_REQUEST" build-cpu-request)
|
||||||
(cm/replace-all-matching-values-by-new-value "BUILD_MEMORY_REQUEST" build-memory-request)
|
(cm/replace-all-matching-values-by-new-value "BUILD_CPU_LIMIT" build-cpu-limit)
|
||||||
(cm/replace-all-matching-values-by-new-value "BUILD_MEMORY_LIMIT" build-memory-limit))))
|
(cm/replace-all-matching-values-by-new-value "BUILD_MEMORY_REQUEST" build-memory-request)
|
||||||
|
(cm/replace-all-matching-values-by-new-value "BUILD_MEMORY_LIMIT" build-memory-limit))))
|
||||||
|
|
||||||
|
|
||||||
|
; TODO: Non-Secret-Parts should be config map
|
||||||
(defn-spec generate-website-build-secret pred/map-or-seq?
|
(defn-spec generate-website-build-secret pred/map-or-seq?
|
||||||
[config websiteconfig?
|
[config websiteconfig?
|
||||||
auth websiteauth?]
|
auth websiteauth?]
|
||||||
|
@ -144,7 +170,8 @@
|
||||||
username]} auth
|
username]} 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/website-build-secret.yaml")
|
||||||
|
(assoc-in [:metadata :labels :app.kubernetes.part-of] name)
|
||||||
(replace-all-matching-substrings-beginning-with "NAME" name)
|
(replace-all-matching-substrings-beginning-with "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
|
(cm/replace-all-matching-values-by-new-value "REPOURL" (b64/encode
|
||||||
|
@ -160,26 +187,6 @@
|
||||||
username))))))
|
username))))))
|
||||||
|
|
||||||
|
|
||||||
(defn-spec generate-website-content-volume map?
|
|
||||||
[config websiteconfig?]
|
|
||||||
(let [{:keys [unique-name volume-size]} config
|
|
||||||
name (replace-dots-by-minus unique-name)]
|
|
||||||
(->
|
|
||||||
(yaml/load-as-edn "website/content-pvc.yaml")
|
|
||||||
(replace-all-matching-substrings-beginning-with "NAME" name)
|
|
||||||
(cm/replace-all-matching-values-by-new-value "WEBSITESTORAGESIZE" (str volume-size "Gi")))))
|
|
||||||
|
|
||||||
|
|
||||||
; TODO: Non-Secret-Parts should be config map
|
|
||||||
(defn-spec generate-hashfile-volume map?
|
|
||||||
[config websiteconfig?]
|
|
||||||
(let [{:keys [unique-name]} config
|
|
||||||
name (replace-dots-by-minus unique-name)]
|
|
||||||
(->
|
|
||||||
(yaml/load-as-edn "website/hash-state-pvc.yaml")
|
|
||||||
(replace-all-matching-substrings-beginning-with "NAME" name))))
|
|
||||||
|
|
||||||
|
|
||||||
#?(:cljs
|
#?(:cljs
|
||||||
(defmethod yaml/load-resource :website [resource-name]
|
(defmethod yaml/load-resource :website [resource-name]
|
||||||
(get (inline-resources "website") resource-name)))
|
(get (inline-resources "website") resource-name)))
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
metadata:
|
metadata:
|
||||||
name: hash-state-volume
|
name: NAME-hashfile-volume
|
||||||
namespace: NAME
|
namespace: default
|
||||||
labels:
|
labels:
|
||||||
|
app: NAME-nginx
|
||||||
app.kubernetes.part-of: NAME-website
|
app.kubernetes.part-of: NAME-website
|
||||||
spec:
|
spec:
|
||||||
storageClassName: local-path
|
storageClassName: local-path
|
|
@ -9,7 +9,7 @@ data:
|
||||||
nginx.conf: |
|
nginx.conf: |
|
||||||
user nginx;
|
user nginx;
|
||||||
worker_processes 3;
|
worker_processes 3;
|
||||||
error_log stdout info;
|
error_log /var/log/nginx/error.log;
|
||||||
pid /var/log/nginx/nginx.pid;
|
pid /var/log/nginx/nginx.pid;
|
||||||
worker_rlimit_nofile 8192;
|
worker_rlimit_nofile 8192;
|
||||||
events {
|
events {
|
||||||
|
@ -21,7 +21,7 @@ data:
|
||||||
log_format main '$remote_addr - $remote_user [$time_local] $status'
|
log_format main '$remote_addr - $remote_user [$time_local] $status'
|
||||||
'"$request" $body_bytes_sent "$http_referer"'
|
'"$request" $body_bytes_sent "$http_referer"'
|
||||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||||
access_log stdout main;
|
access_log /var/log/nginx/access.log main;
|
||||||
sendfile on;
|
sendfile on;
|
||||||
tcp_nopush on;
|
tcp_nopush on;
|
||||||
keepalive_timeout 65;
|
keepalive_timeout 65;
|
||||||
|
|
|
@ -46,7 +46,7 @@ spec:
|
||||||
command: ["/entrypoint.sh"]
|
command: ["/entrypoint.sh"]
|
||||||
envFrom:
|
envFrom:
|
||||||
- secretRef:
|
- secretRef:
|
||||||
name: build-secret
|
name: secret
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: content-volume
|
- name: content-volume
|
||||||
mountPath: /var/www/html/website
|
mountPath: /var/www/html/website
|
||||||
|
|
|
@ -5,10 +5,10 @@ metadata:
|
||||||
namespace: default
|
namespace: default
|
||||||
labels:
|
labels:
|
||||||
app: NAME
|
app: NAME
|
||||||
app.kubernetes.part-of: NAME-website
|
app.kubernetes.part-of: NAME
|
||||||
spec:
|
spec:
|
||||||
selector:
|
selector:
|
||||||
app: nginx
|
app: NAME
|
||||||
ports:
|
ports:
|
||||||
- name: nginx-http
|
- name: nginx-http
|
||||||
port: 80
|
port: 80
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
apiVersion: batch/v1
|
apiVersion: batch/v1
|
||||||
kind: CronJob
|
kind: CronJob
|
||||||
metadata:
|
metadata:
|
||||||
name: build-cron
|
name: NAME-build-cron
|
||||||
namespace: NAME
|
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.part-of: NAME-website
|
app.kubernetes.part-of: NAME-website
|
||||||
spec:
|
spec:
|
||||||
|
@ -12,15 +11,10 @@ spec:
|
||||||
jobTemplate:
|
jobTemplate:
|
||||||
spec:
|
spec:
|
||||||
template:
|
template:
|
||||||
metadata:
|
|
||||||
namespace: NAME
|
|
||||||
labels:
|
|
||||||
app: build-cron
|
|
||||||
app.kubernetes.part-of: NAME-website
|
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- image: domaindrivenarchitecture/c4k-website-build
|
- image: domaindrivenarchitecture/c4k-website-build
|
||||||
name: build-cron-container
|
name: NAME-build-app
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
|
@ -32,18 +26,18 @@ spec:
|
||||||
command: ["/entrypoint.sh"]
|
command: ["/entrypoint.sh"]
|
||||||
envFrom:
|
envFrom:
|
||||||
- secretRef:
|
- secretRef:
|
||||||
name: build-secret
|
name: NAME-secret
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: content-volume
|
- name: content-volume
|
||||||
mountPath: /var/www/html/website
|
mountPath: /var/www/html/website
|
||||||
- name: hash-state-volume
|
- name: hashfile-volume
|
||||||
mountPath: /var/hashfile.d
|
mountPath: /var/hashfile.d
|
||||||
volumes:
|
volumes:
|
||||||
- name: content-volume
|
- name: content-volume
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: content-volume
|
claimName: NAME-content-volume
|
||||||
- name: hash-state-volume
|
- name: hashfile-volume
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
claimName: hash-state-volume
|
claimName: NAME-hashfile-volume
|
||||||
restartPolicy: OnFailure
|
restartPolicy: OnFailure
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
name: build-secret
|
name: NAME-secret
|
||||||
namespace: NAME
|
|
||||||
labels:
|
labels:
|
||||||
app.kubernetes.part-of: NAME-website
|
app.kubernetes.part-of: NAME-website
|
||||||
data:
|
data:
|
|
@ -1,9 +1,10 @@
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: PersistentVolumeClaim
|
kind: PersistentVolumeClaim
|
||||||
metadata:
|
metadata:
|
||||||
name: content-volume
|
name: NAME-content-volume
|
||||||
namespace: NAME
|
namespace: default
|
||||||
labels:
|
labels:
|
||||||
|
app: NAME-nginx
|
||||||
app.kubernetes.part-of: NAME-website
|
app.kubernetes.part-of: NAME-website
|
||||||
spec:
|
spec:
|
||||||
storageClassName: local-path
|
storageClassName: local-path
|
|
@ -3,6 +3,7 @@
|
||||||
#?(:clj [clojure.test :refer [deftest is are testing run-tests]]
|
#?(:clj [clojure.test :refer [deftest is are testing run-tests]]
|
||||||
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
|
:cljs [cljs.test :refer-macros [deftest is are testing run-tests]])
|
||||||
[clojure.spec.test.alpha :as st]
|
[clojure.spec.test.alpha :as st]
|
||||||
|
[dda.c4k-common.test-helper :as th]
|
||||||
[dda.c4k-website.website.website-internal :as cut]))
|
[dda.c4k-website.website.website-internal :as cut]))
|
||||||
|
|
||||||
(st/instrument `cut/generate-nginx-configmap)
|
(st/instrument `cut/generate-nginx-configmap)
|
||||||
|
@ -68,7 +69,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"]})))))
|
||||||
(is (= "user nginx;\nworker_processes 3;\nerror_log stdout info;\npid /var/log/nginx/nginx.pid;\nworker_rlimit_nofile 8192;\nevents {\n worker_connections 4096;\n}\nhttp {\n include /etc/nginx/mime.types;\n default_type application/octet-stream;\n log_format main '$remote_addr - $remote_user [$time_local] $status'\n '\"$request\" $body_bytes_sent \"$http_referer\"'\n '\"$http_user_agent\" \"$http_x_forwarded_for\"';\n access_log stdout main;\n sendfile on;\n tcp_nopush on;\n keepalive_timeout 65;\n server_names_hash_bucket_size 128;\n include /etc/nginx/conf.d/website.conf;\n}\n"
|
(is (= "user nginx;\nworker_processes 3;\nerror_log /var/log/nginx/error.log;\npid /var/log/nginx/nginx.pid;\nworker_rlimit_nofile 8192;\nevents {\n worker_connections 4096;\n}\nhttp {\n include /etc/nginx/mime.types;\n default_type application/octet-stream;\n log_format main '$remote_addr - $remote_user [$time_local] $status'\n '\"$request\" $body_bytes_sent \"$http_referer\"'\n '\"$http_user_agent\" \"$http_x_forwarded_for\"';\n access_log /var/log/nginx/access.log main;\n sendfile on;\n tcp_nopush on;\n keepalive_timeout 65;\n server_names_hash_bucket_size 128;\n include /etc/nginx/conf.d/website.conf;\n}\n"
|
||||||
(:nginx.conf (:data (cut/generate-nginx-configmap {:issuer "staging"
|
(:nginx.conf (:data (cut/generate-nginx-configmap {:issuer "staging"
|
||||||
:build-cpu-request "500m"
|
:build-cpu-request "500m"
|
||||||
:build-cpu-limit "1700m"
|
:build-cpu-limit "1700m"
|
||||||
|
@ -82,9 +83,9 @@
|
||||||
: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-website"},
|
:metadata {:labels {:app.kubernetes.part-of "test-io"},
|
||||||
:namespace "test-io",
|
:namespace "test-io",
|
||||||
:name "etc-nginx"}}
|
:name "etc-ngingx"}}
|
||||||
(dissoc (cut/generate-nginx-configmap {:issuer "staging"
|
(dissoc (cut/generate-nginx-configmap {:issuer "staging"
|
||||||
:build-cpu-request "500m"
|
:build-cpu-request "500m"
|
||||||
:build-cpu-limit "1700m"
|
:build-cpu-limit "1700m"
|
||||||
|
@ -98,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 (= {:kind "Service",
|
(is (= {:name-c1 "test-io",
|
||||||
:apiVersion "v1",
|
:name-c2 "test-org",
|
||||||
:metadata
|
:app-c1 "test-io",
|
||||||
{:name "test-io",
|
:app-c2 "test-org",
|
||||||
:namespace "test-io",
|
:app.kubernetes.part-of-c1 "test-io",
|
||||||
:labels {:app "test-io", :app.kubernetes.part-of "test-io-website"}},
|
:app.kubernetes.part-of-c2 "test-org"
|
||||||
:spec
|
:namespace-c1 "test-io",
|
||||||
{:selector {:app "nginx"}, :ports [{:name "nginx-http", :port 80}]}}
|
:namespace-c2 "test-org"}
|
||||||
(cut/generate-nginx-service {:issuer "staging"
|
(th/map-diff (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"
|
||||||
|
@ -117,14 +118,23 @@
|
||||||
: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",
|
||||||
:kind "CronJob",
|
:kind "CronJob",
|
||||||
:metadata {:name "build-cron",
|
:metadata {:name "test-io-build-cron",
|
||||||
:namespace "test-io",
|
:labels {:app.kubernetes.part-of "test-io"}},
|
||||||
:labels {:app.kubernetes.part-of "test-io-website"}},
|
|
||||||
:spec
|
:spec
|
||||||
{:schedule "0/7 * * * *",
|
{:schedule "0/7 * * * *",
|
||||||
:successfulJobsHistoryLimit 1,
|
:successfulJobsHistoryLimit 1,
|
||||||
|
@ -132,22 +142,18 @@
|
||||||
:jobTemplate
|
:jobTemplate
|
||||||
{:spec
|
{:spec
|
||||||
{:template
|
{:template
|
||||||
{:metadata
|
{:spec
|
||||||
{:namespace "test-io",
|
|
||||||
:labels
|
|
||||||
{:app "build-cron", :app.kubernetes.part-of "test-io-website"}}
|
|
||||||
:spec
|
|
||||||
{:containers
|
{:containers
|
||||||
[{:image "domaindrivenarchitecture/c4k-website-build",
|
[{:image "domaindrivenarchitecture/c4k-website-build",
|
||||||
:name "build-cron-container",
|
:name "test-io-build-app",
|
||||||
: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 [{:secretRef {:name "test-io-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 "hashfile-volume", :mountPath "/var/hashfile.d"}]}],
|
||||||
:volumes [{:name "content-volume", :persistentVolumeClaim {:claimName "content-volume"}}
|
:volumes [{:name "content-volume", :persistentVolumeClaim {:claimName "test-io-content-volume"}}
|
||||||
{:name "hash-state-volume", :persistentVolumeClaim {:claimName "hash-state-volume"}}],
|
{:name "hashfile-volume", :persistentVolumeClaim {:claimName "test-io-hashfile-volume"}}],
|
||||||
:restartPolicy "OnFailure"}}}}}}
|
:restartPolicy "OnFailure"}}}}}}
|
||||||
(cut/generate-website-build-cron {:issuer "staging"
|
(cut/generate-website-build-cron {:issuer "staging"
|
||||||
:build-cpu-request "500m"
|
:build-cpu-request "500m"
|
||||||
|
@ -161,13 +167,10 @@
|
||||||
:branchname "main",
|
:branchname "main",
|
||||||
:unique-name "test.io"}))))
|
:unique-name "test.io"}))))
|
||||||
|
|
||||||
|
|
||||||
(deftest should-generate-website-build-secret
|
(deftest should-generate-website-build-secret
|
||||||
(is (= {:apiVersion "v1",
|
(is (= {:apiVersion "v1",
|
||||||
:kind "Secret",
|
:kind "Secret",
|
||||||
:metadata {:name "build-secret",
|
:metadata {:name "test-io-secret", :labels {:app.kubernetes.part-of "test-io"}},
|
||||||
:namespace "test-io",
|
|
||||||
:labels {:app.kubernetes.part-of "test-io-website"}},
|
|
||||||
:data
|
:data
|
||||||
{:AUTHTOKEN "YWJlZGpnYmFzZG9kag==",
|
{:AUTHTOKEN "YWJlZGpnYmFzZG9kag==",
|
||||||
:GITREPOURL "aHR0cHM6Ly9naXRsYWIuZGUvYXBpL3YxL3JlcG9zL3NvbWV1c2VyL3JlcG8vYXJjaGl2ZS9tYWluLnppcA==",
|
:GITREPOURL "aHR0cHM6Ly9naXRsYWIuZGUvYXBpL3YxL3JlcG9zL3NvbWV1c2VyL3JlcG8vYXJjaGl2ZS9tYWluLnppcA==",
|
||||||
|
@ -188,38 +191,43 @@
|
||||||
:username "someuser"}))))
|
:username "someuser"}))))
|
||||||
|
|
||||||
(deftest should-generate-website-content-volume
|
(deftest should-generate-website-content-volume
|
||||||
(is (= {:apiVersion "v1",
|
(is (= {:name-c1 "test-io-content-volume",
|
||||||
:kind "PersistentVolumeClaim",
|
:name-c2 "test-org-content-volume",
|
||||||
:metadata
|
:app-c1 "test-io-nginx",
|
||||||
{:name "content-volume",
|
:app-c2 "test-org-nginx",
|
||||||
:namespace "test-io",
|
:app.kubernetes.part-of-c1 "test-io",
|
||||||
:labels {:app.kubernetes.part-of "test-io-website"}},
|
:app.kubernetes.part-of-c2 "test-org"}
|
||||||
:spec
|
(th/map-diff (cut/generate-website-content-volume {:issuer "staging"
|
||||||
{:storageClassName "local-path",
|
:build-cpu-request "500m"
|
||||||
:accessModes ["ReadWriteOnce"],
|
:build-cpu-limit "1700m"
|
||||||
:resources {:requests {:storage "3Gi"}}}}
|
:build-memory-request "256Mi"
|
||||||
(cut/generate-website-content-volume {:issuer "staging"
|
:build-memory-limit "512Mi"
|
||||||
:build-cpu-request "500m"
|
:volume-size "3"
|
||||||
:build-cpu-limit "1700m"
|
:unique-name "test.io",
|
||||||
:build-memory-request "256Mi"
|
:forgejo-host "gitea.evilorg",
|
||||||
:build-memory-limit "512Mi"
|
:forgejo-repo "none",
|
||||||
:volume-size "3"
|
:branchname "mablain",
|
||||||
:unique-name "test.io",
|
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]})
|
||||||
:forgejo-host "gitea.evilorg",
|
(cut/generate-website-content-volume {:issuer "staging"
|
||||||
:forgejo-repo "none",
|
:build-cpu-request "500m"
|
||||||
:branchname "mablain",
|
:build-cpu-limit "1700m"
|
||||||
:fqdns ["test.de" "www.test.de" "test-it.de" "www.test-it.de"]}))))
|
: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-hashfile-volume
|
(deftest should-generate-hashfile-volume
|
||||||
(is (= {:apiVersion "v1",
|
(is (= {:apiVersion "v1",
|
||||||
:kind "PersistentVolumeClaim",
|
:kind "PersistentVolumeClaim",
|
||||||
:metadata
|
:metadata
|
||||||
{:name "hash-state-volume",
|
{:name "test-io-hashfile-volume",
|
||||||
:namespace "test-io",
|
:namespace "default",
|
||||||
:labels {:app.kubernetes.part-of "test-io-website"}},
|
:labels {:app "test-io-nginx", :app.kubernetes.part-of "test-io"}},
|
||||||
:spec {:storageClassName "local-path",
|
:spec {:storageClassName "local-path", :accessModes ["ReadWriteOnce"], :resources {:requests {:storage "16Mi"}}}}
|
||||||
:accessModes ["ReadWriteOnce"],
|
|
||||||
:resources {:requests {:storage "16Mi"}}}}
|
|
||||||
(cut/generate-hashfile-volume {:issuer "staging"
|
(cut/generate-hashfile-volume {:issuer "staging"
|
||||||
:build-cpu-request "500m"
|
:build-cpu-request "500m"
|
||||||
:build-cpu-limit "1700m"
|
:build-cpu-limit "1700m"
|
||||||
|
|
Loading…
Reference in a new issue