diff --git a/src/main/cljc/dda/c4k_jitsi/jitsi.cljc b/src/main/cljc/dda/c4k_jitsi/jitsi.cljc index 8b77405..a0fabf0 100644 --- a/src/main/cljc/dda/c4k_jitsi/jitsi.cljc +++ b/src/main/cljc/dda/c4k_jitsi/jitsi.cljc @@ -76,8 +76,12 @@ (cm/replace-key-value :JICOFO_AUTH_PASSWORD (b64/encode jicofo-auth-password)) (cm/replace-key-value :JICOFO_COMPONENT_SECRET (b64/encode jicofo-component-secret))))) -(defn-spec generate-jvb-service cp/map-or-seq? [] - (yaml/from-string (yaml/load-resource "jitsi/jvb-service.yaml"))) +(defn-spec generate-jvb-service cp/map-or-seq? + [config config?] + (let [{:keys [namespace]} config] + (-> + (yaml/from-string (yaml/load-resource "jitsi/jvb-service.yaml")) + (cm/replace-all-matching "NAMESPACE" namespace)))) (defn-spec generate-web-service cp/map-or-seq? [] (yaml/load-as-edn "jitsi/web-service.yaml")) diff --git a/src/main/resources/jitsi/jvb-service.yaml b/src/main/resources/jitsi/jvb-service.yaml index ea66bb5..24b4a33 100644 --- a/src/main/resources/jitsi/jvb-service.yaml +++ b/src/main/resources/jitsi/jvb-service.yaml @@ -7,6 +7,7 @@ metadata: metallb.universe.tf/allow-shared-ip: "shared-ip-service-group" metallb.universe.tf/address-pool: public name: jvb-udp + namespace: NAMESPACE spec: type: LoadBalancer ports: diff --git a/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc b/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc index bf80776..454ab0f 100644 --- a/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc +++ b/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc @@ -7,6 +7,8 @@ (st/instrument `cut/generate-deployment) (st/instrument `cut/generate-secret-jitsi) +(st/instrument `cut/generate-ingress-web) +(st/instrument `cut/generate-jvb-service) (deftest should-generate-deployment (is (= {:apiVersion "apps/v1", @@ -147,3 +149,22 @@ (cut/generate-ingress-web {:fqdn "xy.xy.xy" :namespace "jitsi"})))) + +(deftest should-generate-jvb-service + (is (= {:apiVersion "v1", + :kind "Service", + :metadata + {:labels {:service "jvb"}, + :annotations + #:metallb.universe.tf{:allow-shared-ip "shared-ip-service-group", + :address-pool "public"}, + :name "jvb-udp" + :namespace "jitsi"}, + :spec + {:type "LoadBalancer", + :ports + [{:port 30300, :protocol "UDP", :targetPort 30300, :nodePort 30300}], + :selector {:app "jitsi"}}} + (cut/generate-jvb-service + {:fqdn "xy.xy.xy" + :namespace "jitsi"}))))