Skip to content

bug(k8s): Kubernetes driver log_level and environment fields set on Sandbox CR spec have no effect #1265

@rrhubenov

Description

@rrhubenov

Agent Diagnostic

  • Investigated crates/openshell-driver-kubernetes/src/driver.rs, specifically the sandbox_to_k8s_spec function
  • Fetched the Sandbox CRD definition from https://github.com/kubernetes-sigs/agent-sandbox/blob/main/api/v1alpha1/sandbox_types.go
  • Confirmed the CRD's SandboxSpec only has: podTemplate, volumeClaimTemplates, lifecycle, replicas
  • The driver was inserting logLevel and environment at the .spec level of the Sandbox CR — fields that don't exist in the CRD schema
  • Kubernetes silently ignores unknown fields on unstructured/dynamic objects, so these had zero effect
  • The environment map was already being passed into the pod container env via build_env_list, so that path worked
  • The log_level was only set at the dead CRD-level — it never reached the pod as an env var

Description

Actual behavior: Setting log_level on a sandbox spec when using the Kubernetes compute driver has no effect. The value is inserted as a logLevel field on the Sandbox CR's .spec, but the agent-sandbox CRD (agents.x-k8s.io/v1alpha1) has no such field — Kubernetes silently drops it. There is no way to control the log level of sandbox pods via the k8s driver.

Similarly, the environment map was redundantly inserted at the CR spec level (no effect), though it was separately and correctly passed to the pod container env.

Expected behavior: The log_level field should be propagated as an OPENSHELL_LOG_LEVEL environment variable on the sandbox pod's container spec, allowing operators to control sandbox log verbosity.

Reproduction Steps

  1. Create a sandbox with a non-default log_level via the gRPC API using the Kubernetes driver
  2. Inspect the created Sandbox CR — logLevel field is present but ignored by the CRD controller
  3. Inspect the resulting pod — no OPENSHELL_LOG_LEVEL env var is set

Environment

  • Component: crates/openshell-driver-kubernetes
  • CRD: agents.x-k8s.io/v1alpha1 Sandbox (kubernetes-sigs/agent-sandbox)

Logs

N/A — silent failure (fields are accepted by the k8s API but have no semantic effect)

Metadata

Metadata

Assignees

No one assigned

    Labels

    state:triage-neededOpened without agent diagnostics and needs triage

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions