make backup optional
* backup will not be created if there is no restic-repository in the config
This commit is contained in:
parent
016c7610f9
commit
51c654b272
2 changed files with 15 additions and 6 deletions
|
@ -11,9 +11,9 @@
|
||||||
|
|
||||||
(def config-defaults {:issuer :staging})
|
(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
|
: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
|
(def auth? (s/keys :req-un [::postgres/postgres-db-user ::postgres/postgres-db-password
|
||||||
::aws-access-key-id ::aws-secret-access-key
|
::aws-access-key-id ::aws-secret-access-key
|
||||||
|
@ -37,9 +37,10 @@
|
||||||
(yaml/to-string (jira/generate-certificate config))
|
(yaml/to-string (jira/generate-certificate config))
|
||||||
(yaml/to-string (jira/generate-ingress config))
|
(yaml/to-string (jira/generate-ingress config))
|
||||||
(yaml/to-string (jira/generate-service))]
|
(yaml/to-string (jira/generate-service))]
|
||||||
|
(when (contains? config :restic-repository)
|
||||||
[(yaml/to-string (backup/generate-config config))
|
[(yaml/to-string (backup/generate-config config))
|
||||||
(yaml/to-string (backup/generate-secret config))
|
(yaml/to-string (backup/generate-secret config))
|
||||||
(yaml/to-string (backup/generate-cron))])))
|
(yaml/to-string (backup/generate-cron))]))))
|
||||||
|
|
||||||
(defn-spec generate any?
|
(defn-spec generate any?
|
||||||
[my-config config?
|
[my-config config?
|
||||||
|
|
|
@ -24,4 +24,12 @@
|
||||||
:aws-access-key-id "aws-id"
|
:aws-access-key-id "aws-id"
|
||||||
:aws-secret-access-key "aws-secret"
|
:aws-secret-access-key "aws-secret"
|
||||||
:restic-password "restic-pw"
|
: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"})))))
|
||||||
|
|
Reference in a new issue