Commit Graph

310 Commits

Author SHA1 Message Date
libnux
f0e01bcfde Change log level to 3 when --random-fully is not supported 2019-12-24 17:47:27 +08:00
Mark Janssen
a54e5cec54 Fix staticcheck failures for pkg/proxy/...
Errors from staticcheck:
pkg/proxy/healthcheck/proxier_health.go:55:2: field port is unused (U1000)
pkg/proxy/healthcheck/proxier_health.go:162:20: printf-style function with dynamic format string and no further arguments should use print-style function instead (SA1006)
pkg/proxy/healthcheck/service_health.go:166:20: printf-style function with dynamic format string and no further arguments should use print-style function instead (SA1006)
pkg/proxy/iptables/proxier.go:737:2: this value of args is never used (SA4006)
pkg/proxy/iptables/proxier.go:737:15: this result of append is never used, except maybe in other appends (SA4010)
pkg/proxy/iptables/proxier.go:1287:28: this result of append is never used, except maybe in other appends (SA4010)
pkg/proxy/userspace/proxysocket.go:293:3: this value of n is never used (SA4006)
pkg/proxy/winkernel/metrics.go:74:6: func sinceInMicroseconds is unused (U1000)
pkg/proxy/winkernel/metrics.go:79:6: func sinceInSeconds is unused (U1000)
pkg/proxy/winuserspace/proxier.go:94:2: field portMapMutex is unused (U1000)
pkg/proxy/winuserspace/proxier.go:118:2: field owner is unused (U1000)
pkg/proxy/winuserspace/proxier.go:119:2: field socket is unused (U1000)
pkg/proxy/winuserspace/proxysocket.go:620:4: this value of n is never used (SA4006)
2019-12-22 21:32:06 +01:00
Kubernetes Prow Robot
459b1d76bf
Merge pull request #85527 from aojea/fix#85414
Revert "kube-proxy: check KUBE-MARK-DROP"
2019-11-23 13:19:49 -08:00
Antonio Ojea
98be7831e4
Revert "kube-proxy: check KUBE-MARK-DROP"
This reverts commit 1ca0ffeaf2.

kube-proxy is not recreating the rules associated to the
KUBE-MARK-DROP chain, that is created by the kubelet.

Is preferrable avoid the dependency between the kubelet and
kube-proxy and that each of them handle their own rules.
2019-11-22 06:37:42 +01:00
Andrew Sy Kim
884582d892 proxier: improve node topology event handler logic
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-11-15 08:53:56 -05:00
Roc Chan
80c6524cd0 kube-proxy: sync rules when current node labels change detected 2019-11-15 13:36:43 +08:00
Roc Chan
c9cf3f5b72 Service Topology implementation
* Implement Service Topology for ipvs and iptables proxier
* Add test files
* API validation
2019-11-15 13:36:43 +08:00
Rob Scott
a7e589a8c6
Promoting EndpointSlices to beta 2019-11-13 14:20:19 -08:00
Kubernetes Prow Robot
2b3540068b
Merge pull request #84422 from aojea/kubemarkdrop
kube-proxy: ensure KUBE-MARK-DROP exists
2019-11-03 13:41:39 -08:00
Kubernetes Prow Robot
85575e929b
Merge pull request #83387 from danwinship/proxy-error-retry
If an iptables proxier sync fails, retry after iptablesSyncPeriod
2019-10-31 21:53:23 -07:00
Dan Winship
2fd42dee95 If an iptables proxier sync fails, retry after iptablesSyncPeriod 2019-10-29 07:36:00 -04:00
Antonio Ojea
1ca0ffeaf2 kube-proxy: check KUBE-MARK-DROP 2019-10-27 18:46:51 +01:00
zouyee
a3e0ac2951 set config.BindAddress to IPv4 address "127.0.0.1" if not specified
Signed-off-by: Zou Nengren <zouyee1989@gmail.com>
2019-10-25 21:46:41 +08:00
Kubernetes Prow Robot
af6f302e46
Merge pull request #83498 from danwinship/proxy-health
Fix kube-proxy healthz server for proxier sync loop changes
2019-10-15 23:04:58 -07:00
Rob Scott
3924364585
Making iptables probability more granular in kube-proxy.
Until now, iptables probabilities had 5 decimal places of granularity.
That meant that probabilities would start to repeat once a Service
had 319 or more endpoints.

This doubles the granularity to 10 decimal places, ensuring that
probabilities will not repeat until a Service reaches 100,223 endpoints.
2019-10-07 17:37:33 -07:00
Dan Winship
f83474916e Fix kube-proxy healthz server for proxier sync loop changes
The proxy healthz server assumed that kube-proxy would regularly call
UpdateTimestamp() even when nothing changed, but that's no longer
true. Fix it to only report unhealthiness when updates have been
received from the apiserver but not promptly pushed out to
iptables/ipvs.
2019-10-04 13:37:09 -04:00
Dan Winship
0f10102c16 Better distinguish the two kinds of proxy health check servers
Kube-proxy runs two different health servers; one for monitoring the
health of kube-proxy itself, and one for monitoring the health of
specific services. Rename them to "ProxierHealthServer" and
"ServiceHealthServer" to make this clearer, and do a bit of API
cleanup too.
2019-10-04 10:37:58 -04:00
Dan Winship
3948f16ff4 Add iptables.Monitor, use it from kubelet and kube-proxy
Kubelet and kube-proxy both had loops to ensure that their iptables
rules didn't get deleted, by repeatedly recreating them. But on
systems with lots of iptables rules (ie, thousands of services), this
can be very slow (and thus might end up holding the iptables lock for
several seconds, blocking other operations, etc).

The specific threat that they need to worry about is
firewall-management commands that flush *all* dynamic iptables rules.
So add a new iptables.Monitor() function that handles this by creating
iptables-flush canaries and only triggering a full rule reload after
noticing that someone has deleted those chains.
2019-09-17 10:19:26 -04:00
Kubernetes Prow Robot
61ecdba9ca
Merge pull request #82289 from robscott/endpointslice-fixes
Fixing bugs related to Endpoint Slices
2019-09-05 09:03:10 -07:00
Rob Scott
8f9483d827
Fixing bugs related to Endpoint Slices
This should fix a bug that could break masters when the EndpointSlice
feature gate was enabled. This was all tied to how the apiserver creates
and manages it's own services and endpoints (or in this case endpoint
slices). Consumers of endpoint slices also need to know about the
corresponding service. Previously we were trying to set an owner
reference here for this purpose, but that came with potential downsides
and increased complexity. This commit changes behavior of the apiserver
endpointslice integration to set the service name label instead of owner
references, and simplifies consumer logic to reference that (both are
set by the EndpointSlice controller).

Additionally, this should fix a bug with the EndpointSlice GenerateName
value that had previously been set with a "." as a suffix.
2019-09-04 09:09:32 -07:00
Mike Spreitzer
d86d1defa1 Made IPVS and iptables modes of kube-proxy fully randomize masquerading if possible
Work around Linux kernel bug that sometimes causes multiple flows to
get mapped to the same IP:PORT and consequently some suffer packet
drops.

Also made the same update in kubelet.

Also added cross-pointers between the two bodies of code, in comments.

Some day we should eliminate the duplicate code.  But today is not
that day.
2019-09-01 22:07:30 -04:00
Kubernetes Prow Robot
4495d09282
Merge pull request #81430 from robscott/endpointslice-proxy
Adding EndpointSlice support for kube-proxy ipvs and iptables proxiers
2019-08-29 15:36:44 -07:00
Rob Scott
9665c590c7
Adding EndpointSlice support for kube-proxy ipvs and iptables proxiers 2019-08-29 01:06:52 -07:00
Kubernetes Prow Robot
454e8e6e92
Merge pull request #80514 from liuxu623/master
don't delete KUBE-MARK-MASQ chain in iptables/ipvs proxier
2019-08-28 23:49:56 -07:00
Kubernetes Prow Robot
0a486d97ed
Merge pull request #81415 from oxddr/asdf
kube-proxy: improve logging around network programming latency SLI.
2019-08-23 15:48:39 -07:00
Janek Łukaszewicz
c33be173bf kube-proxy: improve logging around network programming latency SLI. 2019-08-23 15:48:25 +02:00
Kubernetes Prow Robot
9c736445f5
Merge pull request #79846 from aramase/fix-golint-pkg/proxy
Fix golint failures in pkg/proxy
2019-08-23 00:51:17 -07:00
Kubernetes Prow Robot
37651f1cef
Merge pull request #80368 from danwinship/iptables-checks
iptables feature detection improvements
2019-08-22 13:31:20 -07:00
liuxu
c90b295ef1 don't delete KUBE-MARK-MASQ chain in iptables/ipvs proxier 2019-08-20 15:43:54 +08:00
Tim Hockin
5b14394f4e Don't track syncProxyRules runtime if not running 2019-08-16 17:05:03 -07:00
hui luo
a2ef00c1b1 Add iptables restore failure metrics
As mentioned in issue #80061, in iptables lock contention case,
we can see increasing rate of iptables restore failures because it
need to grab iptables file lock.

The failure metric can provide administrators more insight

Metrics will be collected in kube-proxy iptables and ipvs modes

Signed-off-by: Hui Luo <luoh@vmware.com>
2019-08-09 10:18:19 -07:00
Dan Winship
a735c97356 kube-proxy: drop iptables version check
Kube-proxy's iptables mode used to care whether utiliptables's
EnsureRule was able to use "iptables -C" or if it had to implement it
hackily using "iptables-save". But that became irrelevant when
kube-proxy was reimplemented using "iptables-restore", and no one ever
noticed. So remove that check.
2019-08-01 12:05:31 -04:00
Anish Ramasekar
2878270f5b
Fix golint failures in pkg/proxy
Review feedback - remove alias from imports

fix comments
2019-07-08 11:48:33 -07:00
Kubernetes Prow Robot
da0f51ffed
Merge pull request #78820 from haosdent/fix_typos
Fix typos.
2019-07-01 15:09:20 -07:00
Andrew Sy Kim
ba19451020 iptables proxier: fix comments for LB IP traffic from local address
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-06-28 16:42:01 -04:00
Kubernetes Prow Robot
0c9964fac3
Merge pull request #76160 from JacobTanenbaum/BaseServiceInfo-cleanup
enforce the interface relationship between ServicePort and BaseServiceInfo
2019-06-13 20:37:13 -07:00
Haosdent Huang
7ce6e71891 Fix typos. 2019-06-11 01:52:14 +08:00
Jacob Tanenbaum
c0392d72e9 enforce the interface relationship between ServicePort and BaseServiceInfo
Currently the BaseServiceInfo struct implements the ServicePort interface, but
only uses that interface sometimes. All the elements of BaseServiceInfo are exported
and sometimes the interface is used to access them and othertimes not

I extended the ServicePort interface so that all relevent values can be accessed through
it and unexported all the elements of BaseServiceInfo
2019-06-05 14:50:24 -04:00
Kubernetes Prow Robot
bdf3d248eb
Merge pull request #77523 from andrewsykim/fix-xlb-from-local
iptables proxier: route local traffic to LB IPs to service chain
2019-05-31 12:22:53 -07:00
Kubernetes Prow Robot
929adb69e3
Merge pull request #76165 from JacobTanenbaum/minor-cleanups
Minor cleanups in pkg/proxy/endpoints.go
2019-05-15 22:55:55 -07:00
Kubernetes Prow Robot
74743793f2
Merge pull request #74027 from squeed/kube-proxy-metrics
proxy: add some useful metrics
2019-05-15 03:08:19 -07:00
Brad Hoekstra
62e58a66aa Fix some lint errors in pkg/proxy 2019-05-09 16:48:29 -04:00
Andrew Sy Kim
b926fb9d2b iptables proxier: route local traffic to LB IPs to service chain
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
2019-05-07 15:22:46 -04:00
Jacob Tanenbaum
9d4693a70f changing UpdateEndpointsMap to Update
changing UpdateEndpointsMap to be a function of the EndpointsMap object
2019-05-07 14:41:15 -04:00
Casey Callendrello
017f57a6b0 proxy: add some useful metrics
This adds some useful metrics around pending changes and last successful
sync time.

The goal is for administrators to be able to alert on proxies that, for
whatever reason, are quite stale.

Signed-off-by: Casey Callendrello <cdc@redhat.com>
2019-05-07 14:21:13 +02:00
Krzysztof Siedlecki
941629d37a
Revert "Add better logging when iptables-restore fails" 2019-05-07 13:37:29 +02:00
JieJhih Jhang
176d49300d combine two logics avoid for range the same thing 2019-05-01 18:35:52 +08:00
Kubernetes Prow Robot
a143d07b27
Merge pull request #76254 from JieJhih/fix/word
Fix spell error
2019-04-26 14:26:34 -07:00
Kubernetes Prow Robot
fa833a1e33
Merge pull request #74840 from anfernee/connreset
kube-proxy: Drop packets in INVALID state
2019-04-26 14:26:22 -07:00
Jay
9f2147161e Fix spell error 2019-04-08 15:49:29 +08:00