apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: nginx
  name: nginx
  namespace: default
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: nginx
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - image: nginx
        imagePullPolicy: Always
        name: nginx
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /etc/nginx/nginx.conf
          name: nginx-config
          subPath: nginx.conf
      - args:
        - envoy
        - --config-path
        - /config/envoy-nginx.yaml
        env:
        - name: ENVOY_UID
          value: "1111"
        image: envoyproxy/envoy:v1.17.0
        imagePullPolicy: IfNotPresent
        name: envoy
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /config
          name: proxy-config
          readOnly: true
      - args:
        - run
        - --server
        - --addr=localhost:8181
        - --diagnostic-addr=0.0.0.0:8282
        - --set=plugins.envoy_ext_authz_grpc.addr=:9191
        - --set=plugins.envoy_ext_authz_grpc.path=envoy/authz/allow
        - --set=decision_logs.console=true
        - --ignore=.*
        - /policy/policy.rego
        image: openpolicyagent/opa:latest-envoy
        imagePullPolicy: IfNotPresent
        name: opa
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /policy
          name: opa-policy
          readOnly: true
      dnsPolicy: ClusterFirst
      initContainers:
      - args:
        - -p
        - "8888"
        - -u
        - "1111"
        - -w
        - "8282"
        - -o
        - "9999"
        image: openpolicyagent/proxy_init:v5
        imagePullPolicy: IfNotPresent
        name: proxy-init
        resources: {}
        securityContext:
          capabilities:
            add:
            - NET_ADMIN
          runAsNonRoot: false
          runAsUser: 0
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - configMap:
          defaultMode: 420
          name: nginx-conf
        name: nginx-config
      - configMap:
          defaultMode: 420
          name: nginx-proxy-config
        name: proxy-config
      - name: opa-policy
        secret:
          defaultMode: 420
          secretName: opa-policy
