|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
(ns dda.c4k-common.postgres
|
|
|
|
|
(:require
|
|
|
|
|
[clojure.spec.alpha :as s]
|
|
|
|
|
#?(:cljs [shadow.resource :as rc])
|
|
|
|
|
[dda.c4k-common.yaml :as yaml]
|
|
|
|
|
[dda.c4k-common.base64 :as b64]
|
|
|
|
|
[dda.c4k-common.common :as cm]))
|
|
|
|
@ -9,8 +10,19 @@
|
|
|
|
|
(s/def ::postgres-db-password cm/bash-env-string?)
|
|
|
|
|
(s/def ::postgres-data-volume-path string?)
|
|
|
|
|
|
|
|
|
|
#?(:cljs
|
|
|
|
|
(defmethod yaml/load-resource :postgres [resource-name]
|
|
|
|
|
(case resource-name
|
|
|
|
|
"postgres/config.yaml" (rc/inline "postgres/config.yaml")
|
|
|
|
|
"postgres/deployment.yaml" (rc/inline "postgres/deployment.yaml")
|
|
|
|
|
"postgres/persistent-volume.yaml" (rc/inline "postgres/persistent-volume.yaml")
|
|
|
|
|
"postgres/pvc.yaml" (rc/inline "postgres/pvc.yaml")
|
|
|
|
|
"postgres/secret.yaml" (rc/inline "postgres/secret.yaml")
|
|
|
|
|
"postgres/service.yaml" (rc/inline "postgres/service.yaml")
|
|
|
|
|
(throw (js/Error. "Undefined Resource!")))))
|
|
|
|
|
|
|
|
|
|
(defn generate-config []
|
|
|
|
|
(yaml/from-string (yaml/load-resource "postgres/config.yaml")))
|
|
|
|
|
(yaml/from-string (yaml/load-resource "postgres/config.yaml")))
|
|
|
|
|
|
|
|
|
|
(defn generate-deployment []
|
|
|
|
|
(yaml/from-string (yaml/load-resource "postgres/deployment.yaml")))
|
|
|
|
|