#
# Traefik Forward Auth Deployment
#
apiVersion: apps/v1
kind: Deployment
metadata:
  name: traefik-forward-auth
  namespace: api-gateway-system
  labels:
    app: traefik-forward-auth
spec:
  replicas: 1
  selector:
    matchLabels:
      app: traefik-forward-auth
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: traefik-forward-auth
    spec:
      containers:
      - name: traefik-forward-auth
        image: thomseddon/traefik-forward-auth:2
        ports:
        - containerPort: 4181
          protocol: TCP
          name: http
        env:
            - name: LOG_LEVEL
              value: debug
#            - name: LOGOUT_REDIRECT
#              value: /_oauth/logout
            # - name: DOMAIN
            #   value: dashboard.hypercloud.com
            # - name: INSECURE_COOKIE
            #   value: "true"
            # - name: COOKIE_DOMAIN
            #   value: dashboard.hypercloud.com
            - name: DEFAULT_PROVIDER
              value: oidc
            - name: PROVIDERS_OIDC_ISSUER_URL
              value: https://hyperauth.org/auth/realms/tmax
            - name: PROVIDERS_OIDC_CLIENT_ID
              value: jaeger
            - name: LOGOUT_REDIRECT
              value: https://hyperauth.org/auth/realms/tmax/protocol/openid-connect/logout?redirect_uri=https%3A%2F%2Fjaeger-query.tmaxcloud.org
            - name: DEFAULT_ACTION
              value: auth
#            - name: URL_PATH
#              value: /auth
            - name: PROVIDERS_OIDC_CLIENT_SECRET
              valueFrom:
                secretKeyRef:
                  name: traefik-forward-auth
                  key: PROVIDERS_OIDC_CLIENT_SECRET
            - name: SECRET
              valueFrom:
                secretKeyRef:
                  name: traefik-forward-auth
                  key: SECRET
            # - name: DEFAULT_PROVIDER
            #   valueFrom:
            #     configMapKeyRef:
            #       name: traefik-forward-auth
            #       key: DEFAULT_PROVIDER
            # - name: PROVIDERS_OIDC_ISSUER_URL
            #   valueFrom:
            #     configMapKeyRef:
            #       name: traefik-forward-auth
            #       key: PROVIDERS_OIDC_ISSUER_URL
            # - name: PROVIDERS_OIDC_CLIENT_ID
            #   valueFrom:
            #     configMapKeyRef:
            #       name: traefik-forward-auth
            #       key: PROVIDERS_OIDC_CLIENT_ID
            # - name: AUTH_HOST
            #   valueFrom:
            #     configMapKeyRef:
            #       name: traefik-forward-auth
            #       key: AUTH_HOST
            # - name: URL_PATH
            #   valueFrom:
            #     configMapKeyRef:
            #       name: traefik-forward-auth
            #       key: URL_PATH