Use common load-as-edn
To avoid common code duplication
This commit is contained in:
parent
74505dbab7
commit
107b8c3872
2 changed files with 9 additions and 9 deletions
|
@ -23,14 +23,14 @@
|
|||
(defn generate-config [my-conf]
|
||||
(let [{:keys [restic-repository]} my-conf]
|
||||
(->
|
||||
(yaml/from-string (yaml/load-resource "backup/config.yaml"))
|
||||
(yaml/load-as-edn "backup/config.yaml")
|
||||
(cm/replace-key-value :restic-repository restic-repository))))
|
||||
|
||||
(defn generate-cron []
|
||||
(yaml/from-string (yaml/load-resource "backup/cron.yaml")))
|
||||
|
||||
(defn generate-backup-restore-deployment [my-conf]
|
||||
(let [backup-restore-yaml (yaml/from-string (yaml/load-resource "backup/backup-restore-deployment.yaml"))]
|
||||
(let [backup-restore-yaml (yaml/load-as-edn "backup/backup-restore-deployment.yaml")]
|
||||
(if (and (contains? my-conf :local-integration-test) (= true (:local-integration-test my-conf)))
|
||||
(cm/replace-named-value backup-restore-yaml "CERTIFICATE_FILE" "/var/run/secrets/localstack-secrets/ca.crt")
|
||||
backup-restore-yaml)))
|
||||
|
@ -38,7 +38,7 @@
|
|||
(defn generate-secret [my-auth]
|
||||
(let [{:keys [aws-access-key-id aws-secret-access-key restic-password]} my-auth]
|
||||
(->
|
||||
(yaml/from-string (yaml/load-resource "backup/secret.yaml"))
|
||||
(yaml/load-as-edn "backup/secret.yaml")
|
||||
(cm/replace-key-value :aws-access-key-id (b64/encode aws-access-key-id))
|
||||
(cm/replace-key-value :aws-secret-access-key (b64/encode aws-secret-access-key))
|
||||
(cm/replace-key-value :restic-password (b64/encode restic-password)))))
|
||||
|
|
|
@ -36,14 +36,14 @@
|
|||
(let [{:keys [fqdn issuer]} config
|
||||
letsencrypt-issuer issuer]
|
||||
(->
|
||||
(yaml/from-string (yaml/load-resource "nextcloud/certificate.yaml"))
|
||||
(yaml/load-as-edn "nextcloud/certificate.yaml")
|
||||
(assoc-in [:spec :commonName] fqdn)
|
||||
(assoc-in [:spec :dnsNames] [fqdn])
|
||||
(assoc-in [:spec :issuerRef :name] letsencrypt-issuer))))
|
||||
|
||||
(defn generate-deployment [config]
|
||||
(let [{:keys [fqdn]} config]
|
||||
(-> (yaml/from-string (yaml/load-resource "nextcloud/deployment.yaml"))
|
||||
(-> (yaml/load-as-edn "nextcloud/deployment.yaml")
|
||||
(cm/replace-all-matching-values-by-new-value "fqdn" fqdn))))
|
||||
|
||||
(defn generate-ingress [config]
|
||||
|
@ -51,7 +51,7 @@
|
|||
:or {issuer "staging"}} config
|
||||
letsencrypt-issuer issuer]
|
||||
(->
|
||||
(yaml/from-string (yaml/load-resource "nextcloud/ingress.yaml"))
|
||||
(yaml/load-as-edn "nextcloud/ingress.yaml")
|
||||
(assoc-in [:metadata :annotations :cert-manager.io/cluster-issuer] letsencrypt-issuer)
|
||||
(cm/replace-all-matching-values-by-new-value "fqdn" fqdn))))
|
||||
|
||||
|
@ -59,16 +59,16 @@
|
|||
[config (s/keys :req-un [::pv-storage-size-gb ::pvc-storage-class-name])]
|
||||
(let [{:keys [pv-storage-size-gb pvc-storage-class-name]} config]
|
||||
(->
|
||||
(yaml/from-string (yaml/load-resource "nextcloud/pvc.yaml"))
|
||||
(yaml/load-as-edn "nextcloud/pvc.yaml")
|
||||
(assoc-in [:spec :resources :requests :storage] (str pv-storage-size-gb "Gi"))
|
||||
(assoc-in [:spec :storageClassName] (name pvc-storage-class-name)))))
|
||||
|
||||
(defn generate-service []
|
||||
(yaml/from-string (yaml/load-resource "nextcloud/service.yaml")))
|
||||
(yaml/load-as-edn "nextcloud/service.yaml"))
|
||||
|
||||
(defn generate-secret [config]
|
||||
(let [{:keys [nextcloud-admin-user nextcloud-admin-password]} config]
|
||||
(->
|
||||
(yaml/from-string (yaml/load-resource "nextcloud/secret.yaml"))
|
||||
(yaml/load-as-edn "nextcloud/secret.yaml")
|
||||
(cm/replace-key-value :nextcloud-admin-user (b64/encode nextcloud-admin-user))
|
||||
(cm/replace-key-value :nextcloud-admin-password (b64/encode nextcloud-admin-password)))))
|
||||
|
|
Loading…
Reference in a new issue