Spec seems to accept a cert map for an ingress map.
This commit is contained in:
erik 2022-10-18 11:31:47 +02:00
parent 0a3a85d93d
commit 8a97900cda
3 changed files with 7 additions and 14 deletions

View file

@ -17,7 +17,7 @@
[input] [input]
(every? true? (map pred/fqdn-string? input))) (every? true? (map pred/fqdn-string? input)))
(s/def ::unique-name pred/fqdn-string?) (s/def ::unique-name string?)
(s/def ::issuer pred/letsencrypt-issuer?) (s/def ::issuer pred/letsencrypt-issuer?)
(s/def ::authtoken pred/bash-env-string?) (s/def ::authtoken pred/bash-env-string?)
(s/def ::fqdns fqdn-list?) (s/def ::fqdns fqdn-list?)
@ -77,12 +77,6 @@
(str/replace % value-to-partly-match value-to-inplace) %) (str/replace % value-to-partly-match value-to-inplace) %)
col)) col))
; generate a list of host-rules from a list of fqdns
(defn make-host-rules-from-fqdns
[rule fqdns]
;function that creates a rule from host names
(mapv #(assoc-in rule [:host] %) fqdns))
#?(:cljs #?(:cljs
(defmethod yaml/load-resource :website [resource-name] (defmethod yaml/load-resource :website [resource-name]
(case resource-name (case resource-name
@ -115,7 +109,7 @@
(let [{:keys [unique-name fqdns]} config] (let [{:keys [unique-name fqdns]} config]
(ing/generate-https-ingress {:fqdns fqdns (ing/generate-https-ingress {:fqdns fqdns
:cert-name (generate-cert-name unique-name) :cert-name (generate-cert-name unique-name)
:ingress-name (generate-http-ingress-name unique-name) :ingress-name (generate-https-ingress-name unique-name)
:service-name (generate-service-name unique-name) :service-name (generate-service-name unique-name)
:service-port 80}))) :service-port 80})))
@ -123,7 +117,7 @@
[config websitedata?] [config websitedata?]
(let [{:keys [unique-name issuer fqdns] (let [{:keys [unique-name issuer fqdns]
:or {issuer "staging"}} config] :or {issuer "staging"}} config]
(ing/generate-https-ingress {:fqdns fqdns (ing/generate-certificate {:fqdns fqdns
:cert-name (generate-cert-name unique-name) :cert-name (generate-cert-name unique-name)
:issuer issuer}))) :issuer issuer})))

View file

@ -22,7 +22,6 @@
:path "/", :path "/",
:backend :backend
{:service {:name "myservice", :port {:number 3000}}}}]}} {:service {:name "myservice", :port {:number 3000}}}}]}}
(cut/generate-host-rule "myservice" 3000 "test.com")))) (cut/generate-host-rule "myservice" 3000 "test.com"))))
@ -94,7 +93,7 @@
(:spec (cut/generate-https-ingress {:issuer "prod" (:spec (cut/generate-https-ingress {:issuer "prod"
:service-name "test-io-service" :service-name "test-io-service"
:service-port 80 :service-port 80
:ingress-name "test-io-http-ingress" :ingress-name "test-io-https-ingress"
:cert-name "test-io-cert" :cert-name "test-io-cert"
: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"]})))))

View file

@ -1,6 +1,6 @@
{:issuer "staging" {:issuer "staging"
:websites :websites
[{:unique-name "test.io" [{:unique-name "test.io" ; todo: call this unique-name
:fqdns ["test.de" "test.org" "www.test.de" "www.test.org"] :fqdns ["test.de" "test.org" "www.test.de" "www.test.org"]
:gitea-host "gitlab.de" :gitea-host "gitlab.de"
:gitea-repo "repo" :gitea-repo "repo"