Skip to content

Traefik is behaving differently from the documentation when using annotations for specifying the IngressClassName #9781

@mkgrei

Description

@mkgrei

Welcome!

  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've searched similar issues on the Traefik community forum and didn't find any.

What did you do?

https://doc.traefik.io/traefik/providers/kubernetes-crd/#ingressclass

The above document says,

If the parameter is set, only resources containing an annotation with the same value are processed. Otherwise, resources missing the annotation, having an empty value, or the value traefik are processed.

Then, if providers.kubernetesCRD.ingressClass is left empty, it is expected that IngressRoute without ingressClassName annotations will be processed by traefik.

To reproduce,

  • Create a IngressRoute without ingressClassName annotations

What did you see instead?

  • no route is created in traefik

What version of Traefik are you using?

Version: 2.5.4
Codename: livarot
Go version: go1.17.3
Built: 2021-11-08T17:41:41Z
OS/Arch: linux/arm64

What is your environment & configuration?

        - --global.checknewversion
        - --entryPoints.metrics.address=:9100/tcp
        - --entryPoints.traefik.address=:9000/tcp
        - --entryPoints.web.address=:8000/tcp
        - --entryPoints.websecure.address=:8443/tcp
        - --api.dashboard=true
        - --ping=true
        - --metrics.prometheus=true
        - --metrics.prometheus.entrypoint=metrics
        - --providers.kubernetescrd
        - --providers.kubernetescrd.allowCrossNamespace=true
        - --providers.kubernetescrd.allowExternalNameServices=true
        - --providers.kubernetesingress
        - --providers.kubernetesingress.ingressendpoint.publishedservice=kube-system/traefik
        - --entrypoints.websecure.http.tls=true

I looked for the source code below.

It seems that it is implemented so that

If the parameter is set, only resource containing an annotation with the same values are processed. Otherwise, resources containing an annotation with traefik as the value is processed.

Should the documentation be updated to match the code, or is this an unexpected bug in Traefik that is causing it to behave incorrectly?

If applicable, please paste the log output in DEBUG level

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions