adjust to new c4k-common version
This commit is contained in:
parent
98f0c81dc4
commit
ea08da9904
3 changed files with 34 additions and 11 deletions
|
@ -1,10 +1,15 @@
|
|||
(ns dda.c4k-website.uberjar
|
||||
(:gen-class)
|
||||
(:require
|
||||
[dda.c4k-website.core :as core]
|
||||
[dda.c4k-website.website :as website]
|
||||
[dda.c4k-common.uberjar :as uberjar]))
|
||||
[dda.c4k-common.uberjar :as uberjar]
|
||||
[dda.c4k-website.core :as core]))
|
||||
|
||||
|
||||
(defn -main [& cmd-args]
|
||||
(uberjar/main-common "c4k-website" website/config? website/auth? core/config-defaults core/k8s-objects cmd-args))
|
||||
(uberjar/main-common
|
||||
"c4k-website"
|
||||
core/config?
|
||||
core/auth?
|
||||
core/config-defaults
|
||||
core/k8s-objects
|
||||
cmd-args))
|
||||
|
|
|
@ -5,15 +5,27 @@
|
|||
:cljs [orchestra.core :refer-macros [defn-spec]])
|
||||
[dda.c4k-common.yaml :as yaml]
|
||||
[dda.c4k-common.common :as cm]
|
||||
[dda.c4k-common.predicate :as pred]
|
||||
[dda.c4k-common.predicate :as cp]
|
||||
[dda.c4k-common.monitoring :as mon]
|
||||
[dda.c4k-website.website :as website]))
|
||||
|
||||
(def config-defaults {:issuer "staging"
|
||||
:volume-size "3"})
|
||||
|
||||
(s/def ::mon-cfg mon/config?)
|
||||
(s/def ::mon-auth mon/auth?)
|
||||
|
||||
(def config? (s/keys :req-un [::website/websites]
|
||||
:opt-un [::website/issuer
|
||||
::website/volume-size
|
||||
::mon-cfg]))
|
||||
|
||||
(def auth? (s/keys :req-un [::website/auth]
|
||||
:opt-un [::mon-auth]))
|
||||
|
||||
(def merged-config-and-auth? (s/and website/config? website/auth?))
|
||||
|
||||
(defn-spec sort-config pred/map-or-seq?
|
||||
(defn-spec sort-config cp/map-or-seq?
|
||||
[unsorted-config merged-config-and-auth?]
|
||||
(let [sorted-websites (into [] (sort-by :unique-name (unsorted-config :websites)))
|
||||
sorted-auth (into [] (sort-by :unique-name (unsorted-config :auth)))]
|
||||
|
@ -21,7 +33,7 @@
|
|||
(assoc-in [:websites] sorted-websites)
|
||||
(assoc-in [:auth] sorted-auth))))
|
||||
|
||||
(defn-spec flatten-and-reduce-config pred/map-or-seq?
|
||||
(defn-spec flatten-and-reduce-config cp/map-or-seq?
|
||||
[config merged-config-and-auth?]
|
||||
(merge (-> config :websites first)
|
||||
(-> config :auth first)
|
||||
|
@ -51,8 +63,14 @@
|
|||
(website/generate-website-build-cron (flatten-and-reduce-config config))
|
||||
(website/generate-website-build-secret (flatten-and-reduce-config config)))))))
|
||||
|
||||
(defn k8s-objects [config]
|
||||
(defn-spec k8s-objects cp/map-or-seq?
|
||||
[config config?
|
||||
auth auth?]
|
||||
(cm/concat-vec
|
||||
(map yaml/to-string
|
||||
(filter #(not (nil? %))
|
||||
(generate-configs config)))))
|
||||
(filter
|
||||
#(not (nil? %))
|
||||
(cm/concat-vec
|
||||
(generate-configs (merge config auth))
|
||||
(when (:contains? config :mon-cfg)
|
||||
(mon/generate (:mon-cfg config) (:mon-auth auth))))))))
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
[dda.c4k-common.common :as cm]
|
||||
[dda.c4k-common.base64 :as b64]
|
||||
[dda.c4k-common.predicate :as pred]
|
||||
[dda.c4k-common.ingress-cert :as ing]
|
||||
[dda.c4k-common.ingress :as ing]
|
||||
[clojure.string :as str]))
|
||||
|
||||
(defn fqdn-list?
|
||||
|
|
Loading…
Reference in a new issue