fix(driver-kubernetes): propagate log_level as OPENSHELL_LOG_LEVEL env var#1310
Merged
TaylorMutch merged 1 commit intoMay 11, 2026
Merged
Conversation
…v var The sandbox_to_k8s_spec function was inserting logLevel and environment fields at the Sandbox CR spec level. Neither field exists in the agents.x-k8s.io/v1alpha1 CRD schema, so Kubernetes silently dropped them and the log_level value never reached the sandbox pod. Remove the dead CR-level insertions. Build a merged environment map that includes OPENSHELL_LOG_LEVEL when log_level is set, and pass it to sandbox_template_to_k8s so the value flows through build_env_list into the pod container spec. Add a unit test verifying OPENSHELL_LOG_LEVEL appears in the container env and that logLevel is absent from the CR spec. Fixes NVIDIA#1265
ee6e3fe to
64fd96a
Compare
TaylorMutch
approved these changes
May 11, 2026
Collaborator
TaylorMutch
left a comment
There was a problem hiding this comment.
Validated locally on a fresh k3d cluster via mise run helm:k3s:create + mise run helm:skaffold:run against this branch (commit 64fd96ab).
Findings
- Unit test
driver::tests::log_level_propagates_as_env_var_to_sandbox_podpasses. - End-to-end positive case:
CreateSandboxwithspec.log_level="debug"produces a Sandbox CR where the agent container's env array containsOPENSHELL_LOG_LEVEL=debug, and the legacyspec.logLevel/spec.environmentfields at the CR root are no longer written. The downstream pod inherits the env var ({"name":"OPENSHELL_LOG_LEVEL","value":"debug"}). - End-to-end negative case:
CreateSandboxwith an emptylog_levelproduces noOPENSHELL_LOG_LEVELentry in the container env, leaving only the standard supervisor variables — confirming thefilter(|s| !s.log_level.is_empty())guard. - The new
spec_pod_envhelper is correctly threaded through both thetemplate-present and the default-template branches ofsandbox_to_k8s_spec, so behavior is consistent regardless of whether the caller supplied a template.
LGTM.
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.
Summary
The Kubernetes driver was inserting
logLevelandenvironmentfields at the Sandbox CR spec level insidesandbox_to_k8s_spec. Neither field exists in theagents.x-k8s.io/v1alpha1CRD schema. Kubernetes accepts them on unstructured writes and the controller drops them silently, solog_levelnever reached the sandbox pod.Changes:
logLevelandenvironmentOPENSHELL_LOG_LEVELwhenspec.log_levelis set, and pass it tosandbox_template_to_k8sso the value flows throughbuild_env_listinto the pod container specOPENSHELL_LOG_LEVELappears in the container env and thatlogLevelis absent from the CR specRelated Issue
Fixes #1265
Testing
mise run pre-commitpasseslog_level_propagates_as_env_var_to_sandbox_podChecklist