-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
only manage kubernetes masquerade and postrouting iptables rules in kubelet #82116
Conversation
Hi @liuxu623. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: liuxu623 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/assign @dnardo @Random-Liu |
So I also just filed a bug about this, #82125. In particular, kube-proxy has a command-line argument related to this, which needs to be dealt with as well, so it's not just a matter of deleting code. |
@@ -1591,7 +1576,7 @@ func (proxier *Proxier) createAndLinkeKubeChain() { | |||
if chain, ok := existingNATChains[ch.chain]; ok { | |||
writeBytesLine(proxier.natChains, chain) | |||
} else { | |||
writeLine(proxier.natChains, utiliptables.MakeChainLine(kubePostroutingChain)) | |||
writeLine(proxier.natChains, utiliptables.MakeChainLine(ch.chain)) |
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.
um... I'm not sure what this code is doing but this clearly changes its behavior...
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.
I think this code is copy form iptables/proxier.go#L763-L778, it means if chain not exist, create it.
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.
I'm not sure what the original intent here was (maybe @m1093782566 knows), but this does seem wrong but I don't think it broke anyone because we already ensure the chain exists in line 1605.
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.
I write some test code, iptables_test1.go and iptables_test2.go, when all kube iptables chains not exist, iptables_test1.go output is
:KUBE-POSTROUTING - [0:0]
:KUBE-POSTROUTING - [0:0]
:KUBE-POSTROUTING - [0:0]
:KUBE-POSTROUTING - [0:0]
iptables_test2.go output is
:KUBE-SERVICES - [0:0]
:KUBE-FIREWALL - [0:0]
:KUBE-NODE-PORT - [0:0]
:KUBE-LOAD-BALANCER - [0:0]
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.
And you are right, we already ensure the chain exists in line 1605, so I think we don't actually need line 1609-1622 anymore.
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.
We can do this in iptables proxier too, use iptables.EnsureChain to create not exist chains instead of iptables.RestoreAll.
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.
Letting RestoreAll
ensure the chains is more efficient than making extra EnsureChain
calls. We should only call EnsureChain
for the chains that we can't ensure from RestoreAll
because we aren't filling in their contents. (eg, the RestoreAll
input might include -j KUBE-MARK-DROP
in some rule, but we can't actually define the KUBE-MARK-DROP
chain in RestoreAll
because we don't know exactly what the rule in that chain is supposed to be. So we should EnsureChain
it.)
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.
ok, so we should remove EnsureChain
? Becase we already use RestoreAll
to ensure the chains exists.
b9d291a
to
e6e7200
Compare
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@danwinship: Closed this PR. In response to this:
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. |
@liuxu623: PR needs rebase. 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. |
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
These iptables rules already managed by kubelet, so we should remove code in iptables/ipvs proxier.
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: