fix isuer name

This commit is contained in:
jerger 2022-02-12 21:05:12 +01:00
parent 42a2c58f89
commit 3a2a6f2a28
3 changed files with 5 additions and 5 deletions

View file

@ -34,7 +34,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 "shynet/certificate.yaml")) (yaml/from-string (yaml/load-resource "shynet/certificate.yaml"))
(assoc-in [:spec :commonName] fqdn) (assoc-in [:spec :commonName] fqdn)
@ -55,7 +55,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 "shynet/ingress.yaml")) (yaml/from-string (yaml/load-resource "shynet/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: REPLACEME
kind: ClusterIssuer kind: ClusterIssuer

View file

@ -56,7 +56,7 @@
{:secretName "shynet-secret" {:secretName "shynet-secret"
:commonName "test.com" :commonName "test.com"
:dnsNames ["test.com"] :dnsNames ["test.com"]
:issuerRef {:name "letsencrypt-staging-issuer", :kind "ClusterIssuer"}}} :issuerRef {:name "staging", :kind "ClusterIssuer"}}}
(cut/generate-certificate {:fqdn "test.com" :issuer :staging})))) (cut/generate-certificate {:fqdn "test.com" :issuer :staging}))))
(deftest should-generate-ingress (deftest should-generate-ingress
@ -68,7 +68,7 @@
{:ingress.kubernetes.io/force-ssl-redirect "true" {:ingress.kubernetes.io/force-ssl-redirect "true"
:ingress.kubernetes.io/ssl-redirect "true" :ingress.kubernetes.io/ssl-redirect "true"
:cert-manager.io/cluster-issuer :cert-manager.io/cluster-issuer
"letsencrypt-staging-issuer"}} "staging"}}
:spec :spec
{:tls [{:hosts ["test.com"], :secretName "shynet-secret"}] {:tls [{:hosts ["test.com"], :secretName "shynet-secret"}]
:rules :rules