← Back to Pull requests

feat: add token support for kubectl commands #37

Closed
unknown closed this pull request without merging on Feb 17, 2026 02:14 UTC
View on GitHub
unknown unknown commented on Dec 29, 2025 20:07 UTC
Author

Some users of the kagent tool server want to be able to use client authentication for k8s tools. In order to enable this, the k8s tools will now attempt to pass Bearer tokens from the request into the kubectl commands.

Introduces helm values for configuring this:

# When true: pods use the default service account and no ClusterRole/ClusterRoleBinding are created.
# When false: a dedicated ServiceAccount and RBAC are created.
UseDefaultServiceAccount: false

tools:
  k8s:
    # When true: a Bearer token in the Authorization header on each request is passed to kubectl; fails if missing
    # When false: kubectl uses in-cluster ServiceAccount.
    tokenPassthrough: false

Testing


Defaults (matches current approach)


UseDefaultServiceAccount: false
tools:
  k8s:
    tokenPassthrough: false

Output:

time=2026-02-16T19:56:35.920Z level=INFO msg="executing command" trace_id=bd2fb0c590239cb8b183e60f4c0801bd span_id=7dcc9f5c919cb145 command=kubectl args="[get namespaces -o wide]"
time=2026-02-16T19:56:36.153Z level=INFO msg="command execution successful" trace_id=bd2fb0c590239cb8b183e60f4c0801bd span_id=7dcc9f5c919cb145 command=kubectl args="[get namespaces -o wide]" duration=0.233024001

Token passthrough + disable service account


UseDefaultServiceAccount: false
tools: 
  k8s:
    tokenPassthrough: false

With token:

time=2026-02-16T19:59:41.010Z level=INFO msg="executing command" trace_id=bd2fb0c590239cb8b183e60f4c0801bd span_id=ce0a811d4704fc88 command=kubectl args="[get namespaces -o wide --token <REDACTED>]"
time=2026-02-16T19:59:41.384Z level=INFO msg="command execution successful" trace_id=bd2fb0c590239cb8b183e60f4c0801bd span_id=ce0a811d4704fc88 command=kubectl args="[get namespaces -o wide --token <REDACTED>]" duration=0.374007129

Without token, the client receives:
Bearer token required when TOKEN_PASSTHROUGH is true

Diff: 245 lines (+183 / -62) across 3 files Reviewer: sam-heilbron Review duration: 70926m
All Vouch review confidence checks passed
Residual risk 0.25 = Change Risk (0.62) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.62 · 245 lines diff across 3 files
0.62
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.329
Shallow Review Depth shallow_review_depth
0.289
Sensitive Paths sensitive_paths
0.062
Real PR Conversation Timeline
1 comments
"Review active on #37"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed sensitive_module
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 62% (MEDIUM) · Higher = larger blast radius
62%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 24.5% · Safe to merge
24.5%