-
Notifications
You must be signed in to change notification settings - Fork 408
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add yurt-tunnel-server graceful shut down #346
Conversation
@Peeknut: GitHub didn't allow me to assign the following users: your_reviewer. Note that only openyurtio members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. 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. |
@Peeknut Would you add some unit cases for the new feature? btw: It would be much more welcome if you could upload some validation logs for new feature. |
👌 |
Validation logs:Execute the following commands:
Then
The
Execute the following command to continuously input the log of pod
The log information in the file is as follows:
Execute the
Check the log, it shows that [root@master suit-1.18]# cat yurt-tunnel-server.log
{"log":"I0610 09:20:18.973521 1 anpserver.go:156] start handling http request from master at 10.10.102.78:10264\n","stream":"stderr","time":"2021-06-10T09:20:18.976791039Z"}
{"log":"I0610 09:20:19.006273 1 anpserver.go:142] start handling https request from master at 10.10.102.78:10263\n","stream":"stderr","time":"2021-06-10T09:20:19.006562743Z"}
{"log":"I0610 09:20:23.977933 1 leaderelection.go:252] successfully acquired lease kube-system/tunnel-dns-controller\n","stream":"stderr","time":"2021-06-10T09:20:23.978937538Z"}
{"log":"I0610 09:20:23.979059 1 dns.go:203] starting tunnel dns controller\n","stream":"stderr","time":"2021-06-10T09:20:23.980407072Z"}
{"log":"I0610 09:20:23.979090 1 shared_informer.go:223] Waiting for caches to sync for tunnel-dns-controller\n","stream":"stderr","time":"2021-06-10T09:20:23.980426268Z"}
{"log":"I0610 09:20:23.979103 1 shared_informer.go:230] Caches are synced for tunnel-dns-controller \n","stream":"stderr","time":"2021-06-10T09:20:23.980432305Z"}
{"log":"I0610 09:21:15.658950 1 iptables.go:466] clear conntrack entries for ports [\"10250\" \"10255\"] and nodes [\"10.10.102.80\"]\n","stream":"stderr","time":"2021-06-10T09:21:15.659230528Z"}
{"log":"E0610 09:21:15.696089 1 iptables.go:483] clear conntrack for 10.10.102.80:10250 failed: \"conntrack v1.4.4 (conntrack-tools): 0 flow entries have been deleted.\\n\", error message: exit status 1\n","stream":"stderr","time":"2021-06-10T09:21:15.696373246Z"}
{"log":"E0610 09:21:15.708765 1 iptables.go:483] clear conntrack for 10.10.102.80:10255 failed: \"conntrack v1.4.4 (conntrack-tools): 0 flow entries have been deleted.\\n\", error message: exit status 1\n","stream":"stderr","time":"2021-06-10T09:21:15.708991045Z"}
{"log":"I0610 09:21:15.708804 1 iptables.go:535] directly access nodes changed, [10.10.102.78] for ports [10250 10255]\n","stream":"stderr","time":"2021-06-10T09:21:15.709035025Z"}
{"log":"E0610 09:24:35.639364 1 server.go:649] \"stream read failure\" err=\"rpc error: code = Canceled desc = context canceled\"\n","stream":"stderr","time":"2021-06-10T09:24:35.640992505Z"}
{"log":"I0610 09:24:36.340234 1 dns.go:230] shutting down tunnel dns controller\n","stream":"stderr","time":"2021-06-10T09:24:36.344814095Z"}
{"log":"I0610 09:24:36.340297 1 iptables.go:161] stop the iptablesManager\n","stream":"stderr","time":"2021-06-10T09:24:36.344858438Z"}
{"log":"I0610 09:24:36.340440 1 csrapprover.go:65] stoping the csrapprover\n","stream":"stderr","time":"2021-06-10T09:24:36.344864832Z"}
{"log":"I0610 09:24:36.786688 1 iptables.go:205] cleanup iptables rules succeed\n","stream":"stderr","time":"2021-06-10T09:24:36.786861028Z"}
[root@master suit-1.18]# Check the nat table on the node, there are no rules related to |
@Peeknut |
pkg/yurttunnel/iptables/iptables.go
Outdated
return | ||
case <-ticker.C: | ||
im.syncIptableSetting() | ||
} | ||
} | ||
} | ||
|
||
func (im *iptablesManager) cleanupIptableSetting() { | ||
dnatPorts, err := util.GetConfiguredDnatPorts(im.kubeClient, im.insecurePort) |
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.
It's not need to get the current dnat ports, only use im.lastDnatPorts
to cleanup iptables instead.
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
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Peeknut, rambohe-ch 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 enhancement
What this PR does / why we need it:
After
yurtctl revert
or delete deploymentyurt-tunnel-server
, the iptables rules created byyurt-tunnel-server
still exist and have not been deleted. So the requestkubectl exec/logs
cannot be sent correctly.Which issue(s) this PR fixes:
Fixes #337
Special notes for your reviewer:
/assign @rambohe-ch
Does this PR introduce a user-facing change?
other Note
The
yurt-tunnel-server
image needs to be recompiled locally and used during testing.