{{ if .Values.auth_proxy.enabled }}
apiVersion: apps/v1
kind: Deployment 
metadata:
  name: auth-proxy
spec:
  selector:
    matchLabels:
      app: auth-proxy
  template:
    metadata:
      labels:
        app: auth-proxy
    spec:
      containers:
        - name: auth-proxy
          image: docker.io/nginx:stable-alpine
          imagePullPolicy: Always
          volumeMounts:
            - mountPath: /etc/nginx/nginx.conf
              name: nginx-conf
      restartPolicy: Always
      volumes:
        - name: nginx-conf
          hostPath:
            path: {{.Values.auth_proxy.nginx_conf}}
            type: File
      {{ include "app.affinity" . | nindent 6}}
---
apiVersion: v1
kind: Service
metadata:
  name: auth-proxy
spec:
  type: ClusterIP
  selector:
    app: auth-proxy
  ports:
    - name: http
      protocol: TCP
      port: 80
      targetPort: 80
{{ end }}