#this script will create following deployments in a single pod.
# 1. jicofo

apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    k8s-app: jitsi
  name: jitsi-jicofo
  namespace: jitsi
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      k8s-app: jitsi-jicofo
  template:
    metadata:
      labels:
        k8s-app: jitsi-jicofo
    spec:
      containers:
        - name: jicofo
          image: jitsi/jicofo:stable-5390-3
          volumeMounts:
          - mountPath: /defaults/jicofo.conf
            name: jicofo
            subPath: jicofo.conf
          imagePullPolicy: Always
          resources:
            limits:
              memory: 1000Mi
              cpu: 1000m
            requests:
              memory: 400Mi
              cpu: 400m
          env:
            - name: AUTH_TYPE
              value: "jwt"
            - name: ENABLE_AUTH
              value: "0"
            - name: ENABLE_AUTO_OWNER
              value: "true"  
            - name: ENABLE_CODEC_VP8
              value: "true"
            - name: ENABLE_CODEC_VP9
              value: "true"
            - name: ENABLE_CODEC_H264
              value: "true"
            - name: ENABLE_SCTP
              value: "true"
            - name: MAX_BRIDGE_PARTICIPANTS
              value: ""  
            - name: BRIDGE_AVG_PARTICIPANT_STRESS
              value: ""
            - name: BRIDGE_STRESS_THRESHOLD
              value: "0.45" 
            - name: OCTO_BRIDGE_SELECTION_STRATEGY
              value: SplitBridgeSelectionStrategy #IntraRegionBridgeSelectionStrategy #SingleBridgeSelectionStrategy
            - name: JICOFO_ENABLE_BRIDGE_HEALTH_CHECKS
              value: "true"
            - name: JICOFO_CONF_INITIAL_PARTICIPANT_WAIT_TIMEOUT
              value: ""
            - name: JICOFO_CONF_SINGLE_PARTICIPANT_TIMEOUT
              value: ""
            - name: JICOFO_ENABLE_HEALTH_CHECKS
              value: "true"
            - name: ENABLE_RECORDING
              value: "1"
            - name: JIBRI_REQUEST_RETRIES
              value: ""
            - name: ENABLE_JIBRI_SIP
              value: "0"
            - name: JIGASI_BREWERY_MUC
              value: ""
            - name: JICOFO_SHORT_ID
              value: "1"
            - name: XMPP_SERVER
              valueFrom:
                configMapKeyRef:
                  name: jitsi-config
                  key: XMPP_SERVER
            - 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: XMPP_MUC_DOMAIN
              value: muc.meet.jitsi  
            - name: JICOFO_COMPONENT_SECRET
              valueFrom:
                configMapKeyRef:
                  name: jitsi-config
                  key: JICOFO_COMPONENT_SECRET
            - name: JICOFO_AUTH_USER
              value: focus
            - name: JICOFO_AUTH_PASSWORD
              valueFrom:
                configMapKeyRef:
                  name: jitsi-config
                  key: JICOFO_AUTH_PASSWORD
            - name: TZ
              valueFrom:
                configMapKeyRef:
                  name: jitsi-config
                  key: TZ
            - name: JVB_BREWERY_MUC
              value: jvbbrewery
            - name: JIBRI_BREWERY_MUC
              value: jibribrewery  
            - name: JIBRI_PENDING_TIMEOUT
              value: "90"
            - name: JIGASI_BREWERY_MUC
              value: jigasibrewery  
      volumes:
        - name: jicofo
          configMap:
            defaultMode: 0775
            name: jicofo-base
            items:
              - key: jicofo.conf
                path: jicofo.conf

