adjust to new issuer naming

This commit is contained in:
jerger 2022-03-19 19:15:06 +01:00
parent 4dbe5367a7
commit a224506caa
3 changed files with 6 additions and 6 deletions

View file

@ -10,7 +10,7 @@
[dda.c4k-common.common :as cm] [dda.c4k-common.common :as cm]
[dda.c4k-common.postgres :as postgres])) [dda.c4k-common.postgres :as postgres]))
(s/def ::fqdn any?) ; TODO: Fix fqdn-string? to include localhost (s/def ::fqdn cp/fqdn-string?)
(s/def ::issuer cp/letsencrypt-issuer?) (s/def ::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?)
@ -38,7 +38,7 @@
(defn generate-certificate [config] (defn generate-certificate [config]
(let [{:keys [fqdn issuer]} config (let [{:keys [fqdn issuer]} config
letsencrypt-issuer (str "letsencrypt-" (name issuer) "-issuer")] letsencrypt-issuer (name issuer)]
(-> (->
(yaml/from-string (yaml/load-resource "nextcloud/certificate.yaml")) (yaml/from-string (yaml/load-resource "nextcloud/certificate.yaml"))
(assoc-in [:spec :commonName] fqdn) (assoc-in [:spec :commonName] fqdn)
@ -53,7 +53,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 (str "letsencrypt-" (name issuer) "-issuer")] letsencrypt-issuer (name issuer)]
(-> (->
(yaml/from-string (yaml/load-resource "nextcloud/ingress.yaml")) (yaml/from-string (yaml/load-resource "nextcloud/ingress.yaml"))
(assoc-in [:metadata :annotations :cert-manager.io/cluster-issuer] letsencrypt-issuer) (assoc-in [:metadata :annotations :cert-manager.io/cluster-issuer] letsencrypt-issuer)

View file

@ -9,5 +9,5 @@ spec:
dnsNames: dnsNames:
- fqdn - fqdn
issuerRef: issuerRef:
name: letsencrypt-staging-issuer name: staging
kind: ClusterIssuer kind: ClusterIssuer

View file

@ -24,7 +24,7 @@
:commonName "xx" :commonName "xx"
:dnsNames ["xx"] :dnsNames ["xx"]
:issuerRef :issuerRef
{:name "letsencrypt-prod-issuer", :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
@ -33,7 +33,7 @@
:metadata :metadata
{:name "ingress-cloud" {:name "ingress-cloud"
:annotations :annotations
{:cert-manager.io/cluster-issuer "letsencrypt-staging-issuer" {:cert-manager.io/cluster-issuer "staging"
:ingress.kubernetes.io/proxy-body-size "256m" :ingress.kubernetes.io/proxy-body-size "256m"
:ingress.kubernetes.io/ssl-redirect "true" :ingress.kubernetes.io/ssl-redirect "true"
:ingress.kubernetes.io/rewrite-target "/" :ingress.kubernetes.io/rewrite-target "/"