|
|
|
@ -9,32 +9,34 @@
|
|
|
|
|
[dda.c4k-nextcloud.nextcloud :as nextcloud]
|
|
|
|
|
[dda.c4k-nextcloud.backup :as backup]))
|
|
|
|
|
|
|
|
|
|
(def default-storage-class :local-path)
|
|
|
|
|
|
|
|
|
|
(def config-defaults {:issuer "staging"})
|
|
|
|
|
|
|
|
|
|
(def config? (s/keys :req-un [::nextcloud/fqdn]
|
|
|
|
|
:opt-un [::nextcloud/issuer
|
|
|
|
|
::nextcloud/restic-repository
|
|
|
|
|
::nextcloud/pv-storage-size-gb
|
|
|
|
|
::nextcloud/pvc-storage-class-name]))
|
|
|
|
|
|
|
|
|
|
(def auth? (s/keys :req-un [::postgres/postgres-db-user ::postgres/postgres-db-password
|
|
|
|
|
::nextcloud/nextcloud-admin-user ::nextcloud/nextcloud-admin-password
|
|
|
|
|
::aws-access-key-id ::aws-secret-access-key
|
|
|
|
|
::restic-password]))
|
|
|
|
|
|
|
|
|
|
(defn-spec k8s-objects any?
|
|
|
|
|
[config (s/merge nextcloud/config? auth?)]
|
|
|
|
|
(let [postgres-storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path)
|
|
|
|
|
nextcloud-storage-class (if (contains? config :nextcloud-data-volume-path) :manual :local-path)
|
|
|
|
|
nextcloud-default-storage-config {:pvc-storage-class-name nextcloud-storage-class :pv-storage-size-gb 200}]
|
|
|
|
|
|
|
|
|
|
[config (s/merge config? auth?)]
|
|
|
|
|
(let [nextcloud-default-storage-config {:pvc-storage-class-name default-storage-class
|
|
|
|
|
:pv-storage-size-gb 200}]
|
|
|
|
|
(into
|
|
|
|
|
[]
|
|
|
|
|
(concat [(yaml/to-string (postgres/generate-config {:postgres-size :8gb}))
|
|
|
|
|
(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 {:pv-storage-size-gb 50
|
|
|
|
|
:pvc-storage-class-name postgres-storage-class}))
|
|
|
|
|
(yaml/to-string (postgres/generate-secret config))
|
|
|
|
|
(yaml/to-string (postgres/generate-pvc {:pv-storage-size-gb 50
|
|
|
|
|
:pvc-storage-class-name default-storage-class}))
|
|
|
|
|
(yaml/to-string (postgres/generate-deployment))
|
|
|
|
|
(yaml/to-string (postgres/generate-service))]
|
|
|
|
|
(when (contains? config :nextcloud-data-volume-path)
|
|
|
|
|
[(yaml/to-string (nextcloud/generate-persistent-volume (merge nextcloud-default-storage-config config)))])
|
|
|
|
|
[(yaml/to-string (nextcloud/generate-secret config))
|
|
|
|
|
(yaml/to-string (postgres/generate-service))
|
|
|
|
|
(yaml/to-string (nextcloud/generate-secret config))
|
|
|
|
|
(yaml/to-string (nextcloud/generate-pvc (merge nextcloud-default-storage-config config)))
|
|
|
|
|
(yaml/to-string (nextcloud/generate-deployment config))
|
|
|
|
|
(yaml/to-string (nextcloud/generate-service))
|
|
|
|
@ -47,7 +49,7 @@
|
|
|
|
|
(yaml/to-string (backup/generate-backup-restore-deployment config))])))))
|
|
|
|
|
|
|
|
|
|
(defn-spec generate any?
|
|
|
|
|
[my-config nextcloud/config?
|
|
|
|
|
[my-config config?
|
|
|
|
|
my-auth auth?]
|
|
|
|
|
(let [resulting-config (merge config-defaults my-config my-auth)]
|
|
|
|
|
(cs/join
|
|
|
|
|