apiVersion: apps/v1
kind: Deployment
metadata:
  name: pbx
  namespace: pbx
  labels:
    app.kubernetes.io/name: pbx
    app.kubernetes.io/part-of: pbx
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 2
  selector:
    matchLabels:
      app.kubernetes.io/name: pbx
      app.kubernetes.io/part-of: pbx
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app.kubernetes.io/name: pbx
        app.kubernetes.io/part-of: pbx
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: cloud.google.com/gke-preemptible
                operator: DoesNotExist
      hostNetwork: true
      initContainers:
      - image: gcr.io/trusted-builds/asterisk
        imagePullPolicy: Always
        command: ["/usr/bin/gen-sip-config", "/tmp/asterisk/sip.conf"]
        name: config-gen
        volumeMounts:
        - name: config
          mountPath: /tmp/asterisk
      containers:
      - image: gcr.io/trusted-builds/asterisk
        imagePullPolicy: IfNotPresent
        name: asterisk
        env:
        - name: DID_OTTAWA
          value: ""
        ports:
        - containerPort: 5060
          hostPort: 5060
          protocol: TCP
        - containerPort: 5060
          hostPort: 5060
          protocol: UDP
        - containerPort: 5061
          hostPort: 5061
          protocol: TCP
        - containerPort: 5061
          hostPort: 5061
          protocol: UDP
        - containerPort: 10000
          hostPort: 10000
          protocol: UDP
        - containerPort: 10001
          hostPort: 10001
          protocol: UDP
        - containerPort: 10002
          hostPort: 10002
          protocol: UDP
        - containerPort: 10003
          hostPort: 10003
          protocol: UDP
        - containerPort: 10004
          hostPort: 10004
          protocol: UDP
        - containerPort: 10005
          hostPort: 10005
          protocol: UDP
        - containerPort: 10006
          hostPort: 10006
          protocol: UDP
        - containerPort: 10007
          hostPort: 10007
          protocol: UDP
        - containerPort: 10008
          hostPort: 10008
          protocol: UDP
        - containerPort: 10009
          hostPort: 10009
          protocol: UDP
        - containerPort: 10010
          hostPort: 10010
          protocol: UDP
        - containerPort: 10011
          hostPort: 10011
          protocol: UDP
        - containerPort: 10012
          hostPort: 10012
          protocol: UDP
        - containerPort: 10013
          hostPort: 10013
          protocol: UDP
        - containerPort: 10014
          hostPort: 10014
          protocol: UDP
        - containerPort: 10015
          hostPort: 10015
          protocol: UDP
        - containerPort: 10016
          hostPort: 10016
          protocol: UDP
        - containerPort: 10017
          hostPort: 10017
          protocol: UDP
        - containerPort: 10018
          hostPort: 10018
          protocol: UDP
        - containerPort: 10019
          hostPort: 10019
          protocol: UDP
        - containerPort: 10020
          hostPort: 10020
          protocol: UDP
        - containerPort: 10021
          hostPort: 10021
          protocol: UDP
        - containerPort: 10022
          hostPort: 10022
          protocol: UDP
        - containerPort: 10023
          hostPort: 10023
          protocol: UDP
        - containerPort: 10024
          hostPort: 10024
          protocol: UDP
        - containerPort: 10025
          hostPort: 10025
          protocol: UDP
        - containerPort: 10026
          hostPort: 10026
          protocol: UDP
        - containerPort: 10027
          hostPort: 10027
          protocol: UDP
        - containerPort: 10028
          hostPort: 10028
          protocol: UDP
        - containerPort: 10029
          hostPort: 10029
          protocol: UDP
        - containerPort: 10030
          hostPort: 10030
          protocol: UDP
        - containerPort: 10031
          hostPort: 10031
          protocol: UDP
        - containerPort: 10032
          hostPort: 10032
          protocol: UDP
        - containerPort: 10033
          hostPort: 10033
          protocol: UDP
        - containerPort: 10034
          hostPort: 10034
          protocol: UDP
        - containerPort: 10035
          hostPort: 10035
          protocol: UDP
        - containerPort: 10036
          hostPort: 10036
          protocol: UDP
        - containerPort: 10037
          hostPort: 10037
          protocol: UDP
        - containerPort: 10038
          hostPort: 10038
          protocol: UDP
        - containerPort: 10039
          hostPort: 10039
          protocol: UDP
        - containerPort: 10040
          hostPort: 10040
          protocol: UDP
        - containerPort: 10041
          hostPort: 10041
          protocol: UDP
        - containerPort: 10042
          hostPort: 10042
          protocol: UDP
        - containerPort: 10043
          hostPort: 10043
          protocol: UDP
        - containerPort: 10044
          hostPort: 10044
          protocol: UDP
        - containerPort: 10045
          hostPort: 10045
          protocol: UDP
        - containerPort: 10046
          hostPort: 10046
          protocol: UDP
        - containerPort: 10047
          hostPort: 10047
          protocol: UDP
        - containerPort: 10048
          hostPort: 10048
          protocol: UDP
        volumeMounts:
        - name: config
          mountPath: /etc/asterisk/sip.conf
          subPath: sip.conf
      volumes:
      - name: config
        emptyDir: {}
      - name: sip-conf
        configMap:
          name: sip-conf
