Skip to content
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

iptables: refactor helper, add RuleSet #373

Merged
merged 5 commits into from
Nov 10, 2023
Merged

iptables: refactor helper, add RuleSet #373

merged 5 commits into from
Nov 10, 2023

Conversation

roobre
Copy link
Collaborator

@roobre roobre commented Nov 8, 2023

Description

This PR continues the iptables refactoring work initiated by #357, by keeping a simple helper that works with structured rules and putting the auto-removing logic into a new object called RuleSet.

The TrafficRedirector has been refactored to use the new helper, but not the RuleSet.

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works.
  • I have run linter locally (make lint) and all checks pass.
  • I have run tests locally (make test) and all tests pass.
  • I have run relevant integration test locally (make integration-xxx for affected packages)
  • I have run relevant e2e test locally (make e2e-xxx for disruptors, or cluster related changes)
  • Any dependent changes have been merged and published in downstream modules

cmd/agent/commands/grpc.go Outdated Show resolved Hide resolved
pkg/iptables/redirector.go Outdated Show resolved Hide resolved
@@ -1,11 +1,12 @@
package iptables
package protocol_test
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for changing the convention we have been using of not creating a different package for tests? Does this bring any advantage? I prefer to maintain consistency across packages

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I made this change out of habit as I was testing exported functions only, I agree we should keep consistency. I can change it real quick :)

Copy link
Collaborator

@pablochacin pablochacin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I only not fully in favor of changing the implicit convention of not using test packages. I wold prefer to maintain consistency across the project.

@roobre roobre merged commit 6a5f503 into main Nov 10, 2023
8 checks passed
@roobre roobre deleted the iptables-ruleset branch November 10, 2023 13:13
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.

None yet

2 participants