Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions helm/kagent/templates/controller-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,30 @@ data:
OTEL_EXPORTER_OTLP_LOGS_TIMEOUT: {{ .Values.otel.logging.exporter.otlp.timeout | quote }}
{{- end }}
{{- end }}
{{- if .Values.otel.tracing.exporter.otlp.headers }}
{{- $traceHeaders := list }}
{{- range $k := keys .Values.otel.tracing.exporter.otlp.headers | sortAlpha }}
{{- $traceHeaders = append $traceHeaders (printf "%s=%s" $k (index $.Values.otel.tracing.exporter.otlp.headers $k | toString)) }}
{{- end }}
OTEL_EXPORTER_OTLP_TRACES_HEADERS: {{ join "," $traceHeaders | quote }}
{{- end }}
{{- if .Values.otel.logging.exporter.otlp.headers }}
{{- $logHeaders := list }}
{{- range $k := keys .Values.otel.logging.exporter.otlp.headers | sortAlpha }}
{{- $logHeaders = append $logHeaders (printf "%s=%s" $k (index $.Values.otel.logging.exporter.otlp.headers $k | toString)) }}
{{- end }}
OTEL_EXPORTER_OTLP_LOGS_HEADERS: {{ join "," $logHeaders | quote }}
{{- end }}
{{- if .Values.otel.serviceName }}
OTEL_SERVICE_NAME: {{ .Values.otel.serviceName | quote }}
{{- end }}
{{- if .Values.otel.resourceAttributes }}
{{- $resourceAttrs := list }}
{{- range $k := keys .Values.otel.resourceAttributes | sortAlpha }}
{{- $resourceAttrs = append $resourceAttrs (printf "%s=%s" $k (index $.Values.otel.resourceAttributes $k | toString)) }}
{{- end }}
OTEL_RESOURCE_ATTRIBUTES: {{ join "," $resourceAttrs | quote }}
{{- end }}
{{- if .Values.proxy.url }}
PROXY_URL: {{ .Values.proxy.url | quote }}
{{- end }}
Expand Down
57 changes: 57 additions & 0 deletions helm/kagent/tests/controller-deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,63 @@ tests:
path: data.A2A_BASE_URL
value: "https://kagent.example.com"

- it: should not set optional OTEL env vars by default
template: controller-configmap.yaml
asserts:
- notExists:
path: data.OTEL_SERVICE_NAME
- notExists:
path: data.OTEL_RESOURCE_ATTRIBUTES
- notExists:
path: data.OTEL_EXPORTER_OTLP_TRACES_HEADERS
- notExists:
path: data.OTEL_EXPORTER_OTLP_LOGS_HEADERS

- it: should set OTEL_SERVICE_NAME when configured
template: controller-configmap.yaml
set:
otel:
serviceName: "kagent-controller-prod"
asserts:
- equal:
path: data.OTEL_SERVICE_NAME
value: "kagent-controller-prod"

- it: should render OTEL_RESOURCE_ATTRIBUTES as sorted key=value pairs
template: controller-configmap.yaml
set:
otel:
resourceAttributes:
service.namespace: kagent
deployment.environment: production
asserts:
- equal:
path: data.OTEL_RESOURCE_ATTRIBUTES
value: "deployment.environment=production,service.namespace=kagent"

- it: should render OTLP traces and logs headers as sorted key=value pairs
template: controller-configmap.yaml
set:
otel:
tracing:
exporter:
otlp:
headers:
x-honeycomb-team: trace-key
x-honeycomb-dataset: kagent
logging:
exporter:
otlp:
headers:
authorization: "Basic bG9ncw=="
asserts:
- equal:
path: data.OTEL_EXPORTER_OTLP_TRACES_HEADERS
value: "x-honeycomb-dataset=kagent,x-honeycomb-team=trace-key"
- equal:
path: data.OTEL_EXPORTER_OTLP_LOGS_HEADERS
value: "authorization=Basic bG9ncw=="

- it: should set PROXY_URL when set
template: controller-configmap.yaml
set:
Expand Down
12 changes: 12 additions & 0 deletions helm/kagent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -917,6 +917,13 @@ oauth2-proxy:
# ==============================================================================

otel:
# -- Logical service name reported to the OTLP backend, rendered as OTEL_SERVICE_NAME.
# @default -- "" (SDK default)
serviceName: ""
# -- Additional OpenTelemetry resource attributes, rendered as a comma-joined
# key=value list in OTEL_RESOURCE_ATTRIBUTES.
# Example: { deployment.environment: production, service.namespace: kagent }
resourceAttributes: {}
tracing:
enabled: false
exporter:
Expand All @@ -925,6 +932,11 @@ otel:
protocol: "grpc"
timeout: 15000 # milliseconds
insecure: true
# -- Headers sent with OTLP trace export requests, rendered as a comma-joined
# key=value list in OTEL_EXPORTER_OTLP_TRACES_HEADERS.
# Values land in a ConfigMap in plain text: for secrets (API keys, tokens),
# inject the env var from a Secret via controller.env / envFrom instead.
headers: {}
logging:
enabled: false
exporter:
Expand Down
Loading