Skip to content

fix: read srt-settings merge source from Secret data, not stringData#205

Merged
QuentinBisson merged 1 commit into
mainfrom
fix-srt-settings-kyverno-merge
Jul 20, 2026
Merged

fix: read srt-settings merge source from Secret data, not stringData#205
QuentinBisson merged 1 commit into
mainfrom
fix-srt-settings-kyverno-merge

Conversation

@QuentinBisson

Copy link
Copy Markdown
Contributor

What

The kagent-srt-settings Kyverno policy now reads the existing srt-settings.json from the agent config Secret's data (base64-decoded, falling back to base64 {}) instead of request.object.stringData.

Why

The policy is meant to merge enableWeakerNestedSandbox: true into the srt settings the kagent controller generates. But the API server folds stringData into data during v1-to-internal conversion (Convert_v1_Secret_To_core_Secret), before admission webhooks run, so the policy's merge source was always empty. The mutation then replaced the controller's full settings with the flag alone:

{"enableWeakerNestedSandbox":true}

srt rejects that file (Invalid configuration in /config/srt-settings.json: network: Required, filesystem: Required), which breaks sandboxed skill execution and leaves agents without their muster MCP tools ("Tool not found" on filter_tools/call_tool/describe_tool). Only kagent built-ins remained available.

Reproduced on gazelle with server-side dry-runs: both CREATE and UPDATE of the Secret carrying full settings in stringData came back from admission flag-only.

Verification

Applied the patched policy live on gazelle:

  • dry-run CREATE with full settings now merges correctly: {"enableWeakerNestedSandbox":true,"filesystem":{...},"network":{...}}
  • after a kagent-controller restart, the kagent/sre-agent Secret was rewritten with the full merged settings and the file is correct inside the running pod.

Rollout note

Kyverno mutation is admission-time only: existing agent config Secrets stay broken until their next write. Restart the kagent controller after deploying to force a rewrite; the agent pods then need a restart to rebuild their tool registry.

The API server folds stringData into data during v1-to-internal
conversion, before admission webhooks run, so the kagent-srt-settings
Kyverno policy always saw an empty merge source and replaced the
controller-generated srt-settings.json with the
enableWeakerNestedSandbox flag alone. srt rejected the resulting file
(network: Required, filesystem: Required), breaking sandboxed skill
execution and leaving agents without their muster MCP tools.

Read the existing JSON from data with base64_decode (falling back to
base64 '{}') so the merge preserves the controller's network and
filesystem sections. Verified on gazelle: with the patched policy, a
kagent-controller restart rewrote the sre-agent Secret to the full
merged settings.
@QuentinBisson
QuentinBisson marked this pull request as ready for review July 17, 2026 12:07
@QuentinBisson
QuentinBisson requested a review from a team as a code owner July 17, 2026 12:07
@QuentinBisson
QuentinBisson merged commit e1f5c30 into main Jul 20, 2026
8 checks passed
@QuentinBisson
QuentinBisson deleted the fix-srt-settings-kyverno-merge branch July 20, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant