Use common ingress and cert
This commit is contained in:
parent
a97295fecf
commit
4f91d397e2
2 changed files with 10 additions and 19 deletions
|
@ -44,9 +44,8 @@
|
||||||
(forgejo/generate-service-ssh)
|
(forgejo/generate-service-ssh)
|
||||||
(forgejo/generate-data-volume config)
|
(forgejo/generate-data-volume config)
|
||||||
(forgejo/generate-appini-env config)
|
(forgejo/generate-appini-env config)
|
||||||
(forgejo/generate-secrets config)
|
(forgejo/generate-secrets config)]
|
||||||
(forgejo/generate-ingress config)
|
(forgejo/generate-ingress-and-cert config)
|
||||||
(forgejo/generate-certificate config)]
|
|
||||||
(when (contains? config :restic-repository)
|
(when (contains? config :restic-repository)
|
||||||
[(backup/generate-config config)
|
[(backup/generate-config config)
|
||||||
(backup/generate-secret config)
|
(backup/generate-secret config)
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
:cljs [cljs.reader :as edn])
|
:cljs [cljs.reader :as edn])
|
||||||
[dda.c4k-common.yaml :as yaml]
|
[dda.c4k-common.yaml :as yaml]
|
||||||
[dda.c4k-common.common :as cm]
|
[dda.c4k-common.common :as cm]
|
||||||
|
[dda.c4k-common.ingress :as ing]
|
||||||
[dda.c4k-common.base64 :as b64]
|
[dda.c4k-common.base64 :as b64]
|
||||||
[dda.c4k-common.predicate :as pred]
|
[dda.c4k-common.predicate :as pred]
|
||||||
[dda.c4k-common.postgres :as postgres]))
|
[dda.c4k-common.postgres :as postgres]))
|
||||||
|
@ -54,8 +55,6 @@
|
||||||
(case resource-name
|
(case resource-name
|
||||||
"forgejo/appini-env-configmap.yaml" (rc/inline "forgejo/appini-env-configmap.yaml")
|
"forgejo/appini-env-configmap.yaml" (rc/inline "forgejo/appini-env-configmap.yaml")
|
||||||
"forgejo/deployment.yaml" (rc/inline "forgejo/deployment.yaml")
|
"forgejo/deployment.yaml" (rc/inline "forgejo/deployment.yaml")
|
||||||
"forgejo/certificate.yaml" (rc/inline "forgejo/certificate.yaml")
|
|
||||||
"forgejo/ingress.yaml" (rc/inline "forgejo/ingress.yaml")
|
|
||||||
"forgejo/secrets.yaml" (rc/inline "forgejo/secrets.yaml")
|
"forgejo/secrets.yaml" (rc/inline "forgejo/secrets.yaml")
|
||||||
"forgejo/service.yaml" (rc/inline "forgejo/service.yaml")
|
"forgejo/service.yaml" (rc/inline "forgejo/service.yaml")
|
||||||
"forgejo/service-ssh.yaml" (rc/inline "forgejo/service-ssh.yaml")
|
"forgejo/service-ssh.yaml" (rc/inline "forgejo/service-ssh.yaml")
|
||||||
|
@ -96,22 +95,15 @@
|
||||||
(cm/replace-all-matching-values-by-new-value "MAILERUSER" (b64/encode mailer-user))
|
(cm/replace-all-matching-values-by-new-value "MAILERUSER" (b64/encode mailer-user))
|
||||||
(cm/replace-all-matching-values-by-new-value "MAILERPW" (b64/encode mailer-pw)))))
|
(cm/replace-all-matching-values-by-new-value "MAILERPW" (b64/encode mailer-pw)))))
|
||||||
|
|
||||||
(defn generate-ingress
|
(defn generate-ingress-and-cert
|
||||||
[config]
|
[config]
|
||||||
(let [{:keys [fqdn]} config]
|
(let [{:keys [fqdn]} config]
|
||||||
(->
|
(ing/generate-ingress-and-cert
|
||||||
(yaml/load-as-edn "forgejo/ingress.yaml")
|
(merge
|
||||||
(cm/replace-all-matching-values-by-new-value "FQDN" fqdn))))
|
{:service-name "forgejo"
|
||||||
|
:service-port 80
|
||||||
(defn generate-certificate
|
:fqdns [fqdn]}
|
||||||
[config]
|
config))))
|
||||||
(let [{:keys [fqdn issuer]
|
|
||||||
:or {issuer "staging"}} config
|
|
||||||
letsencrypt-issuer (name issuer)]
|
|
||||||
(->
|
|
||||||
(yaml/load-as-edn "forgejo/certificate.yaml")
|
|
||||||
(assoc-in [:spec :issuerRef :name] letsencrypt-issuer)
|
|
||||||
(cm/replace-all-matching-values-by-new-value "FQDN" fqdn))))
|
|
||||||
|
|
||||||
(defn-spec generate-data-volume pred/map-or-seq?
|
(defn-spec generate-data-volume pred/map-or-seq?
|
||||||
[config vol?]
|
[config vol?]
|
||||||
|
|
Loading…
Reference in a new issue