From cb6ea9ae9a9de5d1b23294f62be6f3dd52d3984f Mon Sep 17 00:00:00 2001 From: shlomiko Date: Wed, 9 Sep 2026 15:03:43 +0300 Subject: [PATCH 01/13] helm: split env values into server and telemetry scopes - replace the flat env block with a server scope (port, targetPort, protocol, requestPayloadLimit, responseCompressionEnabled) and a telemetry scope (logger, tracing) - rename logger keys to level and prettyPrint to match the config schema - add logger.opentelemetryOptions (enabled, url, resourceAttributes) exported as OPENTELEMETRY_LOGGING_ENABLED, OTLP_LOGGER_ENDPOINT_URL and OPENTELEMETRY_RESOURCE_ATTRIBUTES - remove the metrics values and helper, nothing consumed them - move global overrides under global.telemetry with the same hierarchy and replace the per-url helpers with a single telemetry.merged helper where chart values take precedence and global fills empty keys - reference $server / $telemetry via with blocks across the templates --- helm/templates/_helpers.tpl | 23 +++++---------------- helm/templates/configmap.yaml | 37 +++++++++++++++++++++------------- helm/templates/deployment.yaml | 11 +++++----- helm/templates/ingress.yaml | 3 ++- helm/templates/service.yaml | 7 ++++--- helm/values.yaml | 21 ++++++++++--------- 6 files changed, 52 insertions(+), 50 deletions(-) diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index da7d776c..fe3bedd9 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -96,23 +96,10 @@ Returns the cloud provider image pull secret name from global if exists or from {{- end -}} {{/* -Returns the tracing url from global if exists or from the chart's values +Returns the telemetry values merged with the global telemetry values. +Chart values take precedence; global fills in keys the chart leaves empty (false or empty string count as empty). +Usage: {{ $telemetry := include "ts-server-boilerplate.telemetry.merged" . | fromYaml }} */}} -{{- define "ts-server-boilerplate.tracingUrl" -}} -{{- if .Values.global.tracing.url }} - {{- .Values.global.tracing.url -}} -{{- else if .Values.cloudProvider -}} - {{- .Values.env.tracing.url -}} -{{- end -}} -{{- end -}} - -{{/* -Returns the tracing url from global if exists or from the chart's values -*/}} -{{- define "ts-server-boilerplate.metricsUrl" -}} -{{- if .Values.global.metrics.url }} - {{- .Values.global.metrics.url -}} -{{- else -}} - {{- .Values.env.metrics.url -}} -{{- end -}} +{{- define "ts-server-boilerplate.telemetry.merged" -}} +{{- merge (deepCopy .Values.telemetry) (.Values.global.telemetry | default dict) | toYaml -}} {{- end -}} diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml index 187f0138..71be9e19 100644 --- a/helm/templates/configmap.yaml +++ b/helm/templates/configmap.yaml @@ -1,26 +1,35 @@ -{{- $tracingUrl := include "ts-server-boilerplate.tracingUrl" . -}} -{{- $metricsUrl := include "ts-server-boilerplate.metricsUrl" . -}} +{{- $server := .Values.server -}} +{{- $telemetry := include "ts-server-boilerplate.telemetry.merged" . | fromYaml -}} {{- if .Values.enabled -}} apiVersion: v1 kind: ConfigMap metadata: name: {{ include "ts-server-boilerplate.fullname" . }} data: - REQUEST_PAYLOAD_LIMIT: {{ .Values.env.requestPayloadLimit | quote }} - RESPONSE_COMPRESSION_ENABLED: {{ .Values.env.responseCompressionEnabled | quote }} - LOG_LEVEL: {{ .Values.env.logLevel | quote }} - LOG_PRETTY_PRINT_ENABLED: {{ .Values.env.logPrettyPrintEnabled | quote }} - {{ if .Values.env.tracing.enabled }} + {{- with $server }} + REQUEST_PAYLOAD_LIMIT: {{ .requestPayloadLimit | quote }} + RESPONSE_COMPRESSION_ENABLED: {{ .responseCompressionEnabled | quote }} + {{- end }} + {{- with $telemetry }} + LOG_LEVEL: {{ .logger.level | quote }} + LOG_PRETTY_PRINT_ENABLED: {{ .logger.prettyPrint | quote }} + {{- with .logger.opentelemetryOptions }} + {{- if .enabled }} + OPENTELEMETRY_LOGGING_ENABLED: 'true' + OTLP_LOGGER_ENDPOINT_URL: {{ .url | quote }} + {{- if .resourceAttributes }} + OPENTELEMETRY_RESOURCE_ATTRIBUTES: {{ .resourceAttributes | toJson | quote }} + {{- end }} + {{- end }} + {{- end }} + {{- if .tracing.enabled }} TELEMETRY_TRACING_ENABLED: 'true' - TELEMETRY_TRACING_URL: {{ $tracingUrl }} - {{ end }} - {{ if .Values.env.metrics.enabled }} - TELEMETRY_METRICS_ENABLED: 'true' - TELEMETRY_METRICS_URL: {{ $metricsUrl }} - {{ end }} + TELEMETRY_TRACING_URL: {{ .tracing.url | quote }} + {{- end }} + {{- end }} npm_config_cache: /tmp/ {{- with .Values.configManagement }} - CONFIG_NAME: {{ .name| quote }} + CONFIG_NAME: {{ .name | quote }} CONFIG_VERSION: {{ .version | quote }} CONFIG_OFFLINE_MODE: {{ .offlineMode | quote }} CONFIG_SERVER_URL: {{ .serverUrl | quote }} diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index 862cff4b..29e8beee 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -4,6 +4,7 @@ {{- $cloudProviderDockerRegistryUrl := include "ts-server-boilerplate.cloudProviderDockerRegistryUrl" . -}} {{- $cloudProviderImagePullSecretName := include "ts-server-boilerplate.cloudProviderImagePullSecretName" . -}} {{- $imageTag := include "ts-server-boilerplate.tag" . -}} +{{- $server := .Values.server -}} {{- if .Values.enabled -}} apiVersion: apps/v1 kind: Deployment @@ -72,7 +73,7 @@ spec: fieldRef: fieldPath: metadata.uid - name: SERVER_PORT - value: {{ .Values.env.targetPort | quote }} + value: {{ $server.targetPort | quote }} {{- if .Values.caSecretName }} - name: REQUESTS_CA_BUNDLE value: {{ printf "%s/%s" .Values.caPath .Values.caKey | quote }} @@ -87,8 +88,8 @@ spec: name: {{ include "ts-server-boilerplate.fullname" . }} ports: - name: http - containerPort: {{ .Values.env.targetPort }} - protocol: {{ .Values.env.protocol }} + containerPort: {{ $server.targetPort }} + protocol: {{ $server.protocol }} {{- if .Values.livenessProbe.enabled }} livenessProbe: initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} @@ -96,7 +97,7 @@ spec: failureThreshold: {{ .Values.livenessProbe.failureThreshold }} httpGet: path: {{ .Values.livenessProbe.path }} - port: {{ .Values.env.targetPort }} + port: {{ $server.targetPort }} {{- end }} {{- if .Values.readinessProbe.enabled }} readinessProbe: @@ -105,7 +106,7 @@ spec: failureThreshold: {{ .Values.readinessProbe.failureThreshold }} httpGet: path: {{ .Values.readinessProbe.path }} - port: {{ .Values.env.targetPort }} + port: {{ $server.targetPort }} {{- end }} {{- if .Values.resources.enabled }} resources: diff --git a/helm/templates/ingress.yaml b/helm/templates/ingress.yaml index 7a9c7ceb..67f2ecb2 100644 --- a/helm/templates/ingress.yaml +++ b/helm/templates/ingress.yaml @@ -1,7 +1,8 @@ {{- if and (.Values.enabled) (.Values.ingress.enabled) -}} {{- $fullName := include "ts-server-boilerplate.fullname" . -}} {{- $serviceName := $fullName -}} -{{- $servicePort := .Values.env.port -}} +{{- $server := .Values.server -}} +{{- $servicePort := $server.port -}} {{- $ingressPath := .Values.ingress.path -}} {{- $ingressPathType := default "Prefix" .Values.ingress.pathType -}} {{- $extraPaths := .Values.ingress.extraPaths -}} diff --git a/helm/templates/service.yaml b/helm/templates/service.yaml index f69c44cb..1e235e70 100644 --- a/helm/templates/service.yaml +++ b/helm/templates/service.yaml @@ -1,6 +1,7 @@ {{- $releaseName := .Release.Name -}} {{- $chartName := include "ts-server-boilerplate.name" . -}} {{- $cloudProviderFlavor := include "ts-server-boilerplate.cloudProviderFlavor" . -}} +{{- $server := .Values.server -}} {{- if .Values.enabled -}} apiVersion: v1 kind: Service @@ -16,9 +17,9 @@ spec: type: NodePort {{- end }} ports: - - port: {{ .Values.env.port }} - targetPort: {{ .Values.env.targetPort }} - protocol: {{ .Values.env.protocol }} + - port: {{ $server.port }} + targetPort: {{ $server.targetPort }} + protocol: {{ $server.protocol }} name: http {{- if eq $cloudProviderFlavor "minikube" }} nodePort: {{ .Values.nodePort }} diff --git a/helm/values.yaml b/helm/values.yaml index e7d34d90..d297ec63 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -1,7 +1,6 @@ global: cloudProvider: {} - tracing: {} - metrics: {} + telemetry: {} mclabels: component: backend @@ -69,20 +68,24 @@ image: # tag: 'latest' pullPolicy: IfNotPresent -env: +server: port: 8080 targetPort: 8080 protocol: TCP - logLevel: info - logPrettyPrintEnabled: false responseCompressionEnabled: true requestPayloadLimit: 1mb + +telemetry: + logger: + level: info + prettyPrint: false + opentelemetryOptions: + enabled: true + url: http://localhost:4317 + resourceAttributes: {} tracing: - enabled: false + enabled: true url: http://localhost:55681/v1/trace - metrics: - enabled: false - url: http://localhost:55681/v1/metrics resources: enabled: true From c880792d13ee5e7f26d6223dba777a9bb21d3a18 Mon Sep 17 00:00:00 2001 From: shlomiko Date: Wed, 9 Sep 2026 15:14:23 +0300 Subject: [PATCH 02/13] helm: reference Values.server.port directly in ingress --- helm/templates/ingress.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/helm/templates/ingress.yaml b/helm/templates/ingress.yaml index 67f2ecb2..a4ef6130 100644 --- a/helm/templates/ingress.yaml +++ b/helm/templates/ingress.yaml @@ -1,8 +1,7 @@ {{- if and (.Values.enabled) (.Values.ingress.enabled) -}} {{- $fullName := include "ts-server-boilerplate.fullname" . -}} {{- $serviceName := $fullName -}} -{{- $server := .Values.server -}} -{{- $servicePort := $server.port -}} +{{- $servicePort := .Values.server.port -}} {{- $ingressPath := .Values.ingress.path -}} {{- $ingressPathType := default "Prefix" .Values.ingress.pathType -}} {{- $extraPaths := .Values.ingress.extraPaths -}} From 7e110e318da94c045bb2cbd3a1c4accb4e3e9be1 Mon Sep 17 00:00:00 2001 From: shlomiko Date: Wed, 9 Sep 2026 15:37:21 +0300 Subject: [PATCH 03/13] helm: leave telemetry urls unset so global values apply --- helm/values.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/values.yaml b/helm/values.yaml index d297ec63..ff32c9ea 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -81,11 +81,11 @@ telemetry: prettyPrint: false opentelemetryOptions: enabled: true - url: http://localhost:4317 + # url: http://localhost:4317 resourceAttributes: {} tracing: enabled: true - url: http://localhost:55681/v1/trace + # url: http://localhost:55681/v1/trace resources: enabled: true From c57262cd016d86fa557f69ce9ddbf49c3a9db5c3 Mon Sep 17 00:00:00 2001 From: shlomiko Date: Wed, 9 Sep 2026 15:57:14 +0300 Subject: [PATCH 04/13] helm: fall back to default telemetry urls when chart and global leave them unset --- helm/templates/_helpers.tpl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index fe3bedd9..e5a3a546 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -96,10 +96,15 @@ Returns the cloud provider image pull secret name from global if exists or from {{- end -}} {{/* -Returns the telemetry values merged with the global telemetry values. -Chart values take precedence; global fills in keys the chart leaves empty (false or empty string count as empty). +Returns the telemetry values merged with the global telemetry values and the chart defaults. +Precedence: chart values, then global values, then the defaults below. +Empty values (false or empty string) count as unset and fall through to the next layer. Usage: {{ $telemetry := include "ts-server-boilerplate.telemetry.merged" . | fromYaml }} */}} {{- define "ts-server-boilerplate.telemetry.merged" -}} -{{- merge (deepCopy .Values.telemetry) (.Values.global.telemetry | default dict) | toYaml -}} +{{- $defaults := dict + "logger" (dict "opentelemetryOptions" (dict "url" "http://localhost:4317")) + "tracing" (dict "url" "http://localhost:55681/v1/trace") +-}} +{{- merge (deepCopy .Values.telemetry) (.Values.global.telemetry | default dict) $defaults | toYaml -}} {{- end -}} From 6d8bce9b083abaed2d5fa26b0a772637b39a5e6c Mon Sep 17 00:00:00 2001 From: shlomiko Date: Wed, 9 Sep 2026 15:58:42 +0300 Subject: [PATCH 05/13] Revert "helm: fall back to default telemetry urls when chart and global leave them unset" This reverts commit c57262cd016d86fa557f69ce9ddbf49c3a9db5c3. --- helm/templates/_helpers.tpl | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index e5a3a546..fe3bedd9 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -96,15 +96,10 @@ Returns the cloud provider image pull secret name from global if exists or from {{- end -}} {{/* -Returns the telemetry values merged with the global telemetry values and the chart defaults. -Precedence: chart values, then global values, then the defaults below. -Empty values (false or empty string) count as unset and fall through to the next layer. +Returns the telemetry values merged with the global telemetry values. +Chart values take precedence; global fills in keys the chart leaves empty (false or empty string count as empty). Usage: {{ $telemetry := include "ts-server-boilerplate.telemetry.merged" . | fromYaml }} */}} {{- define "ts-server-boilerplate.telemetry.merged" -}} -{{- $defaults := dict - "logger" (dict "opentelemetryOptions" (dict "url" "http://localhost:4317")) - "tracing" (dict "url" "http://localhost:55681/v1/trace") --}} -{{- merge (deepCopy .Values.telemetry) (.Values.global.telemetry | default dict) $defaults | toYaml -}} +{{- merge (deepCopy .Values.telemetry) (.Values.global.telemetry | default dict) | toYaml -}} {{- end -}} From c18ea31ed75f6b5e8aaf3f4aa7597d3586b273a1 Mon Sep 17 00:00:00 2001 From: shlomiko Date: Wed, 9 Sep 2026 16:00:25 +0300 Subject: [PATCH 06/13] helm: default telemetry urls in configmap when unset --- helm/templates/configmap.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml index 71be9e19..067f47e1 100644 --- a/helm/templates/configmap.yaml +++ b/helm/templates/configmap.yaml @@ -16,7 +16,7 @@ data: {{- with .logger.opentelemetryOptions }} {{- if .enabled }} OPENTELEMETRY_LOGGING_ENABLED: 'true' - OTLP_LOGGER_ENDPOINT_URL: {{ .url | quote }} + OTLP_LOGGER_ENDPOINT_URL: {{ .url | default "http://localhost:4317" | quote }} {{- if .resourceAttributes }} OPENTELEMETRY_RESOURCE_ATTRIBUTES: {{ .resourceAttributes | toJson | quote }} {{- end }} @@ -24,7 +24,7 @@ data: {{- end }} {{- if .tracing.enabled }} TELEMETRY_TRACING_ENABLED: 'true' - TELEMETRY_TRACING_URL: {{ .tracing.url | quote }} + TELEMETRY_TRACING_URL: {{ .tracing.url | default "http://localhost:55681/v1/trace" | quote }} {{- end }} {{- end }} npm_config_cache: /tmp/ From fc23a358a119845ff4970258aee09ded7edfdb12 Mon Sep 17 00:00:00 2001 From: shlomiko Date: Thu, 10 Sep 2026 09:29:11 +0300 Subject: [PATCH 07/13] helm: global telemetry urls take precedence over chart values Replace the whole-telemetry merge helper with two url helpers, tracingUrl and opentelemetryLoggingUrl. Each returns the global url when set, otherwise the chart url, and nothing when neither is set so the configmap default applies. Only the urls are overridable from global; enabled flags and the rest stay chart-level. --- helm/templates/_helpers.tpl | 23 ++++++++++++++++++----- helm/templates/configmap.yaml | 8 +++++--- helm/values.yaml | 5 ++++- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index fe3bedd9..ca6ba72b 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -96,10 +96,23 @@ Returns the cloud provider image pull secret name from global if exists or from {{- end -}} {{/* -Returns the telemetry values merged with the global telemetry values. -Chart values take precedence; global fills in keys the chart leaves empty (false or empty string count as empty). -Usage: {{ $telemetry := include "ts-server-boilerplate.telemetry.merged" . | fromYaml }} +Returns the tracing url from global if set, otherwise from the chart's values */}} -{{- define "ts-server-boilerplate.telemetry.merged" -}} -{{- merge (deepCopy .Values.telemetry) (.Values.global.telemetry | default dict) | toYaml -}} +{{- define "ts-server-boilerplate.tracingUrl" -}} +{{- if .Values.global.telemetry.tracing.url }} + {{- .Values.global.telemetry.tracing.url -}} +{{- else if .Values.telemetry.tracing.url -}} + {{- .Values.telemetry.tracing.url -}} +{{- end -}} +{{- end -}} + +{{/* +Returns the opentelemetry logging url from global if set, otherwise from the chart's values +*/}} +{{- define "ts-server-boilerplate.opentelemetryLoggingUrl" -}} +{{- if .Values.global.telemetry.logger.opentelemetryOptions.url }} + {{- .Values.global.telemetry.logger.opentelemetryOptions.url -}} +{{- else if .Values.telemetry.logger.opentelemetryOptions.url -}} + {{- .Values.telemetry.logger.opentelemetryOptions.url -}} +{{- end -}} {{- end -}} diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml index 067f47e1..fdc40551 100644 --- a/helm/templates/configmap.yaml +++ b/helm/templates/configmap.yaml @@ -1,5 +1,7 @@ {{- $server := .Values.server -}} -{{- $telemetry := include "ts-server-boilerplate.telemetry.merged" . | fromYaml -}} +{{- $telemetry := .Values.telemetry -}} +{{- $tracingUrl := include "ts-server-boilerplate.tracingUrl" . -}} +{{- $opentelemetryLoggingUrl := include "ts-server-boilerplate.opentelemetryLoggingUrl" . -}} {{- if .Values.enabled -}} apiVersion: v1 kind: ConfigMap @@ -16,7 +18,7 @@ data: {{- with .logger.opentelemetryOptions }} {{- if .enabled }} OPENTELEMETRY_LOGGING_ENABLED: 'true' - OTLP_LOGGER_ENDPOINT_URL: {{ .url | default "http://localhost:4317" | quote }} + OTLP_LOGGER_ENDPOINT_URL: {{ $opentelemetryLoggingUrl | default "http://localhost:4317" | quote }} {{- if .resourceAttributes }} OPENTELEMETRY_RESOURCE_ATTRIBUTES: {{ .resourceAttributes | toJson | quote }} {{- end }} @@ -24,7 +26,7 @@ data: {{- end }} {{- if .tracing.enabled }} TELEMETRY_TRACING_ENABLED: 'true' - TELEMETRY_TRACING_URL: {{ .tracing.url | default "http://localhost:55681/v1/trace" | quote }} + TELEMETRY_TRACING_URL: {{ $tracingUrl | default "http://localhost:55681/v1/trace" | quote }} {{- end }} {{- end }} npm_config_cache: /tmp/ diff --git a/helm/values.yaml b/helm/values.yaml index ff32c9ea..c9c4cdaf 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -1,6 +1,9 @@ global: cloudProvider: {} - telemetry: {} + telemetry: + tracing: {} + logger: + opentelemetryOptions: {} mclabels: component: backend From 6a5ba77fae6951b94b2ff91c3dd8d5c81ef29f80 Mon Sep 17 00:00:00 2001 From: shlomiko Date: Thu, 10 Sep 2026 09:32:27 +0300 Subject: [PATCH 08/13] helm: keep default telemetry urls in values instead of the configmap --- helm/templates/configmap.yaml | 4 ++-- helm/values.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml index fdc40551..75601657 100644 --- a/helm/templates/configmap.yaml +++ b/helm/templates/configmap.yaml @@ -18,7 +18,7 @@ data: {{- with .logger.opentelemetryOptions }} {{- if .enabled }} OPENTELEMETRY_LOGGING_ENABLED: 'true' - OTLP_LOGGER_ENDPOINT_URL: {{ $opentelemetryLoggingUrl | default "http://localhost:4317" | quote }} + OTLP_LOGGER_ENDPOINT_URL: {{ $opentelemetryLoggingUrl | quote }} {{- if .resourceAttributes }} OPENTELEMETRY_RESOURCE_ATTRIBUTES: {{ .resourceAttributes | toJson | quote }} {{- end }} @@ -26,7 +26,7 @@ data: {{- end }} {{- if .tracing.enabled }} TELEMETRY_TRACING_ENABLED: 'true' - TELEMETRY_TRACING_URL: {{ $tracingUrl | default "http://localhost:55681/v1/trace" | quote }} + TELEMETRY_TRACING_URL: {{ $tracingUrl | quote }} {{- end }} {{- end }} npm_config_cache: /tmp/ diff --git a/helm/values.yaml b/helm/values.yaml index c9c4cdaf..dfb81a40 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -84,11 +84,11 @@ telemetry: prettyPrint: false opentelemetryOptions: enabled: true - # url: http://localhost:4317 + url: http://localhost:4317 resourceAttributes: {} tracing: enabled: true - # url: http://localhost:55681/v1/trace + url: http://localhost:55681/v1/trace resources: enabled: true From a206337f2b0611219e7dd416dc69c5878e338789 Mon Sep 17 00:00:00 2001 From: shlomiko Date: Thu, 10 Sep 2026 09:45:35 +0300 Subject: [PATCH 09/13] helm: export resource attributes as OTEL_RESOURCE_ATTRIBUTES Use the standard OpenTelemetry env var name and its key=value,key=value format instead of a JSON string so the SDK parses it. --- helm/templates/configmap.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml index 75601657..ab9d6403 100644 --- a/helm/templates/configmap.yaml +++ b/helm/templates/configmap.yaml @@ -20,7 +20,11 @@ data: OPENTELEMETRY_LOGGING_ENABLED: 'true' OTLP_LOGGER_ENDPOINT_URL: {{ $opentelemetryLoggingUrl | quote }} {{- if .resourceAttributes }} - OPENTELEMETRY_RESOURCE_ATTRIBUTES: {{ .resourceAttributes | toJson | quote }} + {{- $attributes := list }} + {{- range $key, $value := .resourceAttributes }} + {{- $attributes = append $attributes (printf "%s=%s" $key (toString $value)) }} + {{- end }} + OTEL_RESOURCE_ATTRIBUTES: {{ join "," $attributes | quote }} {{- end }} {{- end }} {{- end }} From 31c3a08a11378ae744e4eb2b9e2d0204e9fd90c4 Mon Sep 17 00:00:00 2001 From: shlomiko Date: Thu, 10 Sep 2026 09:47:17 +0300 Subject: [PATCH 10/13] helm: document resourceAttributes with a commented example --- helm/values.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/helm/values.yaml b/helm/values.yaml index dfb81a40..2ab44943 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -85,7 +85,11 @@ telemetry: opentelemetryOptions: enabled: true url: http://localhost:4317 + # Rendered as OTEL_RESOURCE_ATTRIBUTES in key=value,key=value format resourceAttributes: {} + # resourceAttributes: + # service.namespace: raster + # deployment.environment: dev tracing: enabled: true url: http://localhost:55681/v1/trace From 80b43c942099cac9f4df6dfdc3e31a4e1356ad52 Mon Sep 17 00:00:00 2001 From: shlomiko Date: Thu, 10 Sep 2026 09:49:13 +0300 Subject: [PATCH 11/13] helm: move resource attributes formatting into a helper --- helm/templates/_helpers.tpl | 13 +++++++++++++ helm/templates/configmap.yaml | 6 +----- helm/values.yaml | 3 +-- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index ca6ba72b..82d58abf 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -116,3 +116,16 @@ Returns the opentelemetry logging url from global if set, otherwise from the cha {{- .Values.telemetry.logger.opentelemetryOptions.url -}} {{- end -}} {{- end -}} + +{{/* +Renders a map of resource attributes as key=value,key=value for OTEL_RESOURCE_ATTRIBUTES. +Usage: {{ include "ts-server-boilerplate.resourceAttributes" .resourceAttributes }} +*/}} +{{- define "ts-server-boilerplate.resourceAttributes" -}} +{{- $attributes := list }} +{{- range $key, $value := . }} +{{- $attributes = append $attributes (printf "%s=%s" $key (toString $value)) }} +{{- end }} +{{- join "," $attributes }} +{{- end -}} + diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml index ab9d6403..94b278db 100644 --- a/helm/templates/configmap.yaml +++ b/helm/templates/configmap.yaml @@ -20,11 +20,7 @@ data: OPENTELEMETRY_LOGGING_ENABLED: 'true' OTLP_LOGGER_ENDPOINT_URL: {{ $opentelemetryLoggingUrl | quote }} {{- if .resourceAttributes }} - {{- $attributes := list }} - {{- range $key, $value := .resourceAttributes }} - {{- $attributes = append $attributes (printf "%s=%s" $key (toString $value)) }} - {{- end }} - OTEL_RESOURCE_ATTRIBUTES: {{ join "," $attributes | quote }} + OTEL_RESOURCE_ATTRIBUTES: {{ include "ts-server-boilerplate.resourceAttributes" .resourceAttributes | quote }} {{- end }} {{- end }} {{- end }} diff --git a/helm/values.yaml b/helm/values.yaml index 2ab44943..13afc658 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -86,9 +86,8 @@ telemetry: enabled: true url: http://localhost:4317 # Rendered as OTEL_RESOURCE_ATTRIBUTES in key=value,key=value format - resourceAttributes: {} # resourceAttributes: - # service.namespace: raster + # service.namespace: namespace # deployment.environment: dev tracing: enabled: true From b6e8d0addaac43dd2fc2e8c9f96d559fbaf331e0 Mon Sep 17 00:00:00 2001 From: shlomiko Date: Thu, 10 Sep 2026 09:54:02 +0300 Subject: [PATCH 12/13] helm: clarify resourceAttributes format comment --- helm/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helm/values.yaml b/helm/values.yaml index 13afc658..f9827295 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -85,7 +85,7 @@ telemetry: opentelemetryOptions: enabled: true url: http://localhost:4317 - # Rendered as OTEL_RESOURCE_ATTRIBUTES in key=value,key=value format + # Rendered as OTEL_RESOURCE_ATTRIBUTES in "key=value,key=value" format # resourceAttributes: # service.namespace: namespace # deployment.environment: dev From 68808b4fa9b2984e43b33d6829ac98cecfbeaef5 Mon Sep 17 00:00:00 2001 From: shlomiko Date: Thu, 10 Sep 2026 09:54:58 +0300 Subject: [PATCH 13/13] helm: rename resource attributes helper to otelResourceAttributes --- helm/templates/_helpers.tpl | 4 ++-- helm/templates/configmap.yaml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/helm/templates/_helpers.tpl b/helm/templates/_helpers.tpl index 82d58abf..6e7aafa7 100644 --- a/helm/templates/_helpers.tpl +++ b/helm/templates/_helpers.tpl @@ -119,9 +119,9 @@ Returns the opentelemetry logging url from global if set, otherwise from the cha {{/* Renders a map of resource attributes as key=value,key=value for OTEL_RESOURCE_ATTRIBUTES. -Usage: {{ include "ts-server-boilerplate.resourceAttributes" .resourceAttributes }} +Usage: {{ include "ts-server-boilerplate.otelResourceAttributes" .resourceAttributes }} */}} -{{- define "ts-server-boilerplate.resourceAttributes" -}} +{{- define "ts-server-boilerplate.otelResourceAttributes" -}} {{- $attributes := list }} {{- range $key, $value := . }} {{- $attributes = append $attributes (printf "%s=%s" $key (toString $value)) }} diff --git a/helm/templates/configmap.yaml b/helm/templates/configmap.yaml index 94b278db..0cd9c614 100644 --- a/helm/templates/configmap.yaml +++ b/helm/templates/configmap.yaml @@ -20,7 +20,7 @@ data: OPENTELEMETRY_LOGGING_ENABLED: 'true' OTLP_LOGGER_ENDPOINT_URL: {{ $opentelemetryLoggingUrl | quote }} {{- if .resourceAttributes }} - OTEL_RESOURCE_ATTRIBUTES: {{ include "ts-server-boilerplate.resourceAttributes" .resourceAttributes | quote }} + OTEL_RESOURCE_ATTRIBUTES: {{ include "ts-server-boilerplate.otelResourceAttributes" .resourceAttributes | quote }} {{- end }} {{- end }} {{- end }}