Fix k8s execute command argv handling#67
Open
Devamparikh wants to merge 1 commit into
Open
Conversation
d74d0ad to
f3e42ee
Compare
Signed-off-by: DParikh_flexera <Dparikh@flexera.com>
f3e42ee to
f27c8ac
Compare
Author
|
Hi @EItanya @dimetron, I noticed CODEOWNERS routes this repo to you, so I wanted to gently flag this PR for review. I hit this while validating kagent exec through Teams/A2A: the request reached kagent-tools correctly, but |
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.
Why
While testing Kubernetes exec through kagent from a Teams bot, I ran into a confusing failure mode: asking the agent to run
uname -ainside a pod reachedkagent-tools, but Kubernetes tried to execute a binary literally nameduname -a.That made the whole A2A/MCP path look broken at first, even though routing, auth, approvals, and the target pod were all working. A single-word
unamesucceeded, which narrowed the issue down to howk8s_execute_commandbuilds thekubectl execargv.This PR fixes that sharp edge so simple exec commands behave the way users and agents naturally expect.
What changed
argsarray for flags/arguments, so callers can send structured input such ascommand: "uname", args: ["-a"].command: "uname -a".containerinput by passing-c <container>tokubectl exec.Fixes #59.
Testing
go test ./pkg/k8sk8s_execute_commandsucceeds withcommand: "uname", args: ["-a"], container: "twistlock-defender".command: "uname -a".kagent-toolslogs showed kubectl invoked as separate argv pieces:exec ... -c twistlock-defender -- uname -a.