-
Notifications
You must be signed in to change notification settings - Fork 259
feat: add terminateOnSuccess flag to iptables monitor #3995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a test? Also add in the description how you have validated this.
429b87d to
4baf12b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new terminateOnSuccess flag to the iptables monitor that allows the program to exit when no user iptables rules are detected. The changes also refactor the code for better testability by introducing dependency injection interfaces and comprehensive test coverage.
- Added terminateOnSuccess configuration flag for conditional program termination
- Refactored code into testable functions with dependency injection interfaces
- Updated default BPF map path to avoid conflicts with azure iptables block binary
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| azure-iptables-monitor/interfaces.go | New file defining interfaces for dependency injection and configuration structs |
| azure-iptables-monitor/iptables_monitor.go | Refactored main logic into testable functions, added terminateOnSuccess support, updated default map path |
| azure-iptables-monitor/iptables_monitor_test.go | Added comprehensive test coverage with mock implementations for all dependencies |
| azure-iptables-monitor/README.md | Updated documentation for new flags and default map path |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
/azp run Azure Container Networking PR |
|
Azure Pipelines successfully started running 1 pipeline(s). |
* initial refactor without tests * refactor helper functions * add test * address linter * change bpf map path default since iptables block already exists there * fix cosmetic issue * update readme (noop) * add timeout to context
Reason for Change:
Adds a new flag to iptables monitor so that the program can terminate if no user iptables rules are detected.
Refactors the code to make testing easier.
Changes the default location of the azure block iptables bpf map so it doesn't conflict with the location of the azure iptables block binary that was recently added to the image.
Adds tests.
Issue Fixed:
Requirements:
Notes:
Tested on dualstack cluster with iptables block running (ubuntu 24)
BPF Map
Monitoring
Termination