fixed lein test

This commit is contained in:
bom 2021-10-21 14:07:59 +02:00
parent a40773983e
commit 5896cae9d6
2 changed files with 22 additions and 55 deletions

View file

@ -10,7 +10,7 @@
:kind "Secret" :kind "Secret"
:metadata {:name "backup-secret"} :metadata {:name "backup-secret"}
:type "Opaque" :type "Opaque"
:stringData :data
{:aws-access-key-id "YXdzLWlk", :aws-secret-access-key "YXdzLXNlY3JldA==", :restic-password "cmVzdGljLXB3"}} {:aws-access-key-id "YXdzLWlk", :aws-secret-access-key "YXdzLXNlY3JldA==", :restic-password "cmVzdGljLXB3"}}
(cut/generate-secret {:aws-access-key-id "aws-id" :aws-secret-access-key "aws-secret" :restic-password "restic-pw"})))) (cut/generate-secret {:aws-access-key-id "aws-id" :aws-secret-access-key "aws-secret" :restic-password "restic-pw"}))))
@ -38,7 +38,7 @@
{:spec {:spec
{:containers {:containers
[{:name "backup-app" [{:name "backup-app"
:image "domaindrivenarchitecture/meissa-cloud-backup" :image "domaindrivenarchitecture/c4k-cloud-backup"
:imagePullPolicy "IfNotPresent" :imagePullPolicy "IfNotPresent"
:command ["/entrypoint.sh"] :command ["/entrypoint.sh"]
:env :env

View file

@ -9,7 +9,7 @@
:kind "Secret" :kind "Secret"
:metadata {:name "cloud-secret"} :metadata {:name "cloud-secret"}
:type "Opaque" :type "Opaque"
:stringData :data
{:nextcloud-admin-user "Y2xvdWRhZG1pbg==" {:nextcloud-admin-user "Y2xvdWRhZG1pbg=="
:nextcloud-admin-password "Y2xvdWRwYXNzd29yZA=="}} :nextcloud-admin-password "Y2xvdWRwYXNzd29yZA=="}}
(cut/generate-secret {:nextcloud-admin-user "cloudadmin" (cut/generate-secret {:nextcloud-admin-user "cloudadmin"
@ -58,71 +58,38 @@
(deftest should-generate-persistent-volume (deftest should-generate-persistent-volume
(is (= {:kind "PersistentVolume" (is (= {:kind "PersistentVolume"
:apiVersion "v1" :apiVersion "v1"
:metadata {:name "cloud-pv-volume", :labels {:type "local" :app "cloud"}} :metadata {:name "cloud-pv-volume"
:spec :labels {:type "local", :app.kubernetes.io/application "cloud"}}
{:storageClassName "manual" :spec {:storageClassName "manual"
:accessModes ["ReadWriteOnce"] :accessModes ["ReadWriteOnce"]
:capacity {:storage "200Gi"} :capacity {:storage "200Gi"}
:hostPath {:path "xx"}}} :hostPath {:path "xx"}}}
(cut/generate-persistent-volume {:nextcloud-data-volume-path "xx"})))) (cut/generate-persistent-volume {:nextcloud-data-volume-path "xx"}))))
(deftest should-generate-deployment (deftest should-generate-deployment
(is (= {:apiVersion "apps/v1" (is (= {:apiVersion "apps/v1"
:kind "Deployment" :kind "Deployment"
:metadata {:name "cloud"} :metadata {:name "cloud-deployment"}
:spec :spec
{:selector {:matchLabels {:app "cloud"}} {:selector {:matchLabels #:app.kubernetes.io{:name "cloud-pod", :application "cloud"}}
:strategy {:type "Recreate"} :strategy {:type "Recreate"}
:template :template
{:metadata {:labels {:app "cloud"}} {:metadata {:labels {:app.kubernetes.io/name "cloud-pod", :app.kubernetes.io/application "cloud", :redeploy "v3"}}
:spec :spec
{:containers {:containers
[{:image "domaindrivenarchitecture/meissa-cloud-app" [{:image "domaindrivenarchitecture/c4k-cloud"
:name "cloud-app" :name "cloud-app"
:imagePullPolicy "IfNotPresent" :imagePullPolicy "IfNotPresent"
:ports [{:containerPort 80}] :ports [{:containerPort 80}]
:env :env
[{:name "NEXTCLOUD_ADMIN_USER_FILE" [{:name "NEXTCLOUD_ADMIN_USER", :valueFrom {:secretKeyRef {:name "cloud-secret", :key "nextcloud-admin-user"}}}
:value {:name "NEXTCLOUD_ADMIN_PASSWORD"
"/var/run/secrets/cloud-secrets/nextcloud-admin-user"} :valueFrom {:secretKeyRef {:name "cloud-secret", :key "nextcloud-admin-password"}}}
{:name "NEXTCLOUD_ADMIN_PASSWORD_FILE"
:value
"/var/run/secrets/cloud-secrets/nextcloud-admin-password"}
{:name "NEXTCLOUD_TRUSTED_DOMAINS", :value "xx"} {:name "NEXTCLOUD_TRUSTED_DOMAINS", :value "xx"}
{:name "POSTGRES_USER_FILE" {:name "POSTGRES_USER", :valueFrom {:secretKeyRef {:name "postgres-secret", :key "postgres-user"}}}
:value {:name "POSTGRES_PASSWORD", :valueFrom {:secretKeyRef {:name "postgres-secret", :key "postgres-password"}}}
"/var/run/secrets/postgres-secret/postgres-user"} {:name "POSTGRES_DB", :valueFrom {:configMapKeyRef {:name "postgres-config", :key "postgres-db"}}}
{:name "POSTGRES_PASSWORD_FILE" {:name "POSTGRES_HOST", :value "postgresql-service:5432"}]
:value :volumeMounts [{:name "cloud-data-volume", :mountPath "/var/www/html"}]}]
"/var/run/secrets/postgres-secret/postgres-password"} :volumes [{:name "cloud-data-volume", :persistentVolumeClaim {:claimName "cloud-pvc"}}]}}}}
{:name "POSTGRES_DB_FILE"
:value
"/var/run/configs/postgres-config/postgres-db"}
{:name "POSTGRES_HOST"
:value "postgresql-service:5432"}]
:volumeMounts
[{:name "cloud-data-volume"
:mountPath "/var/www/html"}
{:name "cloud-secret-volume"
:mountPath "/var/run/secrets/cloud-secrets"
:readOnly true}
{:name "postgres-secret-volume"
:mountPath "/var/run/secrets/postgres-secret"
:readOnly true}
{:name "postgres-config-volume"
:mountPath "/var/run/configs/postgres-config"
:readOnly true}]}]
:volumes
[{:name "cloud-data-volume"
:persistentVolumeClaim {:claimName "cloud-pvc"}}
{:name "cloud-secret-volume"
:secret {:secretName "cloud-secret"}}
{:name "postgres-secret-volume"
:secret {:secretName "postgres-secret"}}
{:name "postgres-config-volume"
:configMap
{:name "postgres-config"
:items [{:key "postgres-db", :path "postgres-db"}]}}
{:name "backup-secret-volume"
:secret {:secretName "backup-secret"}}]}}}}
(cut/generate-deployment {:fqdn "xx"})))) (cut/generate-deployment {:fqdn "xx"}))))