kubernetes/pkg/proxy
Kubernetes Submit Queue e6c2a5de10
Merge pull request #57461 from danwinship/proxier-no-dummy-nat-rules
Automatic merge from submit-queue (batch tested with PRs 55637, 57461, 60268, 60290, 60210). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Don't create no-op iptables rules for services with no endpoints

Currently for all services we create `-t nat -A KUBE-SERVICES` rules that match the destination IPs (ClusterIP, ExternalIP, NodePort IPs, etc) and then jump to the appropriate `KUBE-SVC-XXXXXX` chain. But if the service has no endpoints then the `KUBE-SVC-XXXXXX` chain will be empty and so nothing happens except that we wasted time (a) forcing iptables-restore to parse the match rules, and (b) forcing the kernel to test matches that aren't going to have any effect.

This PR gets rid of the match rules in this case. Which is to say, it changes things so that every incoming service packet is matched *either* by nat rules to rewrite it *or* by filter rules to ICMP reject it, but not both. (Actually, that's not quite true: there are no filter rules to reject Ingress-addressed packets, and I *think* that's a bug?)

I also got rid of some comments that seemed redundant.

The patch is mostly reindentation, so best viewed with `diff -w`.

Partial fix for #56842 / Related to #56164 (which it conflicts with but I'll fix that after one or the other merges).

**Release note**:
```release-note
Removed some redundant rules created by the iptables proxier, to improve performance on systems with very many services.
```
2018-02-23 09:49:38 -08:00
..
apis/kubeproxyconfig Merge pull request #57550 from m1093782566/cleanup-mode 2018-02-23 04:01:33 -08:00
config Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
healthcheck Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
iptables Merge pull request #57461 from danwinship/proxier-no-dummy-nat-rules 2018-02-23 09:49:38 -08:00
ipvs Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
metrics add proxy metrics in app level 2017-10-16 21:10:51 +08:00
userspace Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
util Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
winkernel fix all the typos across the project 2018-02-11 11:04:14 +08:00
winuserspace Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
BUILD Autogenerated: hack/update-bazel.sh 2018-02-16 13:43:01 -08:00
doc.go Use Go canonical import paths 2016-07-16 13:48:21 -04:00
endpoints.go proxy endpoints part changes 2018-02-09 17:20:47 +08:00
endpoints_test.go proxy endpoints part changes 2018-02-09 17:20:47 +08:00
OWNERS add m1093782566 to pkg/proxy/OWNERS 2017-10-13 11:39:25 +08:00
service.go proxy service part changes 2018-02-09 17:20:44 +08:00
service_test.go proxy service part changes 2018-02-09 17:20:44 +08:00
types.go abstract proxy servicePort and endpoints 2018-02-07 11:46:31 +08:00