From 474e106dd6b02030bf253c2ed20067f6fa0ad73a Mon Sep 17 00:00:00 2001 From: Andreas Gerstmayr Date: Tue, 5 Nov 2024 14:41:28 +0100 Subject: [PATCH] Do not add tracing CLI args to opa-openshift container (#1081) The opa-openshift container does not support `--internal.tracing.endpoint` and remains in a crashloop if ``` spec: observability: tracing: jaeger_agent_endpoint: ... sampling_fraction: "1" ``` is enabled. Signed-off-by: Andreas Gerstmayr --- .chloggen/internal_tracing.yaml | 16 ++++++++++++++++ internal/manifests/gateway/gateway.go | 7 +++++-- internal/manifests/gateway/gateway_test.go | 4 ++-- 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 .chloggen/internal_tracing.yaml diff --git a/.chloggen/internal_tracing.yaml b/.chloggen/internal_tracing.yaml new file mode 100644 index 000000000..593628228 --- /dev/null +++ b/.chloggen/internal_tracing.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 enabling `.spec.observability.tracing` with multi-tenancy on OpenShift + +# One or more tracking issues related to the change +issues: [1081] + +# (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.go b/internal/manifests/gateway/gateway.go index aff673e8a..2ca7c5fa7 100644 --- a/internal/manifests/gateway/gateway.go +++ b/internal/manifests/gateway/gateway.go @@ -376,8 +376,11 @@ func patchTracing(tempo v1alpha1.TempoStack, pod corev1.PodTemplateSpec) (corev1 } for i := range pod.Spec.Containers { - if err := mergo.Merge(&pod.Spec.Containers[i], container, mergo.WithAppendSlice); err != nil { - return corev1.PodTemplateSpec{}, err + // Only the observatorium-api container is instrumented with traces, not the opa-openshift container. + if pod.Spec.Containers[i].Name == containerNameTempoGateway { + if err := mergo.Merge(&pod.Spec.Containers[i], container, mergo.WithAppendSlice); err != nil { + return corev1.PodTemplateSpec{}, err + } } } diff --git a/internal/manifests/gateway/gateway_test.go b/internal/manifests/gateway/gateway_test.go index 3feca416b..1520c2165 100644 --- a/internal/manifests/gateway/gateway_test.go +++ b/internal/manifests/gateway/gateway_test.go @@ -298,7 +298,7 @@ func TestPatchTracing(t *testing.T) { Spec: corev1.PodSpec{ Containers: []corev1.Container{ { - Name: "first", + Name: containerNameTempoGateway, Args: []string{ "--abc", }, @@ -316,7 +316,7 @@ func TestPatchTracing(t *testing.T) { Spec: corev1.PodSpec{ Containers: []corev1.Container{ { - Name: "first", + Name: containerNameTempoGateway, Args: []string{ "--abc", "--internal.tracing.endpoint=agent:1234",