kind: Deployment
apiVersion: apps/v1
metadata:
  name: example-app
  labels:
    app: example-app
  namespace: kafkaconsumer  
spec:
  replicas: 1
  selector:
    matchLabels:
      app: example-app
  template:
    metadata:
      labels:
        app: example-app
    spec:
      # initContainers:
      #   - name: proxy-init
      #     image: openpolicyagent/proxy_init:v5
      #     args: ["-p", "8000", "-u", "1111"]
      #     securityContext:
      #       capabilities:
      #         add:
      #         - NET_ADMIN
      #       runAsNonRoot: false
      #       runAsUser: 0
      containers:
        - name: app
          image: kafkaapp
          env:
          - name: KAFKA_BOOTSTRAP_SERVERS
            value: 127.0.0.1:9100
          volumeMounts:
          - mountPath: /root/.m2/repository
            name: m2
        - name: envoy
          image: envoyproxy/envoy:v1.15.3
          ports:
            - containerPort: 8000
              name: http 
          volumeMounts:
          - readOnly: true
            mountPath: /config
            name: proxy-config
          - name: spire-agent-socket
            mountPath: /run/spire/sockets
            readOnly: true             
          args:
          - "envoy"
          - "--config-path"
          - "/config/envoy.yaml"
        # - name: opa
        #   image: openpolicyagent/opa:0.26.0-istio-1
        #   securityContext:
        #     runAsUser: 1111
        #   volumeMounts:
        #   - readOnly: true
        #     mountPath: /policies
        #     name: app-policy
        #   args:
        #   - "run"
        #   - "--server"
        #   - "--set=plugins.envoy_ext_authz_grpc.addr=:9191"
        #   - "--set=plugins.envoy_ext_authz_grpc.query=data.system.main"
        #   - "--ignore=.*"
        #   - "/policies"
      volumes:
        - name: app-policy
          configMap:
            name: app-policy
        - name: proxy-config
          configMap:
            name: proxy-config
        - name: spire-agent-socket
          hostPath:
            path: /run/spire/sockets
            type: Directory
        - name: m2
          hostPath:
            path: /m2-repository
            type: Directory