Feat/kubernetes sandbox env injection#1713
Open
BukJiang wants to merge 3 commits into
Open
Conversation
…stemSpec KubernetesFilesystemSpec now supports environment(Map<String,String>), mirroring the existing DockerFilesystemSpec API. Env vars are passed to the K8s Pod container spec via EnvVar entries in Fabric8 ContainerBuilder. - KubernetesSandboxClientOptions: add environment field with getter/setter - KubernetesFilesystemSpec: add fluent environment() builder method - KubernetesSandboxClient: include environment in merge() and copy() - Fabric8KubernetesPodRuntime: apply env map via cb.withEnv() in createPod()
- merge(): source from o instead of base for consistency with other fields - createPod(): drop redundant null-check, switch to addAllToEnv() for safety
Cover KubernetesSandboxClientOptions defensive copy, null-safety, unmodifiable getter, and KubernetesSandboxClient.merge() semantics: - null call options preserves spec-level env - empty call-level env preserves spec-level env - call-level key overrides spec-level key - call-level key adds to spec-level env (non-overridden keys preserved) Also widen merge() visibility to package-private to enable testing.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
AgentScopeJavaBot
left a comment
Collaborator
There was a problem hiding this comment.
🤖 AI Review
This PR adds a ConfigMap-based environment injection mechanism for Kubernetes sandboxes, allowing dynamic environment variables to be merged from multiple ConfigMaps.
Recommendation: COMMENT — 1 critical issue + 1 recommended + 1 nitpick
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
Adds environment(Map<String, String>) support to KubernetesFilesystemSpec, bringing it to parity with DockerFilesystemSpec. Env vars are injected into the K8s Pod container spec at creation time via Fabric8 ContainerBuilder.addAllToEnv().
Fixes / Relates to: #
Description
Background & Purpose
DockerFilesystemSpec supports per-call environment variable injection via .environment(Map), but KubernetesFilesystemSpec has no equivalent. This blocks use cases where per-user secrets (e.g. an API key for a CLI tool pre-installed in the container image) need to be passed into the sandbox Pod without being written to the workspace filesystem — writing to workspace would cause the secret to land in JdbcSnapshotSpec / agent_sandbox_snapshots.
Changes Made
How to Test
Checklist