fix storage class

This commit is contained in:
jerger 2022-02-12 18:57:22 +01:00
parent 27c2bc2a84
commit 42a2c58f89
3 changed files with 22 additions and 20 deletions

View file

@ -5,7 +5,7 @@
:url "https://www.apache.org/licenses/LICENSE-2.0.html"} :url "https://www.apache.org/licenses/LICENSE-2.0.html"}
:dependencies [[org.clojure/clojure "1.10.3"] :dependencies [[org.clojure/clojure "1.10.3"]
[org.clojure/tools.reader "1.3.6"] [org.clojure/tools.reader "1.3.6"]
[org.domaindrivenarchitecture/c4k-common-clj "1.0.0"] [org.domaindrivenarchitecture/c4k-common-clj "1.1.0-SNAPSHOT"]
[hickory "0.7.1"]] [hickory "0.7.1"]]
:target-path "target/%s/" :target-path "target/%s/"
:source-paths ["src/main/cljc" :source-paths ["src/main/cljc"

View file

@ -4,7 +4,7 @@
"src/test/cljc" "src/test/cljc"
"src/test/cljs" "src/test/cljs"
"src/test/resources"] "src/test/resources"]
:dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "1.0.0"] :dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "1.1.0-SNAPSHOT"]
[hickory "0.7.1"]] [hickory "0.7.1"]]
:builds {:frontend {:target :browser :builds {:frontend {:target :browser
:modules {:main {:init-fn dda.c4k-shynet.browser/init}} :modules {:main {:init-fn dda.c4k-shynet.browser/init}}

View file

@ -4,6 +4,7 @@
[clojure.spec.alpha :as s] [clojure.spec.alpha :as s]
#?(:clj [orchestra.core :refer [defn-spec]] #?(:clj [orchestra.core :refer [defn-spec]]
:cljs [orchestra.core :refer-macros [defn-spec]]) :cljs [orchestra.core :refer-macros [defn-spec]])
[dda.c4k-common.common :as cm]
[dda.c4k-common.yaml :as yaml] [dda.c4k-common.yaml :as yaml]
[dda.c4k-common.postgres :as postgres] [dda.c4k-common.postgres :as postgres]
[dda.c4k-shynet.shynet :as shynet])) [dda.c4k-shynet.shynet :as shynet]))
@ -17,24 +18,25 @@
::postgres/postgres-db-user ::postgres/postgres-db-password])) ::postgres/postgres-db-user ::postgres/postgres-db-password]))
(defn k8s-objects [config] (defn k8s-objects [config]
(into (let [storage-class (if (contains? config :postgres-data-volume-path) :manual :local-path)]
[] (cm/concat-vec
(concat [(yaml/to-string (postgres/generate-config {:postgres-size :2gb :db-name "shynet"}))
[(yaml/to-string (postgres/generate-config {:postgres-size :2gb :db-name "shynet"})) (yaml/to-string (postgres/generate-secret config))]
(yaml/to-string (postgres/generate-secret config))] (when (contains? config :postgres-data-volume-path)
(when (contains? config :postgres-data-volume-path) [(yaml/to-string (postgres/generate-persistent-volume (select-keys config [:postgres-data-volume-path :pv-storage-size-gb])))])
[(yaml/to-string (postgres/generate-persistent-volume (select-keys config [:postgres-data-volume-path])))]) [(yaml/to-string (postgres/generate-pvc {:pv-storage-size-gb 20
[(yaml/to-string (postgres/generate-pvc)) :pvc-storage-class-name storage-class}))
(yaml/to-string (postgres/generate-deployment {:postgres-image "postgres:14"})) (yaml/to-string (postgres/generate-deployment {:postgres-image "postgres:14"
(yaml/to-string (postgres/generate-service)) :postgres-size :2gb}))
(yaml/to-string (shynet/generate-secret config)) (yaml/to-string (postgres/generate-service))
(yaml/to-string (shynet/generate-webserver-deployment)) (yaml/to-string (shynet/generate-secret config))
(yaml/to-string (shynet/generate-celeryworker-deployment)) (yaml/to-string (shynet/generate-webserver-deployment))
(yaml/to-string (shynet/generate-ingress config)) (yaml/to-string (shynet/generate-celeryworker-deployment))
(yaml/to-string (shynet/generate-certificate config)) (yaml/to-string (shynet/generate-ingress config))
(yaml/to-string (shynet/generate-service-redis)) (yaml/to-string (shynet/generate-certificate config))
(yaml/to-string (shynet/generate-service-webserver)) (yaml/to-string (shynet/generate-service-redis))
(yaml/to-string (shynet/generate-statefulset))]))) (yaml/to-string (shynet/generate-service-webserver))
(yaml/to-string (shynet/generate-statefulset))])))
(defn-spec generate any? (defn-spec generate any?
[my-config config? [my-config config?