apiVersion: apps/v1
kind: Deployment
metadata:
  name: gateway
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gateway
  template:
    metadata:
      labels:
        app: gateway
    spec:
      volumes:
        - name: envoy-config
          configMap:
            name: gateway-envoy
      containers:
        - name: envoy
          image: envoyproxy/envoy:latest
          command:
            - "/usr/local/bin/envoy"
          args:
            - "--config-path /etc/envoy/envoy.yaml"
          resources:
            limits:
              memory: 64Mi
          volumeMounts:
            - name: envoy-config
              mountPath: /etc/envoy
          ports:
            - containerPort: 10000
              name: app
            - containerPort: 8001
              name: envoy-admin
        - name: server
          image: gcr.io/hogehoge/telepresence/gateway:latest
          ports:
            - containerPort: 50002
          livenessProbe:
            httpGet:
              path: /healthz
              port: 50002
            initialDelaySeconds: 3
            periodSeconds: 3
          readinessProbe:
            httpGet:
              path: /healthz
              port: 50002
              httpHeaders:
                - name: "X-Liveness-Header"
                  value: "OK"
            initialDelaySeconds: 3
            periodSeconds: 3
          env:
            - name: BACKEND_HOST
              value: "localhost"
            - name: BACKEND_PORT
              value: "50001"
            - name: MY_POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
          resources:
            requests:
              cpu: 100m
              memory: 64Mi
            limits:
              cpu: 100m
              memory: 64Mi
