apiVersion: apps/v1
kind: Deployment
metadata:
  name: oauth2-proxy-longhorn
  namespace: longhorn-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: oauth2-proxy-longhorn
  template:
    metadata:
      labels:
        app: oauth2-proxy-longhorn
    spec:
      containers:
      - name: oauth2-proxy-longhorn
        image: quay.io/oauth2-proxy/oauth2-proxy:v7.8.2
        args:
          - --provider=keycloak
          - --client-id=longhorn
          - --client-secret=gxyMUP89svnEXnz128ZqNBTLxjlLpBxM
          - --cookie-secret=1arlufhiIIvTT3iPexXVREeo8YDX-ZLk3k33-98FPRM=
          - --oidc-issuer-url=https://sso.panic.haus/realms/panic-haus
          - --cookie-domain=longhorn.prod.panic.haus
          - --email-domain=*
#          - --session-store-type=redis
#          - --redis-connection-url=redis://redis-lb.redis.svc.cluster.local:6379
          - --http-address=0.0.0.0:4180
          - --redirect-url=https://longhorn.prod.panic.haus/oauth2/callback
          - --upstream=http://longhorn-frontend.longhorn-system.svc.cluster.local:80
          - --scope=openid
          - --login-url=https://sso.panic.haus/realms/panic-haus/protocol/openid-connect/auth
          - --validate-url=https://sso.panic.haus/realms/panic-haus/protocol/openid-connect/userinfo
          - --redeem-url=https://sso.panic.haus/realms/panic-haus/protocol/openid-connect/token
        ports:
        - containerPort: 4180
          name: http
