From d161729e1962b76fd990c145b71da1aed2f3faf4 Mon Sep 17 00:00:00 2001 From: taktakpeops <54535041+taktakpeops@users.noreply.github.com> Date: Sat, 25 Apr 2020 14:30:11 +0200 Subject: [PATCH] feat(scale): enable HPA web - enable pubsub for JVB --- jitsi-meet-examples/aws/jitsi-values.yaml | 27 +++++++++++++++++- .../configs/jvb/sip-communicator.properties | 28 +++++++++++++++++++ jitsi-meet/templates/deployment-jvb.yaml | 12 ++++++++ jitsi-meet/templates/hpa-web.yaml | 15 +++------- jitsi-meet/templates/jvb-sip-config.yaml | 11 ++++++++ jitsi-meet/templates/service-jvb.yaml | 4 +++ jitsi-meet/values.yaml | 4 +++ 7 files changed, 89 insertions(+), 12 deletions(-) create mode 100644 jitsi-meet/configs/jvb/sip-communicator.properties create mode 100644 jitsi-meet/templates/jvb-sip-config.yaml diff --git a/jitsi-meet-examples/aws/jitsi-values.yaml b/jitsi-meet-examples/aws/jitsi-values.yaml index eca22d0..f5016b3 100644 --- a/jitsi-meet-examples/aws/jitsi-values.yaml +++ b/jitsi-meet-examples/aws/jitsi-values.yaml @@ -16,11 +16,15 @@ jicofo: - name: XMPP_INTERNAL_MUC_DOMAIN value: internal-muc.meet.jitsi +# need JVM optimisation jvb: userAuth: enabled: true name: "jvb" secret: dG90bw== + ingress: + enabled: false + replicaCount: 2 environment: - name: TZ value: Europe/Amsterdam @@ -77,6 +81,20 @@ web: - hosts: - jitsi.meat-project.tk secretName: jitsi-web + replicaCount: 2 + hpa: + enabled: true + minReplicas: 2 + maxReplicas: 3 + metrics: + - type: Resource + resource: + name: memory + targetAverageUtilization: 70 + - type: Resource + resource: + name: cpu + targetAverageUtilization: 70 environment: - name: XMPP_DOMAIN value: meet.jitsi @@ -89,4 +107,11 @@ web: - name: TZ value: America/Los_Angeles - name: JVB_TCP_HARVESTER_DISABLED - value: "true" \ No newline at end of file + value: "true" + resources: + limits: + memory: 128Mi + cpu: 50m + requests: + memory: 64Mi + cpu: 15m diff --git a/jitsi-meet/configs/jvb/sip-communicator.properties b/jitsi-meet/configs/jvb/sip-communicator.properties new file mode 100644 index 0000000..f8a454e --- /dev/null +++ b/jitsi-meet/configs/jvb/sip-communicator.properties @@ -0,0 +1,28 @@ +org.jitsi.videobridge.SINGLE_PORT_HARVESTER_PORT={{ .Env.JVB_PORT }} +org.jitsi.videobridge.DISABLE_TCP_HARVESTER={{ .Env.JVB_TCP_HARVESTER_DISABLED }} +org.jitsi.videobridge.TCP_HARVESTER_PORT={{ .Env.JVB_TCP_PORT }} +{{ if .Env.JVB_STUN_SERVERS }} +org.ice4j.ice.harvest.STUN_MAPPING_HARVESTER_ADDRESSES={{ .Env.JVB_STUN_SERVERS }} +{{ end }} +{{ $JVB_TCP_PORT := .Env.JVB_TCP_PORT | default "4443" }} +{{ $JVB_TCP_MAPPED_PORT := .Env.JVB_TCP_MAPPED_PORT | default $JVB_TCP_PORT }} +{{ if not (eq $JVB_TCP_PORT $JVB_TCP_MAPPED_PORT) }} +org.jitsi.videobridge.TCP_HARVESTER_MAPPED_PORT={{ $JVB_TCP_MAPPED_PORT }} +{{ end }} + +org.jitsi.videobridge.xmpp.user.shard.HOSTNAME={{ .Env.XMPP_SERVER }} +org.jitsi.videobridge.xmpp.user.shard.DOMAIN={{ .Env.XMPP_AUTH_DOMAIN }} +org.jitsi.videobridge.xmpp.user.shard.USERNAME={{ .Env.JVB_AUTH_USER }} +org.jitsi.videobridge.xmpp.user.shard.PASSWORD={{ .Env.JVB_AUTH_PASSWORD }} +org.jitsi.videobridge.xmpp.user.shard.MUC_JIDS={{ .Env.JVB_BREWERY_MUC }}@{{ .Env.XMPP_INTERNAL_MUC_DOMAIN }} +org.jitsi.videobridge.xmpp.user.shard.MUC_NICKNAME={{ .Env.HOSTNAME }} +org.jitsi.videobridge.xmpp.user.shard.DISABLE_CERTIFICATE_VERIFICATION=true + +org.jitsi.videobridge.ENABLE_STATISTICS=true +org.jitsi.videobridge.STATISTICS_TRANSPORT=muc +org.jitsi.videobridge.STATISTICS_INTERVAL=5000 + +org.jitsi.videobridge.ENABLE_STATISTICS=true +org.jitsi.videobridge.STATISTICS_TRANSPORT=pubsub +org.jitsi.videobridge.PUBSUB_SERVICE={{ .Env.XMPP_DOMAIN }} +org.jitsi.videobridge.PUBSUB_NODE=sharedStatsNode diff --git a/jitsi-meet/templates/deployment-jvb.yaml b/jitsi-meet/templates/deployment-jvb.yaml index f4d3c55..721cf6b 100644 --- a/jitsi-meet/templates/deployment-jvb.yaml +++ b/jitsi-meet/templates/deployment-jvb.yaml @@ -6,6 +6,7 @@ metadata: labels: {{ include "jitsi-meet.labels" . | indent 4 }} spec: + serviceName: {{ include "jitsi-meet.name-jvb" . }} replicas: {{ .Values.jvb.replicaCount }} selector: matchLabels: @@ -68,12 +69,23 @@ spec: volumeMounts: - name: dockersock mountPath: "/var/run/docker.sock" + - name: config + mountPath: "/var/app" + lifecycle: + podStart: + exec: + - /bin/bash + - -c + - cp /var/app/sip-communicator.properties /config/sip-communicator.properties resources: {{- toYaml .Values.jvb.resources | nindent 12 }} volumes: - name: dockersock hostPath: path: /var/run/docker.sock + - name: config + configMap: + name: {{ template "jitsi-meet.name-jvb-config" . }}-cm {{- with .Values.jvb.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/jitsi-meet/templates/hpa-web.yaml b/jitsi-meet/templates/hpa-web.yaml index 5be4bb0..3d16f41 100644 --- a/jitsi-meet/templates/hpa-web.yaml +++ b/jitsi-meet/templates/hpa-web.yaml @@ -13,16 +13,9 @@ spec: maxReplicas: {{ .Values.web.hpa.maxReplicas }} minReplicas: {{ .Values.web.hpa.minReplicas }} metrics: -{{- with .Values.web.hpa.targetCPUUtilizationPercentage }} - - type: Resource + {{- range .Values.web.hpa.metrics }} + - type: {{ .type }} resource: - name: cpu - targetAverageUtilization: {{ . }} -{{- end }} -{{- with .Values.web.hpa.targetMemoryUtilizationPercentage }} - - type: Resource - resource: - name: memory - targetAverageUtilization: {{ . }} -{{- end }} + {{- toYaml .resource | nindent 8 }} + {{- end }} {{- end }} \ No newline at end of file diff --git a/jitsi-meet/templates/jvb-sip-config.yaml b/jitsi-meet/templates/jvb-sip-config.yaml new file mode 100644 index 0000000..aa4295b --- /dev/null +++ b/jitsi-meet/templates/jvb-sip-config.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "jitsi-meet.name-jvb-config" . }}-cm + labels: +{{ include "jitsi-meet.labels" . | indent 4 }} +data: + {{- range $path, $d := .Files.Glob "configs/jvb/*.properties" }} + {{- $path }}: |- + {{- $d | toString | nindent 4 }} + {{- end }} diff --git a/jitsi-meet/templates/service-jvb.yaml b/jitsi-meet/templates/service-jvb.yaml index 416b330..a3068b5 100644 --- a/jitsi-meet/templates/service-jvb.yaml +++ b/jitsi-meet/templates/service-jvb.yaml @@ -11,6 +11,10 @@ metadata: spec: type: NodePort externalTrafficPolicy: Local + sessionAffinity: {{ .Values.jvb.service.sessionAffinity }} + {{ if .Values.jvb.service.sessionAffinityConfig }} + {{- toYaml .Values.jvb.service.sessionAffinityConfig }} + {{ end }} ports: - port: 30300 protocol: UDP diff --git a/jitsi-meet/values.yaml b/jitsi-meet/values.yaml index 6842b5d..05d63c2 100644 --- a/jitsi-meet/values.yaml +++ b/jitsi-meet/values.yaml @@ -98,6 +98,10 @@ jvb: annotations: [] type: NodePort externalTrafficPolicy: Cluster + sessionAffinity: None + sessionAffinityConfig: + clientIP: + timeoutSeconds: 10800 ingress: enabled: false resources: {}