From 903d0b4737f729ba432fb96462793a158a99b0c1 Mon Sep 17 00:00:00 2001 From: Pavol Loffay Date: Mon, 26 Aug 2024 18:40:15 +0200 Subject: [PATCH] Fix propagating annotations to Gateway route (#1014) * Fix propagating annotations to Gateway route Signed-off-by: Pavol Loffay * Changelog Signed-off-by: Pavol Loffay --------- Signed-off-by: Pavol Loffay --- .chloggen/fix-annotations-gateway-route.yaml | 16 ++++++++++++++++ internal/manifests/gateway/gateway_test.go | 4 ++++ internal/manifests/gateway/openshift.go | 7 ++++--- 3 files changed, 24 insertions(+), 3 deletions(-) create mode 100755 .chloggen/fix-annotations-gateway-route.yaml diff --git a/.chloggen/fix-annotations-gateway-route.yaml b/.chloggen/fix-annotations-gateway-route.yaml new file mode 100755 index 000000000..18f87d262 --- /dev/null +++ b/.chloggen/fix-annotations-gateway-route.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. tempostack, tempomonolithic, github action) +component: tempostack + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: Fix setting annotations for Gateway route + +# One or more tracking issues related to the change +issues: [1014] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/internal/manifests/gateway/gateway_test.go b/internal/manifests/gateway/gateway_test.go index 9bb800866..5439d07a7 100644 --- a/internal/manifests/gateway/gateway_test.go +++ b/internal/manifests/gateway/gateway_test.go @@ -158,6 +158,9 @@ func TestBuildGateway_openshift(t *testing.T) { Enabled: true, Ingress: v1alpha1.IngressSpec{ Type: v1alpha1.IngressTypeRoute, + Annotations: map[string]string{ + "timeout": "30s", + }, Route: v1alpha1.RouteSpec{ Termination: v1alpha1.TLSRouteTerminationTypePassthrough, }, @@ -246,6 +249,7 @@ func TestBuildGateway_openshift(t *testing.T) { require.True(t, ok) require.Equal(t, "Service", route.Spec.To.Kind) require.Equal(t, "tempo-simplest-gateway", route.Spec.To.Name) + require.Equal(t, map[string]string{"timeout": "30s"}, route.ObjectMeta.Annotations) obj = getObjectByTypeAndName(objects, "tempo-simplest-gateway-cabundle", reflect.TypeOf(&corev1.ConfigMap{})) require.NotNil(t, obj) diff --git a/internal/manifests/gateway/openshift.go b/internal/manifests/gateway/openshift.go index d72cd1151..858564042 100644 --- a/internal/manifests/gateway/openshift.go +++ b/internal/manifests/gateway/openshift.go @@ -113,9 +113,10 @@ func route(tempo v1alpha1.TempoStack) (*routev1.Route, error) { return &routev1.Route{ ObjectMeta: metav1.ObjectMeta{ - Name: naming.Name(manifestutils.GatewayComponentName, tempo.Name), - Namespace: tempo.Namespace, - Labels: labels, + Name: naming.Name(manifestutils.GatewayComponentName, tempo.Name), + Namespace: tempo.Namespace, + Labels: labels, + Annotations: tempo.Spec.Template.Gateway.Ingress.Annotations, }, Spec: routev1.RouteSpec{ Host: tempo.Spec.Template.Gateway.Ingress.Host,