diff --git a/src/main/cljc/dda/c4k_keycloak/core.cljc b/src/main/cljc/dda/c4k_keycloak/core.cljc index 2f1f181..ce1c22b 100644 --- a/src/main/cljc/dda/c4k_keycloak/core.cljc +++ b/src/main/cljc/dda/c4k_keycloak/core.cljc @@ -8,7 +8,8 @@ [dda.c4k-common.monitoring :as mon] [dda.c4k-common.yaml :as yaml] [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) @@ -29,15 +30,17 @@ (filter #(not (nil? %)) (cm/concat-vec - [(postgres/generate-config {:postgres-size :2gb :db-name "keycloak"}) - (postgres/generate-secret auth) - (postgres/generate-pvc {:pv-storage-size-gb 30 - :pvc-storage-class-name default-storage-class}) - (postgres/generate-deployment :postgres-image "postgres:14") - (postgres/generate-service) - (kc/generate-secret auth) + (ns/generate (merge {:namespace "keycloak"} config)) + (postgres/generate (merge {:postgres-image "postgres:14" + :postgres-size :2gb + :db-name "keycloak" + :pv-storage-size-gb 30 + :pvc-storage-class-name default-storage-class + :namespace "keycloak"}) + auth) + [(kc/generate-secret auth) (kc/generate-service) (kc/generate-deployment config)] - (kc/generate-ingress config) + (kc/generate-ingress (merge {:namespace "keycloak"} config)) (when (:contains? config :mon-cfg) (mon/generate (:mon-cfg config) (:mon-auth auth))))))) diff --git a/src/main/resources/keycloak/deployment.yaml b/src/main/resources/keycloak/deployment.yaml index 4860375..f662cc2 100644 --- a/src/main/resources/keycloak/deployment.yaml +++ b/src/main/resources/keycloak/deployment.yaml @@ -2,7 +2,7 @@ apiVersion: apps/v1 kind: Deployment metadata: name: keycloak - namespace: default + namespace: keycloak labels: app: keycloak spec: diff --git a/src/main/resources/keycloak/secret.yaml b/src/main/resources/keycloak/secret.yaml index 43d0adc..a58bb8a 100644 --- a/src/main/resources/keycloak/secret.yaml +++ b/src/main/resources/keycloak/secret.yaml @@ -2,6 +2,7 @@ apiVersion: v1 kind: Secret metadata: name: keycloak-secret + namespace: keycloak type: Opaque data: keycloak-user: admin diff --git a/src/main/resources/keycloak/service.yaml b/src/main/resources/keycloak/service.yaml index 182b331..5926555 100644 --- a/src/main/resources/keycloak/service.yaml +++ b/src/main/resources/keycloak/service.yaml @@ -4,6 +4,7 @@ metadata: name: keycloak labels: service: keycloak + namespace: keycloak spec: ports: - name: "http" diff --git a/src/test/cljc/dda/c4k_keycloak/keycloak_test.cljc b/src/test/cljc/dda/c4k_keycloak/keycloak_test.cljc index 81f5682..d47adc1 100644 --- a/src/test/cljc/dda/c4k_keycloak/keycloak_test.cljc +++ b/src/test/cljc/dda/c4k_keycloak/keycloak_test.cljc @@ -10,7 +10,7 @@ (deftest should-generate-secret (is (= {:apiVersion "v1" :kind "Secret" - :metadata {:name "keycloak-secret"} + :metadata {:name "keycloak-secret", :namespace "keycloak"} :type "Opaque" :data {:keycloak-user "dXNlcg==" @@ -21,7 +21,7 @@ (is (= {:apiVersion "apps/v1", :kind "Deployment", :metadata - {:name "keycloak", :namespace "default", :labels {:app "keycloak"}}, + {:name "keycloak", :namespace "keycloak", :labels {:app "keycloak"}}, :spec {:replicas 1, :selector {:matchLabels {:app "keycloak"}},