diff --git a/src/main/cljc/dda/c4k_jitsi/core.cljc b/src/main/cljc/dda/c4k_jitsi/core.cljc index 84281b9..5bcc234 100644 --- a/src/main/cljc/dda/c4k_jitsi/core.cljc +++ b/src/main/cljc/dda/c4k_jitsi/core.cljc @@ -34,8 +34,9 @@ (cm/concat-vec (ns/generate resolved-config) (jitsi/prosody-config resolved-config) - (jitsi/jicofo-config resolved-config) (jitsi/jitsi-config resolved-config) + (jitsi/jicofo-config resolved-config) + (jitsi/web-config resolved-config) (jitsi/jibri-config resolved-config) ;; [(jitsi/generate-jvb-service config) ;; (jitsi/generate-web-service config) diff --git a/src/main/cljc/dda/c4k_jitsi/jitsi.cljc b/src/main/cljc/dda/c4k_jitsi/jitsi.cljc index b2c504b..d1a9956 100644 --- a/src/main/cljc/dda/c4k_jitsi/jitsi.cljc +++ b/src/main/cljc/dda/c4k_jitsi/jitsi.cljc @@ -174,6 +174,11 @@ (load-and-adjust-namespace "jitsi/prosody-auth-jvb-secret.yaml" namespace) (cm/replace-key-value :JVB_AUTH_PASSWORD (b64/encode jvb-auth-password)))])) +(defn-spec jitsi-config cp/map-or-seq? + [config config?] + (let [{:keys [fqdn namespace]} config] + [(load-and-adjust-namespace "jitsi/jitsi-config-serviceaccount.yaml" namespace)])) + (defn-spec jicofo-config cp/map-or-seq? [config config?] (let [{:keys [namespace]} config] @@ -184,10 +189,17 @@ (load-and-adjust-namespace "jitsi/jicofo-config-init-cm.yaml" namespace) (load-and-adjust-namespace "jitsi/jicofo-config-deployment.yaml" namespace)])) -(defn-spec jitsi-config cp/map-or-seq? +(defn-spec web-config cp/map-or-seq? [config config?] (let [{:keys [fqdn namespace]} config] - [(load-and-adjust-namespace "jitsi/jitsi-config-serviceaccount.yaml" namespace)])) + [(load-and-adjust-namespace "jitsi/web-config-conffiles-cm.yaml" namespace) + (load-and-adjust-namespace "jitsi/web-config-init-cm.yaml" namespace) + (-> + (load-and-adjust-namespace "jitsi/web-config-envs-cm.yaml" namespace) + (cm/replace-key-value :XMPP_BOSH_URL_BASE (str "http://prosody." namespace ".svc.cluster.local:5280"))) + (load-and-adjust-namespace "jitsi/web-config-service.yaml" namespace) + (load-and-adjust-namespace "jitsi/web-config-deployment.yaml" namespace) + (load-and-adjust-namespace "jitsi/web-config-test-deployment.yaml" namespace)])) (defn-spec jibri-config cp/map-or-seq? [config config?] diff --git a/src/main/resources/jitsi/web-config-conffiles-cm.yaml b/src/main/resources/jitsi/web-config-conffiles-cm.yaml new file mode 100644 index 0000000..80b60d4 --- /dev/null +++ b/src/main/resources/jitsi/web-config-conffiles-cm.yaml @@ -0,0 +1,38 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: jitsi-meet-web-conffiles + namespace: NAMESPACE + labels: + app.kubernetes.io/name: jitsi-meet + app.kubernetes.io/component: web +data: + custom-config.js: | + # Not providing /config/custom-config.js + + custom-interface_config.js: | + # Not providing /config/custom-interface_config.js + + default: | + # Using web /defaults/default from container image + + ffdhe2048.txt: | + # Using web /defaults/ffdhe2048.txt from container image + + interface_config.js: | + # Using web /defaults/interface_config.js from container image + + meet.conf: | + # Using web /defaults/meet.conf from container image + + nginx.conf: | + # Using web /defaults/nginx.conf from container image + + settings-config.js: | + # Using web /defaults/settings-config.js from container image + + ssl.conf: | + # Using web /defaults/ssl.conf from container image + + system-config.js: | + # Using web /defaults/system-config.js from container image \ No newline at end of file diff --git a/src/main/resources/jitsi/web-config-deployment.yaml b/src/main/resources/jitsi/web-config-deployment.yaml new file mode 100644 index 0000000..d6c9779 --- /dev/null +++ b/src/main/resources/jitsi/web-config-deployment.yaml @@ -0,0 +1,88 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: NAMESPACE + name: jitsi-meet-web + labels: + app.kubernetes.io/name: jitsi-meet + app.kubernetes.io/component: web +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: jitsi-meet + app.kubernetes.io/component: web + template: + metadata: + labels: + app.kubernetes.io/name: jitsi-meet + app.kubernetes.io/component: web + spec: + serviceAccountName: jitsi-meet + securityContext: + {} + containers: + - name: jitsi-meet + securityContext: + {} + image: "jitsi/web:stable-9646" + imagePullPolicy: IfNotPresent + envFrom: + - configMapRef: + name: jitsi-meet-web + - configMapRef: + name: prosody-common + ports: + - name: http + containerPort: 80 + protocol: TCP + - name: https + containerPort: 443 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: 80 + readinessProbe: + httpGet: + path: / + port: 80 + resources: + {} + volumeMounts: + - name: config + mountPath: /config + volumes: + - name: config + emptyDir: {} + - name: custom-init + configMap: + defaultMode: 493 + name: jitsi-meet-web-init + items: + - key: 10-config + path: 10-config + - name: custom-conffiles + configMap: + name: jitsi-meet-web-conffiles + items: + - key: custom-config.js + path: custom-config.js + - key: custom-interface_config.js + path: custom-interface_config.js + - key: default + path: default + - key: ffdhe2048.txt + path: ffdhe2048.txt + - key: interface_config.js + path: interface_config.js + - key: meet.conf + path: meet.conf + - key: nginx.conf + path: nginx.conf + - key: settings-config.js + path: settings-config.js + - key: ssl.conf + path: ssl.conf + - key: system-config.js + path: system-config.js \ No newline at end of file diff --git a/src/main/resources/jitsi/web-config-envs-cm.yaml b/src/main/resources/jitsi/web-config-envs-cm.yaml new file mode 100644 index 0000000..5b36ccf --- /dev/null +++ b/src/main/resources/jitsi/web-config-envs-cm.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + namespace: NAMESPACE + name: jitsi-meet-web + labels: + app.kubernetes.io/name: jitsi-meet + app.kubernetes.io/component: web +data: + DISABLE_HTTPS: "1" + ENABLE_HTTP_REDIRECT: "0" + JICOFO_AUTH_USER: focus + XMPP_BOSH_URL_BASE: 'http://prosody.NAMESPACE.svc.cluster.local:5280' \ No newline at end of file diff --git a/src/main/resources/jitsi/web-config-init-cm.yaml b/src/main/resources/jitsi/web-config-init-cm.yaml new file mode 100644 index 0000000..ac085bb --- /dev/null +++ b/src/main/resources/jitsi/web-config-init-cm.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + namespace: NAMESPACE + name: jitsi-meet-web-init + labels: + app.kubernetes.io/name: jitsi-meet + app.kubernetes.io/component: web +data: + 10-config: | + # Using web /etc/cont-init.d/10-config from container image \ No newline at end of file diff --git a/src/main/resources/jitsi/web-config-service.yaml b/src/main/resources/jitsi/web-config-service.yaml new file mode 100644 index 0000000..eede399 --- /dev/null +++ b/src/main/resources/jitsi/web-config-service.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + namespace: NAMESPACE + name: jitsi-meet-web + labels: + app.kubernetes.io/name: jitsi-meet + app.kubernetes.io/component: web +spec: + type: ClusterIP + ports: + - port: 80 + protocol: TCP + name: http + selector: + app.kubernetes.io/name: jitsi-meet + app.kubernetes.io/component: web \ No newline at end of file diff --git a/src/main/resources/jitsi/web-config-test-deployment.yaml b/src/main/resources/jitsi/web-config-test-deployment.yaml new file mode 100644 index 0000000..6ea9c08 --- /dev/null +++ b/src/main/resources/jitsi/web-config-test-deployment.yaml @@ -0,0 +1,25 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: "prosody-test-connection" + namespace: NAMESPACE + labels: + app.kubernetes.io/name: "prosody-test-connection" + app.kubernetes.io/component: prosody +spec: + replicas: 0 + strategy: + type: Recreate + selector: + matchLabels: + app.kubernetes.io/name: "prosody-test-connection" + template: + metadata: + labels: + app.kubernetes.io/name: "prosody-test-connection" + spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['prosody:5280/http-bind'] \ No newline at end of file diff --git a/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc b/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc index 41f1734..a2f8acd 100644 --- a/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc +++ b/src/test/cljc/dda/c4k_jitsi/jitsi_test.cljc @@ -155,3 +155,10 @@ (count (cut/jibri-config {:fqdn "xy.xy.xy" :namespace "jitsi"}))))) + +(deftest should-generate-web + (is (= 6 + (count (cut/web-config + {:fqdn "xy.xy.xy" + :namespace "jitsi"}))))) +