apiVersion: apps/v1
kind: Deployment
metadata:
  name: jwt-decode-auth
  namespace: api-gateway-system
spec:
  replicas: 1
  selector:
    matchLabels:
      app: jwt-decode-auth
  template:
    metadata:
      labels:
        app: jwt-decode-auth
    spec:
      affinity:
        podAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - podAffinityTerm:
                topologyKey: kubernetes.io/hostname
                labelSelector:
                  matchExpressions:
                    - key: app.kubernetes.io/name
                      operator: In
                      values:
                        - traefik
              weight: 100
#          requiredDuringSchedulingIgnoredDuringExecution:
#            - labelSelector:
#                matchExpressions:
#                  - key: app.kubernetes.io/name
#                    operator: In
#                    values:
#                      - traefik
#              topologyKey: kubernetes.io/hostname
      containers:
      - name: jwt-decode
        env:
          - name: JWKS_URL
            value: https://{{HYPERAUTH}}/auth/realms/{{REALM}}/protocol/openid-connect/certs
          - name: AUTH_HEADER_KEY
            value: Authorization
          - name: CACHE_ENABLED
            value: "true"
          - name: LOG_LEVEL
            value: debug
          - name: LOG_TYPE
            value: pretty
          - name: MAX_CACHE_KEYS
            value: "10000"
          - name: PORT
            value: "8080"
          - name: TOKEN_VALIDATED_HEADER_KEY
            value: jwt-token-validated
        image: tmaxcloudck/jwt-decode:5.0.0.1
        imagePullPolicy: IfNotPresent
        ports:
            - name: jwt-decode-auth
              protocol: TCP
              containerPort: 8080