|
|
|
@ -9,29 +9,31 @@
|
|
|
|
|
[dda.c4k-jira.jira :as jira]
|
|
|
|
|
[dda.c4k-jira.backup :as backup]))
|
|
|
|
|
|
|
|
|
|
(def default-storage-class :local-path)
|
|
|
|
|
|
|
|
|
|
(def default-jira-storage-size-gb 50)
|
|
|
|
|
|
|
|
|
|
(def config-defaults {:issuer :staging})
|
|
|
|
|
|
|
|
|
|
(def config? (s/keys :req-un [::jira/fqdn]
|
|
|
|
|
:opt-un [::jira/issuer ::jira/jira-data-volume-path
|
|
|
|
|
::postgres/postgres-data-volume-path ::restic-repository]))
|
|
|
|
|
(def config? (s/keys :req-un [::fqdn]
|
|
|
|
|
:opt-un [::issuer ::restic-repository]))
|
|
|
|
|
|
|
|
|
|
(def auth? (s/keys :req-un [::postgres/postgres-db-user ::postgres/postgres-db-password
|
|
|
|
|
::aws-access-key-id ::aws-secret-access-key
|
|
|
|
|
::restic-password]))
|
|
|
|
|
|
|
|
|
|
(defn k8s-objects [config]
|
|
|
|
|
(defn-spec k8s-objects any?
|
|
|
|
|
[config (s/merge config? auth?)]
|
|
|
|
|
(into
|
|
|
|
|
[]
|
|
|
|
|
(concat [(yaml/to-string (postgres/generate-config :postgres-size :2gb :db-name "jira"))
|
|
|
|
|
(yaml/to-string (postgres/generate-secret config))]
|
|
|
|
|
(when (contains? config :postgres-data-volume-path)
|
|
|
|
|
[(yaml/to-string (postgres/generate-persistent-volume config))])
|
|
|
|
|
[(yaml/to-string (postgres/generate-pvc))
|
|
|
|
|
(concat [(yaml/to-string (postgres/generate-config {:postgres-size :2gb :db-name "jira"}))
|
|
|
|
|
(yaml/to-string (postgres/generate-secret config))
|
|
|
|
|
(yaml/to-string (postgres/generate-pvc {:pv-storage-size-gb 30
|
|
|
|
|
:pvc-storage-class-name default-storage-class}))
|
|
|
|
|
(yaml/to-string (postgres/generate-deployment :postgres-image "postgres:14"))
|
|
|
|
|
(yaml/to-string (postgres/generate-service))]
|
|
|
|
|
(when (contains? config :jira-data-volume-path)
|
|
|
|
|
[(yaml/to-string (jira/generate-persistent-volume config))])
|
|
|
|
|
[(yaml/to-string (jira/generate-pvc))
|
|
|
|
|
(yaml/to-string (postgres/generate-service))
|
|
|
|
|
(yaml/to-string (jira/generate-pvc {:pvc-storage-class-name default-storage-class
|
|
|
|
|
:pv-storage-size-gb default-jira-storage-size-gb}))
|
|
|
|
|
(yaml/to-string (jira/generate-deployment config))
|
|
|
|
|
(yaml/to-string (jira/generate-service))
|
|
|
|
|
(yaml/to-string (jira/generate-certificate config))
|
|
|
|
|