Compare commits

...

3 commits

Author SHA1 Message Date
85f44ea8d1 Add test task 2024-07-04 14:43:46 +02:00
b5afdc0959 Update deps 2024-07-04 14:43:33 +02:00
3639f3d5e6 Add namespaces
Also Update postgres usage
2024-07-04 14:33:53 +02:00
8 changed files with 27 additions and 17 deletions

View file

@ -40,18 +40,18 @@ def initialize(project):
@task @task
def test_clj(project): def test_clj():
run("lein test", shell=True, check=True) run("lein test", shell=True, check=True)
@task @task
def test_cljs(project): def test_cljs():
run("shadow-cljs compile test", shell=True, check=True) run("shadow-cljs compile test", shell=True, check=True)
run("node target/node-tests.js", shell=True, check=True) run("node target/node-tests.js", shell=True, check=True)
@task @task
def test_schema(project): def test_schema():
run("lein uberjar", shell=True, check=True) run("lein uberjar", shell=True, check=True)
run( run(
"java -jar target/uberjar/c4k-keycloak-standalone.jar " "java -jar target/uberjar/c4k-keycloak-standalone.jar "
@ -62,6 +62,11 @@ def test_schema(project):
check=True, check=True,
) )
@task
def test():
test_clj()
test_cljs()
test_schema()
@task @task
def report_frontend(project): def report_frontend(project):

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.11.1"] :dependencies [[org.clojure/clojure "1.11.1"]
[org.clojure/tools.reader "1.3.6"] [org.clojure/tools.reader "1.3.6"]
[org.domaindrivenarchitecture/c4k-common-clj "6.1.3"]] [org.domaindrivenarchitecture/c4k-common-clj "6.3.1"]]
:target-path "target/%s/" :target-path "target/%s/"
:source-paths ["src/main/cljc" :source-paths ["src/main/cljc"
"src/main/clj"] "src/main/clj"]

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 "6.1.3"] :dependencies [[org.domaindrivenarchitecture/c4k-common-cljs "6.3.1"]
[hickory "0.7.1"]] [hickory "0.7.1"]]
:builds {:frontend {:target :browser :builds {:frontend {:target :browser
:modules {:main {:init-fn dda.c4k-keycloak.browser/init}} :modules {:main {:init-fn dda.c4k-keycloak.browser/init}}

View file

@ -8,7 +8,8 @@
[dda.c4k-common.monitoring :as mon] [dda.c4k-common.monitoring :as mon]
[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-keycloak.keycloak :as kc])) [dda.c4k-keycloak.keycloak :as kc]
[dda.c4k-common.namespace :as ns]))
(def default-storage-class :local-path) (def default-storage-class :local-path)
@ -29,15 +30,17 @@
(filter (filter
#(not (nil? %)) #(not (nil? %))
(cm/concat-vec (cm/concat-vec
[(postgres/generate-config {:postgres-size :2gb :db-name "keycloak"}) (ns/generate (merge {:namespace "keycloak"} config))
(postgres/generate-secret auth) (postgres/generate (merge {:postgres-image "postgres:14"
(postgres/generate-pvc {:pv-storage-size-gb 30 :postgres-size :2gb
:pvc-storage-class-name default-storage-class}) :db-name "keycloak"
(postgres/generate-deployment :postgres-image "postgres:14") :pv-storage-size-gb 30
(postgres/generate-service) :pvc-storage-class-name default-storage-class
(kc/generate-secret auth) :namespace "keycloak"})
auth)
[(kc/generate-secret auth)
(kc/generate-service) (kc/generate-service)
(kc/generate-deployment config)] (kc/generate-deployment config)]
(kc/generate-ingress config) (kc/generate-ingress (merge {:namespace "keycloak"} config))
(when (:contains? config :mon-cfg) (when (:contains? config :mon-cfg)
(mon/generate (:mon-cfg config) (:mon-auth auth))))))) (mon/generate (:mon-cfg config) (:mon-auth auth)))))))

View file

@ -2,7 +2,7 @@ apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
name: keycloak name: keycloak
namespace: default namespace: keycloak
labels: labels:
app: keycloak app: keycloak
spec: spec:

View file

@ -2,6 +2,7 @@ apiVersion: v1
kind: Secret kind: Secret
metadata: metadata:
name: keycloak-secret name: keycloak-secret
namespace: keycloak
type: Opaque type: Opaque
data: data:
keycloak-user: admin keycloak-user: admin

View file

@ -4,6 +4,7 @@ metadata:
name: keycloak name: keycloak
labels: labels:
service: keycloak service: keycloak
namespace: keycloak
spec: spec:
ports: ports:
- name: "http" - name: "http"

View file

@ -10,7 +10,7 @@
(deftest should-generate-secret (deftest should-generate-secret
(is (= {:apiVersion "v1" (is (= {:apiVersion "v1"
:kind "Secret" :kind "Secret"
:metadata {:name "keycloak-secret"} :metadata {:name "keycloak-secret", :namespace "keycloak"}
:type "Opaque" :type "Opaque"
:data :data
{:keycloak-user "dXNlcg==" {:keycloak-user "dXNlcg=="
@ -21,7 +21,7 @@
(is (= {:apiVersion "apps/v1", (is (= {:apiVersion "apps/v1",
:kind "Deployment", :kind "Deployment",
:metadata :metadata
{:name "keycloak", :namespace "default", :labels {:app "keycloak"}}, {:name "keycloak", :namespace "keycloak", :labels {:app "keycloak"}},
:spec :spec
{:replicas 1, {:replicas 1,
:selector {:matchLabels {:app "keycloak"}}, :selector {:matchLabels {:app "keycloak"}},