traefik-helm-chart
traefik-helm-chart copied to clipboard
Cannot use IngressClass stanza - set to `nil` causing comparison error
Welcome!
- [X] Yes, I've searched similar issues on GitHub and didn't find any.
- [X] Yes, I've searched similar issues on the Traefik community forum and didn't find any.
What version of the Traefik's Helm Chart are you using?
10.1.2
What version of Traefik are you using?
2.4.13
What did you do?
When attempting to use the chart with ingressClass.enabled=true
templating will fail as fallbackApiVersion
is a key with no value, making it nil
- when helm tries to compare the nil
to the string values here it fails:
https://github.com/traefik/traefik-helm-chart/blob/f1696abb2ab346d6cf40154b89297211c96ca3cb/traefik/templates/ingressclass.yaml#L6-L7
Definition of fallbackApiVersion
:
https://github.com/traefik/traefik-helm-chart/blob/f1696abb2ab346d6cf40154b89297211c96ca3cb/traefik/values.yaml#L67
Error seen:
helm.go:88: [debug] template: traefik-v2/charts/traefik/templates/ingressclass.yaml:6:18: executing "traefik-v2/charts/traefik/templates/ingressclass.yaml" at <eq .Values.ingressClass.fallbackApiVersion "v1beta1">: error calling eq: incompatible types for comparison
What did you see instead?
Definition of fallbackApiVersion
should be:
fallbackApiVersion: ""
What is your environment & configuration?
K8s 1.21.3
values.yaml:
traefik:
deployment:
replicas: 4
podDisruptionBudget:
enabled: true
minAvailable: 2
ingressClass:
enabled: true
isDefaultClass: true
pilot:
enabled: true
token: "xxxxxxxxxxxxxxxxx"
dashboard: true
ingressRoute:
dashboard:
enabled: true
annotations:
cert-manager.io/cluster-issuer: letsencrypt-staging
kubernetes.io/ingress.class: traefik
providers:
kubernetesIngress:
publishedService:
enabled: true
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- traefik
topologyKey: "kubernetes.io/hostname"
tolerations:
- effect: NoSchedule
key: node-role.kubernetes.io/master
Additional Information
No response
Indeed. Although if you were to add that fallbackApiVersion: ""
into your values file, you would still not enter that elsif clause currently causing an error. Only to end up on the final else
case, which should then tell you that You must have at least networking.k8s.io/v1beta1 to use ingressClass
With k8s 1.21, it's weird you did not enter the first if .Capabilities.APIVersions.Has "networking.k8s.io/v1/IngressClass"
.
As a workaround, you may set fallbackApiVersion
to v1
.
@faust64 yeah it confused me that 1.21.3 didn't fulfil the v1 API capability. I will try the workaround until the PR has merged in, thanks for the quick turnaround!
FYI, PR was merged yesterday. Can you confirm it solved your issue, @mylesagray ?
@faust64 I tested it out, didn't work - It was giving me a string not equal to "" error now - I manually overrode it to "v1" and it worked, but i'm not sure why it isn't picking up my API version from my 1.21.3 cluster - which does have v1.
Should the fallback always be set to v1beta1 as a last resort, rather than empty string?