-
Notifications
You must be signed in to change notification settings - Fork 40k
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
improve parsing in iptables unit tests #109844
improve parsing in iptables unit tests #109844
Conversation
@danwinship: This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/assign @thockin |
70e7033
to
203337f
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.
Dan, you are the consumer of my Firday afternoons!!
There were previously some strange iptables-rule-parsing functions that were only used by two unit tests in pkg/proxy/ipvs. Get rid of them and replace them with some much better iptables-rule-parsing functions.
Sort the ":CHAINNAME" lines in the same order as the "-A CHAINNAME" lines (meaning, KUBE-NODEPORTS and KUBE-SERVICES come first). (This will simplify IPTablesDump because it won't need to keep track of the declaration order and the rule order separately.)
FakeIPTables barely implemented any of the iptables interface, and the main part that it did implement, it implemented incorrectly. Fix it: - Implement EnsureChain, DeleteChain, EnsureRule, and DeleteRule, not just SaveInto/Restore/RestoreAll. - Restore/RestoreAll now correctly merge the provided state with the existing state, rather than simply overwriting it. - SaveInto now returns the table that was requested, rather than just echoing back the Restore/RestoreAll.
203337f
to
24e1e3d
Compare
Thanks! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danwinship, thockin The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Generally improves the parsing of iptables rules in the kube-proxy unit tests, for three reasons:
iptablesTracer
was kind of hacky and uncleariptablesTracer
could only make use of the rules thatsyncProxyRules
added withRestoreAll
, and not the rules that it added withEnsureRule
.syncProxyRules
to do partial restores rather than complete restores, and this can only be sanely unit-tested ifFakeIPTables
is fixed to implement partial restores correctly.Which issue(s) this PR fixes:
none
Does this PR introduce a user-facing change?
(only modifies unit tests, and helper code that is only used by unit tests)
/sig network
/priority important-soon