---
kind: ConfigMap
apiVersion: v1
metadata:
  name: traefik-configmap
  # namespace: traefik
  namespace: kube-system
data:
  traefik.toml: |
    # Entrypoints to be used by frontends that do not specify any entrypoint.
    # Each frontend can specify its own entrypoints.
    #
    # Optional
    # Default: ["http"]
    #
    # defaultEntryPoints = ["http", "https"]
    defaultEntryPoints = ["http","https"]

    # SOURCE: https://docs.traefik.io/configuration/entrypoints/
    [entryPoints]

      [entryPoints.http]
      address = ":80"


      [entryPoints.https]
      address = ":443"
        [entryPoints.https.tls]
          [[entryPoints.https.tls.certificates]]
          CertFile = "/ssl/tls.crt"
          KeyFile = "/ssl/tls.key"

      [entryPoints.traefik]
        address = ":8080"
        [entryPoints.traefik.auth.basic]
        users = ["admin:$apr1$Ucncoj0y$..EGVyVbLUkmdL0X9/rGN/"]

    ################################################################
    # Kubernetes Ingress Provider
    ################################################################

    # Enable Kubernetes Ingress Provider.
    # NOTE: Defining Kubernetes Ingress endpoint is done by defining publishService and it must contain values of namespace and name of Traefik service . In this case, that is traefik/traefik.
    [kubernetes]
      # Kubernetes server endpoint.
      #
      # Optional for in-cluster configuration, required otherwise.
      # Default: empty
      #
      # endpoint = "http://localhost:8080"

      # Bearer token used for the Kubernetes client configuration.
      #
      # Optional
      # Default: empty
      #
      # token = "my token"

      # Path to the certificate authority file.
      # Used for the Kubernetes client configuration.
      #
      # Optional
      # Default: empty
      #
      # certAuthFilePath = "/my/ca.crt"

      # Array of namespaces to watch.
      #
      # Optional
      # Default: all namespaces (empty array).
      #
      # namespaces = ["default", "production"]

      # Ingress label selector to filter Ingress objects that should be processed.
      #
      # Optional
      # Default: empty (process all Ingresses)
      #
      # labelselector = "A and not B"

      # Value of `kubernetes.io/ingress.class` annotation that identifies Ingress objects to be processed.
      # If the parameter is non-empty, only Ingresses containing an annotation with the same value are processed.
      # Otherwise, Ingresses missing the annotation, having an empty value, or the value `traefik` are processed.
      #
      # Optional
      # Default: empty
      #
      # ingressClass = "traefik-internal"

      # Disable PassHost Headers.
      #
      # Optional
      # Default: false
      #
      # disablePassHostHeaders = true

      # Enable PassTLSCert Headers.
      #
      # Optional
      # Default: false
      #
      # enablePassTLSCert = true

      # Override default configuration template.
      #
      # Optional
      # Default: <built-in template>
      #
      # filename = "kubernetes.tmpl"

      # Enable IngressEndpoint configuration.
      # This will allow Traefik to update the status section of ingress objects, if desired.
      #
      # Optional
      #
      # [kubernetes.ingressEndpoint]
      #
      # At least one must be configured.
      # `publishedservice` will override the `hostname` and `ip` settings if configured.
      #
      # hostname = "localhost"
      # ip = "127.0.0.1"
      # publishedService = "namespace/servicename"
      # [kubernetes.ingressEndpoint]
      #   # publishedService = "traefik/traefik"
      #   publishedService = "kube-system/traefik"

    # THIS IS PROBABLY WHAT IS SCREWING US!!
    # SOURCE: https://docs.traefik.io/configuration/ping/
    # Ping definition
    # [ping]
    # # Name of the related entry point
    # #
    # # Optional
    # # Default: "traefik"
    # #
    # # Path  |  Method     |   Description
    # # /ping |  GET, HEAD  |   A simple endpoint to check for Traefik process liveness. Return a code 200 with the content: OK
    # # NOTE: entryPoint = "http" == entryPoints.http
    # entryPoint = "http"

    # API definition
    # Warning: Enabling API will expose Traefik's configuration.
    # It is not recommended in production,
    # unless secured by authentication and authorizations
    [api]
    # Name of the related entry point
    #
    # Optional
    # Default: "traefik"
    #
    entryPoint = "traefik"

    # Enable Dashboard
    #
    # Optional
    # Default: true
    #
    dashboard = true

    # Enable debug mode.
    # This will install HTTP handlers to expose Go expvars under /debug/vars and
    # pprof profiling data under /debug/pprof/.
    # Additionally, the log level will be set to DEBUG.
    #
    # Optional
    # Default: false
    #
    debug = true
