From 1c4670674732c51e115f4de99becb2b7d624ce3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20BUISSON?= Date: Wed, 29 Jan 2025 09:12:13 +0100 Subject: [PATCH 1/2] fix: :bug: hub version not handling main builds --- traefik/templates/requirements.yaml | 9 ++++++++- traefik/tests/requirements-config_test.yaml | 16 ++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/traefik/templates/requirements.yaml b/traefik/templates/requirements.yaml index 85bd8acb9..c3872a98f 100644 --- a/traefik/templates/requirements.yaml +++ b/traefik/templates/requirements.yaml @@ -54,7 +54,14 @@ {{ fail "When using Traefik Hub image tag needs to be specified !" }} {{- end -}} - {{ $hubVersion := (split "@" (default "v3" $.Values.image.tag))._0 | replace "latest-" "" }} + {{ $hubVersion := (split "@" (default "v3" $.Values.image.tag))._0 }} + + {{/* + Consider non semver versions as latest one + */}} + {{- if not (regexMatch "v[0-9]+.[0-9]+.[0-9]+" (default "" $.Values.image.tag)) -}} + {{ $hubVersion = "v3.99" }} + {{- end }} {{- if and (semverCompare "= v3.9.0."}} diff --git a/traefik/tests/requirements-config_test.yaml b/traefik/tests/requirements-config_test.yaml index bf69f51de..aded9f7d5 100644 --- a/traefik/tests/requirements-config_test.yaml +++ b/traefik/tests/requirements-config_test.yaml @@ -180,3 +180,19 @@ tests: asserts: - failedTemplate: errorMessage: "ERROR: additionalTraceHeaders needs tracing.otlp to be enabled." + - it: should not fail when using hub.tracing.additionalTraceHeaders on Traefik Hub main builds + set: + image: + registry: "ghcr.io" + repository: "traefik/traefik-hub" + tag: main-1af57d3-1737730202 + tracing: + otlp: + enabled: true + hub: + token: "xxx" + tracing: + additionalTraceHeaders: + enabled: true + asserts: + - notFailedTemplate: {} From b3e4a934567370645a4f1abd4ee80dc496a43daa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20BUISSON?= Date: Fri, 31 Jan 2025 09:02:52 +0100 Subject: [PATCH 2/2] fix: apply suggestions from @mloiseleur's code review Co-authored-by: Michel Loiseleur <97035654+mloiseleur@users.noreply.github.com> --- traefik/tests/requirements-config_test.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/traefik/tests/requirements-config_test.yaml b/traefik/tests/requirements-config_test.yaml index aded9f7d5..6ed71a9c7 100644 --- a/traefik/tests/requirements-config_test.yaml +++ b/traefik/tests/requirements-config_test.yaml @@ -196,3 +196,19 @@ tests: enabled: true asserts: - notFailedTemplate: {} + - it: should not fail when using hub.tracing.additionalTraceHeaders on Traefik Hub latest v3 builds + set: + image: + registry: "ghcr.io" + repository: "traefik/traefik-hub" + tag: latest-v3 + tracing: + otlp: + enabled: true + hub: + token: "xxx" + tracing: + additionalTraceHeaders: + enabled: true + asserts: + - notFailedTemplate: {}