apiVersion: apps/v1
kind: Deployment
metadata:
  name: frontend
  labels:
    app: frontend
spec:
  selector:
    matchLabels:
      app: frontend
  template:
    metadata:
      labels:
        app: frontend
    spec:
      hostPID: true
      hostNetwork: true
      dnsPolicy: ClusterFirstWithHostNet
      containers:
      - name: envoy
        image: envoyproxy/envoy-alpine:v1.14.1
        imagePullPolicy: Always
        args: ["-l", "debug", "--local-address-ip-version", "v4", "-c", "/run/envoy/envoy.yaml", "--base-id", "1"]
        volumeMounts:
        - name: envoy-config
          mountPath: "/run/envoy"
          readOnly: true
        - name: spire-agent-socket
          mountPath: /run/spire/sockets
          readOnly: true
      - name: auth-helper
        image: us.gcr.io/scytale-registry/envoy-jwt-auth-helper@sha256:e55ce5fd42f13c5475b285a848c5f83bc4a335a93d7f934d3ac884920045fc96
        imagePullPolicy: IfNotPresent
        args:  ["-config", "/run/envoy-jwt-auth-helper/config/envoy-jwt-auth-helper.conf"]
        ports:
        - containerPort: 9011
        volumeMounts:
        - name: envoy-jwt-auth-helper-config
          mountPath: "/run/envoy-jwt-auth-helper/config"
          readOnly: true
        - name: spire-agent-socket
          mountPath: /run/spire/sockets
          readOnly: true
      - name: frontend
        imagePullPolicy: IfNotPresent
        image: us.gcr.io/scytale-registry/symbank-webapp:1.1.0
        command: ["/opt/symbank-webapp/symbank-webapp", "-config", "/run/symbank-webapp/config/symbank-webapp.conf"]
        ports:
        - containerPort: 3000
        volumeMounts:
        - name: symbank-webapp-config
          mountPath: /run/symbank-webapp/config
      volumes:
      - name: envoy-config
        configMap:
          name: frontend-envoy
      - name: spire-agent-socket
        hostPath:
          path: /run/spire/sockets
          type: DirectoryOrCreate
      - name: envoy-jwt-auth-helper-config
        configMap:
            name: "fe-envoy-jwt-auth-helper-config"
      - name: symbank-webapp-config
        configMap:
          name: symbank-webapp-config
