apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    app.kubernetes.io/instance: traefik
    app.kubernetes.io/managed-bu: tmax-cloud
    app.kubernetes.io/name: api-gateway
  name: console-config
  namespace: api-gateway-system
data:
  traefik.yml: |
    http:
      services:
        console-service:
          loadBalancer:
            serversTransport: console
            servers:
            # - url: "http://0.0.0.0:31303"
            - url: "http://0.0.0.0:31303"
      serversTransports:
        insecure:
          insecureSkipVerify: true
        console:
          serverName: tmax-cloud
          rootCAs:
            - /run/secrets/tmaxcloud.org/ca.crt
        tmaxcloud:
          ## https://lascrea.tistory.com/217
          ## https://doc.traefik.io/traefik/routing/services/#serverstransport
          ## dns 서버접속이기 때문에 해당 url이 인증서의 dn가 일치하는지 확인이 필요 그래서 serverName 입력이 필요함
          ## serverName tmax-cloud로 통일하기
          serverName: tmax-cloud
          rootCAs:
            - /run/secrets/tmaxcloud.org/ca.crt
        kubernetes:
          rootCAs:
            - /run/secrets/kubernetes.io/serviceaccount/ca.crt
      middlewares:
        dashboard-auth:
          basicAuth:
            users:
              - "admin:$apr1$WboCaB7Z$PJbsvKlI3XMq12xMeQMmG."
        jwt-decode-auth:
          forwardAuth:
            address: "http://localhost:8080"
            authResponseHeaders:
              - jwt-token-validated
              - Authorization
            trustForwardHeader: true
            tls:
              insecureSkipVerify: true
        cors-header:
          headers:
            accessControlAllowMethods:
              - "*"
            accessControlAllowOriginList:
              - "*"
            accessControlAllowHeaders:
              - "*"
            accessControlMaxAge: 100
            # accessControlExposeHeaders: true
            # hostsProxyHeaders: true
            # addVaryHeader: true
