Repository navigation
feat: add active network policy probe - #205
Merged
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
There are a few correctness and operability issues (error reporting and probe reliability assumptions) that should be addressed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds an agentctl doctor network-policy command that can passively fingerprint likely NetworkPolicy enforcement, or run an opt-in active probe that creates a scratch namespace, runs a TCP control dial, applies a deny-egress policy, then re-tests connectivity.
Changes:
- Add active NetworkPolicy probe logic and supporting netprobe runner.
- Wire
agentctl doctor network-policyand document passive vs active modes. - Add an operator binary entrypoint mode to run
netprobeinside the operator image.
File summaries
| File | Description |
|---|---|
| README.md | Mentions the new doctor command and active probe mode. |
| internal/netpolicy/probe.go | Implements the scratch-namespace active probe and result classification. |
| internal/netpolicy/probe_test.go | Unit tests for probe refusal paths, verdict classification, and restricted pod settings. |
| internal/netpolicy/netprobe/runner.go | Implements netprobe serve and netprobe dial with distinct exit codes. |
| internal/netpolicy/netprobe/runner_test.go | Tests for dial success, DNS failure classification, and arg validation. |
| docs/10-troubleshooting.md | Documents how to run the passive and active NetworkPolicy checks. |
| docs/07-security.md | Documents probe permissions and probe scope limits. |
| cmd/main.go | Adds a netprobe fast-path to run the embedded probe command in the operator binary. |
| cmd/agentctl/doctor_sandbox.go | Adds the doctor network-policy Cobra subcommand and output formatting. |
| cmd/agentctl/doctor_sandbox_test.go | Adds tests for the new subcommand and passive behavior. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 4
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Signed-off-by: Shreyansh Sancheti <43677304+shreyanshjain7174@users.noreply.github.com>
shreyanshjain7174
force-pushed
the
feat/networkpolicy-active-probe
branch
from
September 3, 2026 13:19
f83721b to
738a425
Compare
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
agentctl doctor network-policyCNI detection.--active-probepacket test in a scratch namespace.Safety
--active-probeand--probe-image.Validation
go build ./...make test-gomake lintgo test ./internal/netpolicy ./internal/netpolicy/netprobe ./cmd/agentctlhelm unittest chartshelm lint chartsgo test ./...remains locally blocked only by missing envtestetcdassets.