feat: add Sandbox support to NetworkPolicy controller - #345
Merged
Conversation
Register a conditional Watches for the Sandbox CRD (agents.x-k8s.io/v1alpha1) in the AgentCardNetworkPolicy controller's SetupWithManager. This ensures that when the Sandbox CRD is installed, changes to Sandbox objects with the agent label trigger reconciliation of the owning AgentCard's NetworkPolicy. Closes #341 Assisted-By: Claude (Anthropic AI) <noreply@anthropic.com> Signed-off-by: cwiklik <cwiklikj@gmail.com>
mrsabath
approved these changes
May 8, 2026
mrsabath
left a comment
Contributor
There was a problem hiding this comment.
Clean addition of Sandbox watch support to the NetworkPolicy controller. Follows the same conditional-CRD pattern established in the AgentCardSync and ClientRegistration controllers (#338, #343). Correct use of SandboxCRDExists() guard, unstructured.Unstructured with sandboxGVK, mapWorkloadToAgentCard handler, and agentLabelPredicate() filter. RBAC marker added appropriately.
Areas reviewed: Go (operator controller), RBAC markers
CI status: all 16 checks passing
Open
5 tasks
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
SetupWithManagerwithSandboxCRDExists()guardmapWorkloadToAgentCard("agents.x-k8s.io/v1alpha1", "Sandbox")to enqueue AgentCard reconciliation on Sandbox changesagents.x-k8s.iosandboxesThis ensures that when a Sandbox workload's labels change (e.g., signature verification status), the NetworkPolicy controller reconciles and creates/updates the appropriate policy.
Closes #341
Test plan
kagenti.io/type: agent+ AgentCard → verify NetworkPolicy is createdAssisted-By: Claude Code