diff --git a/traefik/Chart.yaml b/traefik/Chart.yaml index d48ffc86c..fd21d903b 100644 --- a/traefik/Chart.yaml +++ b/traefik/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: traefik description: A Traefik based Kubernetes ingress controller type: application -version: 9.15.2 +version: 9.15.3 appVersion: 2.4.6 keywords: - traefik diff --git a/traefik/templates/_helpers.tpl b/traefik/templates/_helpers.tpl index 4cc3a8cf8..a517711db 100644 --- a/traefik/templates/_helpers.tpl +++ b/traefik/templates/_helpers.tpl @@ -7,6 +7,18 @@ Expand the name of the chart. {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{- define "traefik.hasingressclass" -}} +{{- if eq .Values.image.tag "latest" -}} +true +{{- else -}} +{{- if semverCompare ">=2.3.0" (default .Chart.AppVersion .Values.image.tag) -}} +true +{{- else -}} +false +{{- end -}} +{{- end -}} +{{- end -}} + {{/* Create chart name and version as used by the chart label. */}} @@ -59,4 +71,4 @@ Construct a comma-separated list of whitelisted namespaces {{- end -}} {{- define "providers.kubernetesCRD.namespaces" -}} {{- default .Release.Namespace (join "," .Values.providers.kubernetesCRD.namespaces) }} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/traefik/templates/ingressclass.yaml b/traefik/templates/ingressclass.yaml index f2c6e9ecf..bb405c647 100644 --- a/traefik/templates/ingressclass.yaml +++ b/traefik/templates/ingressclass.yaml @@ -1,4 +1,5 @@ -{{- if and .Values.ingressClass.enabled (semverCompare ">=2.3.0" (default .Chart.AppVersion .Values.image.tag)) -}} +{{- $hasigclass := "traefik.hasingressclass" }} +{{- if and .Values.ingressClass.enabled (eq $hasigclass "true") -}} {{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1/IngressClass" }} apiVersion: networking.k8s.io/v1 {{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1/IngressClass" }}