Changed issuer keywords to strings
This commit is contained in:
parent
775689b348
commit
5b4e68ae2a
6 changed files with 17 additions and 11 deletions
|
@ -9,7 +9,7 @@
|
||||||
[dda.c4k-nextcloud.nextcloud :as nextcloud]
|
[dda.c4k-nextcloud.nextcloud :as nextcloud]
|
||||||
[dda.c4k-nextcloud.backup :as backup]))
|
[dda.c4k-nextcloud.backup :as backup]))
|
||||||
|
|
||||||
(def config-defaults {:issuer :staging})
|
(def config-defaults {:issuer "staging"})
|
||||||
|
|
||||||
(def auth? (s/keys :req-un [::postgres/postgres-db-user ::postgres/postgres-db-password
|
(def auth? (s/keys :req-un [::postgres/postgres-db-user ::postgres/postgres-db-password
|
||||||
::nextcloud/nextcloud-admin-user ::nextcloud/nextcloud-admin-password
|
::nextcloud/nextcloud-admin-user ::nextcloud/nextcloud-admin-password
|
||||||
|
|
|
@ -10,8 +10,14 @@
|
||||||
[dda.c4k-common.common :as cm]
|
[dda.c4k-common.common :as cm]
|
||||||
[dda.c4k-common.postgres :as postgres]))
|
[dda.c4k-common.postgres :as postgres]))
|
||||||
|
|
||||||
|
; TODO: Replace method in c4k-common.predicate and update all c4k modules.
|
||||||
|
(defn letsencrypt-issuer?
|
||||||
|
[input]
|
||||||
|
(contains? #{"prod" "staging"} input))
|
||||||
|
; TODO: Remove (name ...) function calls, when issuer is no longer a keyword (also in c4k-common)
|
||||||
|
|
||||||
(s/def ::fqdn cp/fqdn-string?)
|
(s/def ::fqdn cp/fqdn-string?)
|
||||||
(s/def ::issuer cp/letsencrypt-issuer?)
|
(s/def ::issuer letsencrypt-issuer?) ;cp/letsencrypt-issuer?
|
||||||
(s/def ::restic-repository string?)
|
(s/def ::restic-repository string?)
|
||||||
(s/def ::nextcloud-data-volume-path string?)
|
(s/def ::nextcloud-data-volume-path string?)
|
||||||
(s/def ::nextcloud-admin-user cp/bash-env-string?)
|
(s/def ::nextcloud-admin-user cp/bash-env-string?)
|
||||||
|
@ -52,7 +58,7 @@
|
||||||
|
|
||||||
(defn generate-ingress [config]
|
(defn generate-ingress [config]
|
||||||
(let [{:keys [fqdn issuer]
|
(let [{:keys [fqdn issuer]
|
||||||
:or {issuer :staging}} config
|
:or {issuer "staging"}} config
|
||||||
letsencrypt-issuer (name issuer)]
|
letsencrypt-issuer (name issuer)]
|
||||||
(->
|
(->
|
||||||
(yaml/from-string (yaml/load-resource "nextcloud/ingress.yaml"))
|
(yaml/from-string (yaml/load-resource "nextcloud/ingress.yaml"))
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
:postgres-db-password "nextcloud-db-password"
|
:postgres-db-password "nextcloud-db-password"
|
||||||
:nextcloud-admin-user "cloudadmin"
|
:nextcloud-admin-user "cloudadmin"
|
||||||
:nextcloud-admin-password "cloudpassword"
|
:nextcloud-admin-password "cloudpassword"
|
||||||
:issuer :prod
|
:issuer "prod"
|
||||||
:nextcloud-data-volume-path "/var/nextcloud"
|
:nextcloud-data-volume-path "/var/nextcloud"
|
||||||
:postgres-data-volume-path "/var/postgres"
|
:postgres-data-volume-path "/var/postgres"
|
||||||
:aws-access-key-id "aws-id"
|
:aws-access-key-id "aws-id"
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
:postgres-db-password "nextcloud-db-password"
|
:postgres-db-password "nextcloud-db-password"
|
||||||
:nextcloud-admin-user "cloudadmin"
|
:nextcloud-admin-user "cloudadmin"
|
||||||
:nextcloud-admin-password "cloudpassword"
|
:nextcloud-admin-password "cloudpassword"
|
||||||
:issuer :prod
|
:issuer "prod"
|
||||||
:aws-access-key-id "aws-id"
|
:aws-access-key-id "aws-id"
|
||||||
:aws-secret-access-key "aws-secret"
|
:aws-secret-access-key "aws-secret"
|
||||||
:restic-password "restic-pw"
|
:restic-password "restic-pw"
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
:postgres-db-password "nextcloud-db-password"
|
:postgres-db-password "nextcloud-db-password"
|
||||||
:nextcloud-admin-user "cloudadmin"
|
:nextcloud-admin-user "cloudadmin"
|
||||||
:nextcloud-admin-password "cloudpassword"
|
:nextcloud-admin-password "cloudpassword"
|
||||||
:issuer :prod
|
:issuer "prod"
|
||||||
:aws-access-key-id "aws-id"
|
:aws-access-key-id "aws-id"
|
||||||
:aws-secret-access-key "aws-secret"
|
:aws-secret-access-key "aws-secret"
|
||||||
:restic-password "restic-pw"}))))
|
:restic-password "restic-pw"}))))
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
:postgres-db-password "nextcloud-db-password"
|
:postgres-db-password "nextcloud-db-password"
|
||||||
:nextcloud-admin-user "cloudadmin"
|
:nextcloud-admin-user "cloudadmin"
|
||||||
:nextcloud-admin-password "cloudpassword"
|
:nextcloud-admin-password "cloudpassword"
|
||||||
:issuer :prod
|
:issuer "prod"
|
||||||
:aws-access-key-id "aws-id"
|
:aws-access-key-id "aws-id"
|
||||||
:aws-secret-access-key "aws-secret"
|
:aws-secret-access-key "aws-secret"
|
||||||
:restic-password "restic-pw"})
|
:restic-password "restic-pw"})
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
:postgres-db-password "nextcloud-db-password"
|
:postgres-db-password "nextcloud-db-password"
|
||||||
:nextcloud-admin-user "cloudadmin"
|
:nextcloud-admin-user "cloudadmin"
|
||||||
:nextcloud-admin-password "cloudpassword"
|
:nextcloud-admin-password "cloudpassword"
|
||||||
:issuer :prod
|
:issuer "prod"
|
||||||
:aws-access-key-id "aws-id"
|
:aws-access-key-id "aws-id"
|
||||||
:aws-secret-access-key "aws-secret"
|
:aws-secret-access-key "aws-secret"
|
||||||
:restic-password "restic-pw"})
|
:restic-password "restic-pw"})
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
:dnsNames ["xx"]
|
:dnsNames ["xx"]
|
||||||
:issuerRef
|
:issuerRef
|
||||||
{:name "prod", :kind "ClusterIssuer"}}}
|
{:name "prod", :kind "ClusterIssuer"}}}
|
||||||
(cut/generate-certificate {:fqdn "xx" :issuer :prod}))))
|
(cut/generate-certificate {:fqdn "xx" :issuer "prod"}))))
|
||||||
|
|
||||||
(deftest should-generate-ingress
|
(deftest should-generate-ingress
|
||||||
(is (= {:apiVersion "networking.k8s.io/v1"
|
(is (= {:apiVersion "networking.k8s.io/v1"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
{:fqdn "cloud.test.meissa-gmbh.de"
|
{:fqdn "cloud.test.meissa-gmbh.de"
|
||||||
:issuer :staging
|
:issuer "staging"
|
||||||
:nextcloud-data-volume-path "/var/cloud"
|
:nextcloud-data-volume-path "/var/cloud"
|
||||||
:postgres-data-volume-path "/var/postgres"
|
:postgres-data-volume-path "/var/postgres"
|
||||||
:restic-repository "s3:s3.amazonaws.com/your-bucket/your-folder"}
|
:restic-repository "s3:s3.amazonaws.com/your-bucket/your-folder"}
|
|
@ -1,5 +1,5 @@
|
||||||
fqdn: "cloud.test.meissa-gmbh.de"
|
fqdn: "cloud.test.meissa-gmbh.de"
|
||||||
issuer: :staging
|
issuer: "staging"
|
||||||
nextcloud-data-volume-path: "/var/cloud"
|
nextcloud-data-volume-path: "/var/cloud"
|
||||||
postgres-data-volume-path: "/var/postgres"
|
postgres-data-volume-path: "/var/postgres"
|
||||||
restic-repository: "s3:s3.amazonaws.com/your-bucket/your-folder"
|
restic-repository: "s3:s3.amazonaws.com/your-bucket/your-folder"
|
Loading…
Reference in a new issue