apiVersion: apps/v1
# islb relay isn't finished yet, so only 1 sfu is supported
# when relay is ready, we'll switch to DaemonSet (1 pod per node)
# so the connections will be spread across the cluster
kind: Deployment
metadata:
  name: sfu
spec:
  replicas: 1
  selector:
    matchLabels:
      name: sfu
  template:
    metadata:
      labels:
        name: sfu
    spec:
      #tolerations:
      #- key: node-role.kubernetes.io/master
      #  effect: NoSchedule
      # this toleration is to have the daemonset runnable on master nodes
      # it is commented out so the master will NOT run SFU nodes
      # because SFU nodes are liable to eat a lot of bandwidth and connections
      
      containers:
      - name: sfu
        image: pionwebrtc/ion-sfu:v0.4.6
        command: ["/usr/local/bin/sfu", "-c", "/configs/sfu.toml"]
        resources:
          limits:
            memory: 500Mi
          requests:
            cpu: 250m
            memory: 500Mi
        env:
        - name: SERVICE
          value: sfu
        - name: NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        volumeMounts:
        - name: config-volume
          mountPath: /configs/
      volumes:
      - name: config-volume
        configMap:
          # Provide the name of the ConfigMap containing the files you want
          # to add to the container
          name: ion-config
      
      hostNetwork: true
      dnsPolicy: ClusterFirstWithHostNet
      terminationGracePeriodSeconds: 30
      
        
   
