Skip to content

feat(helm): set the gateway's OTEL_* environment variables from chart values #4553

Open

Description

@krishicks

User Story

As an operator of OpenShell,
I want to set the gateway's OTEL_* environment variables through the Helm chart,
so that I don't have to patch the rendered StatefulSet to authenticate to my collector or tune export.

Problem Statement

The gateway reads the standard OpenTelemetry environment variables to tune OTLP export, for example:

  • OTEL_EXPORTER_OTLP_HEADERS and OTEL_EXPORTER_OTLP_LOGS_HEADERS for collector credentials. Supervisors also receive the OCSF headers.
  • OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG for sampling.
  • OTEL_RESOURCE_ATTRIBUTES for extra resource attributes, such as deployment.environment.
  • OTEL_EXPORTER_OTLP_COMPRESSION and OTEL_EXPORTER_OTLP_TIMEOUT for transport tuning.

The Helm chart has no way to add environment variables to the gateway container. A Helm deployment can't use any of these variables, so it can't send OCSF events to a collector that requires authentication.

Proposed Design

Let chart values add environment variables to the gateway container, including values read from a Kubernetes Secret, so that collector credentials don't appear in the values file.

server:
  otlp:
    endpoint: https://collector.example.com:4317
    env:
      - name: OTEL_TRACES_SAMPLER
        value: parentbased_traceidratio
      - name: OTEL_TRACES_SAMPLER_ARG
        value: "0.1"
      - name: OTEL_EXPORTER_OTLP_HEADERS
        valueFrom:
          secretKeyRef:
            name: otel-collector-auth
            key: headers

The exact values shape, whether it is OTLP-specific or a general extraEnv, is open.

Acceptance Criteria

  • Helm values can set environment variables on the gateway container, both literal values and values read from a Secret.
  • A Helm deployment can export OCSF events to a collector that requires an authorization header, and its supervisors receive the header.
  • The gateway configuration docs and the chart's values documentation describe the setting.

Related: #1055, #4499, #4544

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:clusterRelated to running OpenShell on k3s/dockertopic:observabilityLogging, metrics, and observability work

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions