make backup optional

* backup will not be created if there is no restic-repository in the config
This commit is contained in:
bom 2021-07-12 11:16:43 +02:00
parent 016c7610f9
commit 51c654b272
2 changed files with 15 additions and 6 deletions

View file

@ -11,9 +11,9 @@
(def config-defaults {:issuer :staging})
(def config? (s/keys :req-un [::jira/fqdn ::restic-repository]
(def config? (s/keys :req-un [::jira/fqdn]
:opt-un [::jira/issuer ::jira/jira-data-volume-path
::postgres/postgres-data-volume-path]))
::postgres/postgres-data-volume-path ::restic-repository]))
(def auth? (s/keys :req-un [::postgres/postgres-db-user ::postgres/postgres-db-password
::aws-access-key-id ::aws-secret-access-key
@ -37,9 +37,10 @@
(yaml/to-string (jira/generate-certificate config))
(yaml/to-string (jira/generate-ingress config))
(yaml/to-string (jira/generate-service))]
[(yaml/to-string (backup/generate-config config))
(yaml/to-string (backup/generate-secret config))
(yaml/to-string (backup/generate-cron))])))
(when (contains? config :restic-repository)
[(yaml/to-string (backup/generate-config config))
(yaml/to-string (backup/generate-secret config))
(yaml/to-string (backup/generate-cron))]))))
(defn-spec generate any?
[my-config config?

View file

@ -24,4 +24,12 @@
:aws-access-key-id "aws-id"
:aws-secret-access-key "aws-secret"
:restic-password "restic-pw"
:restic-repository "restic-repository"})))))
:restic-repository "restic-repository"}))))
(is (= 11
(count (cut/k8s-objects {:fqdn "jira-neu.prod.meissa-gmbh.de"
:postgres-db-user "jira"
:postgres-db-password "jira-db-password"
:issuer :prod
:aws-access-key-id "aws-id"
:aws-secret-access-key "aws-secret"
:restic-password "restic-pw"})))))