Split for generation of config and auth objects #4

Merged
gec merged 9 commits from split-config-auth into main 2024-07-19 09:06:52 +00:00
4 changed files with 16 additions and 17 deletions
Showing only changes of commit fb16a34a75 - Show all commits

View file

@ -34,12 +34,11 @@
:pv-storage-size-gb 10
:pvc-storage-class-name "manual"}))
; REVIEW gec: This breaking change means, every call from outside to generate-config will mean something completely different.
(defn-spec generate-config-configmap map?
(defn-spec generate-configmap map?
[& config (s/? pg-config?)]
(let [final-config (merge default-config
(first config))]
(int/generate-config-configmap final-config)))
(int/generate-configmap final-config)))
(defn-spec generate-deployment map?
@ -89,7 +88,7 @@
config)]
[(int/generate-secret final-config auth)
(int/generate-persistent-volume final-config)
(int/generate-config-configmap final-config)
(int/generate-configmap final-config)
(int/generate-pvc final-config)
(int/generate-deployment final-config)
(int/generate-service final-config)]))
@ -99,7 +98,7 @@
(let [final-config (merge default-config
config)]
[(int/generate-persistent-volume final-config)
(int/generate-config-configmap final-config)
(int/generate-configmap final-config)
(int/generate-pvc final-config)
(int/generate-deployment final-config)
(int/generate-service final-config)]))

View file

@ -52,7 +52,7 @@
(def postgres-function (s/keys :opt-un [::deserializer ::optional]))
(defn-spec generate-config-configmap map?
(defn-spec generate-configmap map?
[config pg-config?]
(let [{:keys [postgres-size db-name namespace]} config]
(->
@ -62,7 +62,7 @@
(assoc-in [:data :postgres-db] db-name))))
(defn-spec ^{:deprecated "6.4.1"} generate-config map?
"use generate-config-configmap instead"
"use generate-configmap instead"
[config pg-config?]
(let [{:keys [postgres-size db-name namespace]} config]
(->

View file

@ -5,18 +5,18 @@
[clojure.spec.test.alpha :as st]
[dda.c4k-common.postgres.postgres-internal :as cut]))
(st/instrument `cut/generate-config-configmap)
(st/instrument `cut/generate-configmap)
(st/instrument `cut/generate-deployment)
(st/instrument `cut/generate-persistent-volume)
(st/instrument `cut/generate-pvc)
(st/instrument `cut/generate-secret)
(st/instrument `cut/generate-service)
(deftest should-generate-config-configmap
(deftest should-generate-configmap
(is (= {:name "postgres-config",
:namespace "default"
:labels {:app "postgres"}}
(:metadata (cut/generate-config-configmap {:postgres-image "postgres:13"
(:metadata (cut/generate-configmap {:postgres-image "postgres:13"
:postgres-size :2gb
:db-name "postgres"
:postgres-data-volume-path "/var/postgres"
@ -26,7 +26,7 @@
(is (= {:name "postgres-config",
:namespace "myapp"
:labels {:app "postgres"}}
(:metadata (cut/generate-config-configmap {:postgres-image "postgres:13"
(:metadata (cut/generate-configmap {:postgres-image "postgres:13"
:postgres-size :2gb
:db-name "postgres"
:postgres-data-volume-path "/var/postgres"
@ -36,7 +36,7 @@
(is (= {:postgres-db "postgres"
:postgresql.conf
"max_connections = 100\nwork_mem = 4MB\nshared_buffers = 512MB\n"}
(:data (cut/generate-config-configmap {:postgres-image "postgres:13"
(:data (cut/generate-configmap {:postgres-image "postgres:13"
:postgres-size :2gb
:db-name "postgres"
:postgres-data-volume-path "/var/postgres"
@ -46,7 +46,7 @@
(is (= {:postgres-db "postgres"
:postgresql.conf
"max_connections = 700\nwork_mem = 3MB\nshared_buffers = 2048MB\n"}
(:data (cut/generate-config-configmap {:postgres-image "postgres:13"
(:data (cut/generate-configmap {:postgres-image "postgres:13"
:postgres-size :8gb
:db-name "postgres"
:postgres-data-volume-path "/var/postgres"
@ -56,7 +56,7 @@
(is (= {:postgres-db "test"
:postgresql.conf
"max_connections = 100\nwork_mem = 4MB\nshared_buffers = 512MB\n"}
(:data (cut/generate-config-configmap {:postgres-image "postgres:13"
(:data (cut/generate-configmap {:postgres-image "postgres:13"
:postgres-size :2gb
:db-name "test"
:postgres-data-volume-path "/var/postgres"

View file

@ -5,18 +5,18 @@
[clojure.spec.test.alpha :as st]
[dda.c4k-common.postgres :as cut]))
(st/instrument `cut/generate-config-configmap)
(st/instrument `cut/generate-configmap)
(st/instrument `cut/generate-persistent-volume)
(st/instrument `cut/generate-secret)
(st/instrument `cut/generate)
(st/instrument `cut/generate-config)
(st/instrument `cut/generate-auth)
(deftest should-generate-config-configmap
(deftest should-generate-configmap
(is (= {:postgres-db "postgres"
:postgresql.conf
"max_connections = 100\nwork_mem = 4MB\nshared_buffers = 512MB\n"}
(:data (cut/generate-config-configmap)))))
(:data (cut/generate-configmap)))))
(deftest should-generate-persistent-volume
(is (= {:kind "PersistentVolume"