Repository navigation
refactor: standardize environment settings and generate their reference - #2967
Merged
Merged
Conversation
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
EItanya
force-pushed
the
docs/env-reference
branch
from
September 27, 2026 14:24
ccdcf92 to
6ed23a7
Compare
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
6 tasks
alexdarbyshire
pushed a commit
to alexdarbyshire/kagent
that referenced
this pull request
Oct 5, 2026
…ce (kagent-dev#2967) Kagent-specific environment variables had inconsistent names, and the registry was missing settings used by the controller, CLI, runtimes, Python packages, and UI. This PR standardizes those names under `KAGENT_` and generates `docs/env.md` from the existing ENV registry. The reference covers 138 user-configurable settings; controller-owned payloads, generated credentials, and private runtime wiring are excluded. This is a direct pre-release rename. Custom deployment environments and local configuration need to use the new names, for example `LOG_LEVEL` → `KAGENT_LOG_LEVEL`, `POSTGRES_DATABASE_URL` → `KAGENT_POSTGRES_DATABASE_URL`, and the Go ADK's `PORT` → `KAGENT_PORT`. The old names are no longer read by kagent. Helm output, runtime injection, scripts, and examples use the new names. Upstream SDK and tool conventions such as `OTEL_*`, provider credentials, and `KUBECONFIG` stay unchanged. - `make env-docs` generates the reference through `kagent env`. `make env-docs-check` checks freshness without modifying it and runs in the existing `manifests-check` CI job. The workflow includes changes to `docs/env.md` while skipping other Markdown-only changes, with no additional job. Generation exports registered metadata, never values from the current process environment. - Registration functions accept multiple components so shared settings only need one registration. Filters match any listed component; JSON exports a `components` array instead of the previous `component` string. - Go controller, CLI, ADK, provider, logging, telemetry, E2E, and upgrade-test settings read through registered accessors. Telemetry rendering takes its environment names and protocol default from the same registry. `Get()` and `Lookup()` preserve component-specific defaults and precedence. Boolean/integer `LookupWithError()` preserves diagnostics for invalid migration and capture-limit settings. Go booleans accept `true`/`t`/`1` and `false`/`f`/`0` regardless of case or surrounding whitespace; upstream `OTEL_SDK_DISABLED` retains its true-only grammar. The Python ADK HTTP server uses shared `KAGENT_LOG_LEVEL`; the separate `UVICORN_LOG_LEVEL` override is removed. - The existing Go linter rejects direct `os.Getenv`/`os.LookupEnv` reads, including aliased imports and function references. E2E and upgrade tests are covered by the rule; unit tests may inspect process state directly. The registry itself and explained exceptions for generated payloads, credential placeholders, and the standalone BYO example remain allowed. - Both ADKs use `KAGENT_PORT` for A2A traffic. The controller supplies `80` once; Python's `KAGENT_A2A_GRPC_ADDRESS` is removed. Standalone defaults and explicit programmatic/CLI overrides are preserved, and Python's HTTP listener remains separately configured. - Chart-defined non-secret settings live in controller, UI, and bundled PostgreSQL ConfigMaps, loaded through `envFrom`. Pod-template checksums trigger rollouts when configuration changes. Credentials, downward-API values, values needing Kubernetes `$(...)` expansion, and explicit user env overrides stay in the Deployments. - Testing settings use `KAGENT_TEST_*` or `KAGENT_E2E_*`; UI settings use `KAGENT_UI_*`. UI containers and Vite consume the same names, including `KAGENT_UI_ENABLE_MOCK`. Browser configuration is limited to explicit UI settings, `KAGENT_UI_EXTENSION_*`, and build-time `KAGENT_UI_VITE_*` switches. Make targets, CI, Playwright, and local-development examples use the same prefixes. Upgrade tests also register their repository, version, registry, cluster, namespace, and context inputs under `KAGENT_E2E_*`; Make maps its existing build variables to those names. Existing empty-value fallbacks and true-only opt-in grammars are preserved. - Seven settings ignored by the controller are removed along with their Helm values and references. They covered authentication, gRPC TLS/message limits, and the default Substrate worker pool. The chart's MCP URL uses HTTP to match the controller listener. kagent-dev#2968 tracks restoring Helm-configured authentication end to end. - Image-digest lookups in CI and cluster setup consume the full Docker output. Exiting `awk` early can close the pipe while Docker is still writing and abort E2E setup under `pipefail`. Validation passed: - Focused Go tests for the registry, controller app, CLI/database commands, ADK app/A2A/agent/providers/embedding/tools, logging, telemetry, harness configuration, and translators; `make -C go lint` (zero issues). Coverage checks unset values, invalid input, capture limits, and boolean grammars. Negative lint probes verify that aliased direct reads and function references are rejected, including in E2E test files. Focused configuration tests cover E2E URL precedence, mock-host overrides, and upgrade defaults/context selection; Make dry runs verify that both upgrade targets pass the registered names. - `go build -mod=readonly` passes for the Go ADK, both harnesses, and sandbox guest. - Sandbox guest Docker builder passes for `linux/amd64` and `linux/arm64` with `-mod=readonly`. Its minimal source context includes the ENV package required by logging. - `make env-docs-check`, including checks that stale or missing docs fail and a failed generator preserves existing documentation. - Helm unit tests (369 tests) and chart lint. Before/after renders preserve effective container environments across default, custom, external-database, and database-file configurations; setting changes update rollout checksums. - Python CLI, A2A configuration, and gRPC tests, plus Ruff on changed Python files. A real gRPC connection verifies the shared port is consumed and explicit addresses take precedence. - UI typecheck, focused unit tests (42 tests), and lint (no errors). Vite and container-startup smoke checks verify prefixed settings reach the browser and unrelated environment values stay private. Playwright configuration checks verify the renamed ports and mock/live switches; Upgrade packages compile without running cluster tests. - Full E2E suite passed on a clean local Kind cluster using images built from this branch: 52 top-level tests, zero failures, and 10 existing subtest skips in 7m01s, with four concurrent scenarios and tracing required. This covers all four harnesses, CLI invocation, checkpoints, controller restarts, scheduled runs, runtime revision lifecycle, and sandbox workflows. The BYO fixture uses `KAGENT_PORT=80`; the old `PORT=80` left the runtime listening on 8080 while the gateway connected to 80. The interaction test reproduced that timeout before the fixture change and passed afterward. --------- Signed-off-by: Eitan Yarmush <eitan.yarmush@solo.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Kagent-specific environment variables had inconsistent names, and the registry was missing settings used by the controller, CLI, runtimes, Python packages, and UI. This PR standardizes those names under
KAGENT_and generatesdocs/env.mdfrom the existing ENV registry. The reference covers 138 user-configurable settings; controller-owned payloads, generated credentials, and private runtime wiring are excluded.This is a direct pre-release rename. Custom deployment environments and local configuration need to use the new names, for example
LOG_LEVEL→KAGENT_LOG_LEVEL,POSTGRES_DATABASE_URL→KAGENT_POSTGRES_DATABASE_URL, and the Go ADK'sPORT→KAGENT_PORT. The old names are no longer read by kagent. Helm output, runtime injection, scripts, and examples use the new names. Upstream SDK and tool conventions such asOTEL_*, provider credentials, andKUBECONFIGstay unchanged.make env-docsgenerates the reference throughkagent env.make env-docs-checkchecks freshness without modifying it and runs in the existingmanifests-checkCI job. The workflow includes changes todocs/env.mdwhile skipping other Markdown-only changes, with no additional job. Generation exports registered metadata, never values from the current process environment.Registration functions accept multiple components so shared settings only need one registration. Filters match any listed component; JSON exports a
componentsarray instead of the previouscomponentstring.Go controller, CLI, ADK, provider, logging, telemetry, E2E, and upgrade-test settings read through registered accessors. Telemetry rendering takes its environment names and protocol default from the same registry.
Get()andLookup()preserve component-specific defaults and precedence. Boolean/integerLookupWithError()preserves diagnostics for invalid migration and capture-limit settings. Go booleans accepttrue/t/1andfalse/f/0regardless of case or surrounding whitespace; upstreamOTEL_SDK_DISABLEDretains its true-only grammar. The Python ADK HTTP server uses sharedKAGENT_LOG_LEVEL; the separateUVICORN_LOG_LEVELoverride is removed.The existing Go linter rejects direct
os.Getenv/os.LookupEnvreads, including aliased imports and function references. E2E and upgrade tests are covered by the rule; unit tests may inspect process state directly. The registry itself and explained exceptions for generated payloads, credential placeholders, and the standalone BYO example remain allowed.Both ADKs use
KAGENT_PORTfor A2A traffic. The controller supplies80once; Python'sKAGENT_A2A_GRPC_ADDRESSis removed. Standalone defaults and explicit programmatic/CLI overrides are preserved, and Python's HTTP listener remains separately configured.Chart-defined non-secret settings live in controller, UI, and bundled PostgreSQL ConfigMaps, loaded through
envFrom. Pod-template checksums trigger rollouts when configuration changes. Credentials, downward-API values, values needing Kubernetes$(...)expansion, and explicit user env overrides stay in the Deployments.Testing settings use
KAGENT_TEST_*orKAGENT_E2E_*; UI settings useKAGENT_UI_*. UI containers and Vite consume the same names, includingKAGENT_UI_ENABLE_MOCK. Browser configuration is limited to explicit UI settings,KAGENT_UI_EXTENSION_*, and build-timeKAGENT_UI_VITE_*switches. Make targets, CI, Playwright, and local-development examples use the same prefixes. Upgrade tests also register their repository, version, registry, cluster, namespace, and context inputs underKAGENT_E2E_*; Make maps its existing build variables to those names. Existing empty-value fallbacks and true-only opt-in grammars are preserved.Seven settings ignored by the controller are removed along with their Helm values and references. They covered authentication, gRPC TLS/message limits, and the default Substrate worker pool. The chart's MCP URL uses HTTP to match the controller listener. [BUG] Restore Helm-configured controller authentication end to end #2968 tracks restoring Helm-configured authentication end to end.
Image-digest lookups in CI and cluster setup consume the full Docker output. Exiting
awkearly can close the pipe while Docker is still writing and abort E2E setup underpipefail.Validation passed:
Focused Go tests for the registry, controller app, CLI/database commands, ADK app/A2A/agent/providers/embedding/tools, logging, telemetry, harness configuration, and translators;
make -C go lint(zero issues). Coverage checks unset values, invalid input, capture limits, and boolean grammars. Negative lint probes verify that aliased direct reads and function references are rejected, including in E2E test files. Focused configuration tests cover E2E URL precedence, mock-host overrides, and upgrade defaults/context selection; Make dry runs verify that both upgrade targets pass the registered names.go build -mod=readonlypasses for the Go ADK, both harnesses, and sandbox guest.Sandbox guest Docker builder passes for
linux/amd64andlinux/arm64with-mod=readonly. Its minimal source context includes the ENV package required by logging.make env-docs-check, including checks that stale or missing docs fail and a failed generator preserves existing documentation.Helm unit tests (369 tests) and chart lint. Before/after renders preserve effective container environments across default, custom, external-database, and database-file configurations; setting changes update rollout checksums.
Python CLI, A2A configuration, and gRPC tests, plus Ruff on changed Python files. A real gRPC connection verifies the shared port is consumed and explicit addresses take precedence.
UI typecheck, focused unit tests (42 tests), and lint (no errors). Vite and container-startup smoke checks verify prefixed settings reach the browser and unrelated environment values stay private. Playwright configuration checks verify the renamed ports and mock/live switches; Upgrade packages compile without running cluster tests.
Full E2E suite passed on a clean local Kind cluster using images built from this branch: 52 top-level tests, zero failures, and 10 existing subtest skips in 7m01s, with four concurrent scenarios and tracing required. This covers all four harnesses, CLI invocation, checkpoints, controller restarts, scheduled runs, runtime revision lifecycle, and sandbox workflows. The BYO fixture uses
KAGENT_PORT=80; the oldPORT=80left the runtime listening on 8080 while the gateway connected to 80. The interaction test reproduced that timeout before the fixture change and passed afterward.