apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: jvb
  namespace: jitsi
spec:
  serviceName: "jvb" #Do not use '-' in name.
  replicas: 1
  selector:
    matchLabels:
      app: jvb
  template:
    metadata:
      labels:
        app: jvb
    spec:
      containers:  
        - name: jvb
          image: jitsi/jvb:stable-5076
          imagePullPolicy: Always
          # resources:
          #   limits:
          #     cpu: "4000m"
          #   requests:
          #     cpu: "3000m"
          volumeMounts:
          - name: jvb-config
            mountPath: /etc/cont-init.d/10-config
            subPath: 10-config
          - name: jvb-config
            mountPath: /etc/jitsi/videobridge/config
            subPath: config
          - name: jvb-config
            mountPath: /defaults/sip-communicator.properties
            subPath: sip-communicator.properties
          env:
            - name: XMPP_SERVER
              valueFrom:
                configMapKeyRef:
                  name: jitsi-config
                  key: XMPP_SERVER
            - name: DOCKER_HOST_ADDRESS
              valueFrom:
                configMapKeyRef:
                  name: jitsi-config
                  key: DOCKER_HOST_ADDRESS
            - name: PUBLIC_URL
              valueFrom:
                configMapKeyRef:
                  name: jitsi-config
                  key: PUBLIC_URL
            - name: XMPP_DOMAIN
              value: meet.jitsi
            - name: XMPP_AUTH_DOMAIN
              value: auth.meet.jitsi
            - name: XMPP_INTERNAL_MUC_DOMAIN
              value: internal-muc.meet.jitsi
            - name: JVB_STUN_SERVERS
              value: stun.l.google.com:19302,stun1.l.google.com:19302,stun2.l.google.com:19302
            - name: JICOFO_AUTH_USER
              value: focus
            - name: JVB_TCP_HARVESTER_DISABLED
              value: "true"
            - name: JVB_TCP_PORT
              value: "4443"
            - name: JVB_AUTH_USER
              value: jvb
            - name: JVB_ENABLE_APIS
              value: rest,colibri
            - name: JVB_AUTH_PASSWORD
              valueFrom:
                configMapKeyRef:
                  name: jitsi-config
                  key: JVB_AUTH_PASSWORD
            - name: JICOFO_AUTH_PASSWORD
              valueFrom:
                configMapKeyRef:
                  name: jitsi-config
                  key: JICOFO_AUTH_PASSWORD
            - name: JVB_BREWERY_MUC
              value: jvbbrewery
            - name: OCTO_REGION
              valueFrom:
                configMapKeyRef:
                  name: web-shard-config
                  key: OCTO_REGION
      volumes:
      - name: jvb-config
        configMap:
          name: jvb-base
          defaultMode: 0777
          items:
          - key: config
            path: config
          - key: 10-config
            path: 10-config
          - key: sip-communicator.properties
            path: sip-communicator.properties