feature/namespace #2

Merged
jem merged 15 commits from feature/namespace into master 2024-02-20 17:24:37 +00:00
3 changed files with 22 additions and 8 deletions
Showing only changes of commit 674045eba3 - Show all commits

View file

@ -1,14 +1,8 @@
(ns dda.c4k-common.postgres
(:require
[clojure.spec.alpha :as s]
#?(:cljs [shadow.resource :as rc])
#?(:clj [orchestra.core :refer [defn-spec]]
:cljs [orchestra.core :refer-macros [defn-spec]])
#?(:cljs [dda.c4k-common.macros :refer-macros [inline-resources]])
[dda.c4k-common.yaml :as yaml]
[dda.c4k-common.base64 :as b64]
[dda.c4k-common.predicate :as cp]
[dda.c4k-common.common :as cm]
[dda.c4k-common.postgres.postgres-internal :as int]))
(def postgres-size? int/postgres-size?)
@ -75,3 +69,16 @@
(defn-spec generate-service map?
[]
(int/generate-service))
(defn-spec generate seq?
[config pg-config?
auth pg-auth?]
(let [final-config (merge default-config
config)]
[(int/generate-secret auth)
(int/generate-persistent-volume final-config)
(int/generate-config final-config)
(int/generate-pvc final-config)
(int/generate-deployment final-config)
(int/generate-service)]))

View file

@ -30,7 +30,7 @@
(s/keys :req-un [::postgres-size ::db-name ::postgres-data-volume-path
::pvc-storage-class-name ::pv-storage-size-gb]))
(def pg-auth?
(s/keys :opt-un [::postgres-db-user ::postgres-db-password]))
(s/keys :req-un [::postgres-db-user ::postgres-db-password]))
(def postgres-function (s/keys :opt-un [::deserializer ::optional]))

View file

@ -38,4 +38,11 @@
{:storageClassName "manual"
:accessModes ["ReadWriteOnce"]
:resources {:requests {:storage "10Gi"}}}}
(cut/generate-pvc {}))))
(cut/generate-pvc {}))))
(deftest should-generate
(is (= 6
(count (cut/generate {}
{:postgres-db-user "user"
:postgres-db-password "password"})))))