# DO NOT THIS FILE ANYMORE
# ALREADY INCLUDED IN THE AUTOSCALER DOCKERS
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: jvb-0
  namespace: jitsi
spec:
  serviceName: "jvb-0" #Do not use '-' in name.
  replicas: 1
  selector:
    matchLabels:
      app: jvb
  template:
    metadata:
      labels:
        app: jvb
    spec:
      volumes:
        - name: telegraf-config-volume
          configMap:
            name: telegraf-config
      containers:
        - name: telegraf
          image: telegraf:1.10.0
          envFrom:
            - secretRef:
                name: telegraf-secrets
          env:
            - name: JVB_ADDR
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: INPUT_ADDR
              value: http://$(JVB_ADDR):8080/colibri/stats
          volumeMounts:
            - name: telegraf-config-volume
              mountPath: /etc/telegraf/telegraf.conf
              subPath: telegraf.conf
              readOnly: true
        - name: jvb
          image: jitsiacr.azurecr.io/jvb:1.3.0 # CHANGE TO YOUR OWN REMOTE DOCKER IMAGE PREVIOUSLY BUILT
          imagePullPolicy: Always
          #volumeMounts:
          #  - name: jvb
          #    mountPath: /home/jitsi-config/jvb/pv
          resources:
            requests:
              cpu: "0.2"
              memory: "500Mi"
            limits:
              cpu: "0.3"
              memory: "600Mi"
          env:
            - name: XMPP_SERVER
              value: 10.0.6.104 # CHANGE TO THE INTERNAL IP OF web SERVICE
            - name: DOCKER_HOST_ADDR0
              value: 52.152.201.25 # CHANGE TO THE EXTERNAL IP OF jvb-0 SERVICE
            - name: DOCKER_HOST_ADDR1
              value: 52.152.202.236 # CHANGE TO THE EXTERNAL IP OF jvb-1 SERVICE
            - name: DOCKER_HOST_ADDR2
              value: 52.188.176.179 # CHANGE TO THE EXTERNAL IP OF jvb-2 SERVICE
            - name: DOCKER_HOST_ADDR3
              value: 52.151.243.18 # CHANGE TO THE EXTERNAL IP OF jvb-3 SERVICE
            - name: DOCKER_HOST_ADDR4
              value: 40.88.16.118 # CHANGE TO THE EXTERNAL IP OF jvb-4 SERVICE
            - name: DOCKER_HOST_ADDR5
              value: 52.152.204.75 # CHANGE TO THE EXTERNAL IP OF jvb-5 SERVICE
            - name: DOCKER_LOCAL_ADDR
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
            - name: XMPP_DOMAIN
              #value: meet.jitsi
              value: jitsicluster.eastus.cloudapp.azure.com
            #- name: ENABLE_GUESTS
            #  value: "1"
            - name: XMPP_GUEST_DOMAIN
            #  #value: guest.meet.jitsi
              value: guest.jitsicluster.eastus.cloudapp.azure.com
            - name: XMPP_AUTH_DOMAIN
              #value: auth.meet.jitsi
              value: auth.jitsicluster.eastus.cloudapp.azure.com
            - name: XMPP_INTERNAL_MUC_DOMAIN
              #value: internal-muc.meet.jitsi
              value: internal-muc.jitsicluster.eastus.cloudapp.azure.com
            #- name: JVB_STUN_SERVERS
            #   value: stun.l.google.com:19302,stun1.l.google.com:19302,stun2.l.google.com:19302
            #  value: meet-jit-si-turnrelay.jitsi.net:443
            - name: JICOFO_AUTH_USER
              value: focus
            - name: JVB_TCP_HARVESTER_DISABLED
              value: "true"
            - name: JVB_AUTH_USER
              value: jvb
            #- name: JVB_PORT This will be automatically assigned in run time starting from 31000
            #  value: "30310"
            - name: JVB_ENABLE_APIS
              value: rest,colibri
            - name: JVB_AUTH_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: jitsi-config
                  key: JVB_AUTH_PASSWORD
            - name: JICOFO_AUTH_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: jitsi-config
                  key: JICOFO_AUTH_PASSWORD
            - name: JVB_BREWERY_MUC
              value: jvbbrewery
            - name: JVB_KILLER_IP
              value: 10.244.0.12 # CHANGE TO BASELINE/DQN AUTOSCALER IP
