Merge branch 'map_function' of gitlab.com:domaindrivenarchitecture/k8s-keycloak into map_function
This commit is contained in:
commit
fd74df706d
2 changed files with 37 additions and 1 deletions
|
@ -4,7 +4,8 @@
|
|||
[clojure.spec.alpha :as s]
|
||||
#?(:clj [orchestra.core :refer [defn-spec]]
|
||||
:cljs [orchestra.core :refer-macros [defn-spec]])
|
||||
[dda.k8s-keycloak.yaml :as yaml]))
|
||||
[dda.k8s-keycloak.yaml :as yaml]
|
||||
[clojure.walk]))
|
||||
|
||||
(defn bash-env-string?
|
||||
[input]
|
||||
|
@ -26,6 +27,21 @@
|
|||
|
||||
(def auth? (s/keys :req-un [::user-name ::user-password]))
|
||||
|
||||
; This needs to be checked:
|
||||
; Are LazySeq only lists on our case?
|
||||
(defn cast-lazy-seq-to-vec
|
||||
[lazy-seq]
|
||||
(clojure.walk/postwalk #(if (instance? clojure.lang.LazySeq %)
|
||||
(do (println %) (into [] %))
|
||||
%) lazy-seq))
|
||||
|
||||
(defn replace-all-matching-values-by-new-value
|
||||
[value-to-match value-to-replace coll]
|
||||
(clojure.walk/postwalk #(if (and (= (type value-to-match) (type %))
|
||||
(= value-to-match %))
|
||||
value-to-replace
|
||||
%) coll))
|
||||
|
||||
(declare assoc-in-nested)
|
||||
(declare assoc-in-nested-seq)
|
||||
(declare assoc-in-nested-map)
|
||||
|
|
|
@ -83,3 +83,23 @@
|
|||
:ports [{:name "http", :containerPort 8080}]
|
||||
:readinessProbe {:httpGet {:path "/auth/realms/master", :port 8080}}}]}}}}
|
||||
(cut/generate-deployment {:user-name "testuser" :user-password "test1234"}))))
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
|
||||
(deftest test-vector-replace-fqdn-function
|
||||
(let [ingress-yaml (yaml/from-string (yaml/load-resource "ingress.yaml"))
|
||||
fqdn "some_host"
|
||||
desired-result (-> ingress-yaml
|
||||
(assoc-in [:spec :rules] [{:host fqdn
|
||||
:http {:paths [{:backend {:serviceName "keycloak"
|
||||
:servicePort 8080}}]}}
|
||||
{:host fqdn
|
||||
:http {:paths [{:backend {:serviceName "another_keycloak"
|
||||
:servicePort 8081}}]}}
|
||||
]))]
|
||||
(is (= desired-result
|
||||
(cut/assoc-in-nested (cut/cast-lazy-seq-to-vec ingress-yaml) [:spec :rules :host] fqdn))))
|
||||
)
|
||||
|
||||
|
||||
>>>>>>> 0379ad882851993440561c5c09c9f813e4357ab1
|
||||
|
|
Loading…
Reference in a new issue