Commit Graph

162 Commits

Author SHA1 Message Date
Wojciech Tyczynski
03c255d7c5 Store chain names to avoid recomputing them multiple times 2017-05-30 10:50:10 +02:00
Wojciech Tyczynski
c4d51f12a2 Store port endpoint chain names to avoid recomputing it multiple times 2017-05-30 10:49:36 +02:00
Wojciech Tyczynski
88e3e8f470 Reuse args slice for generating iptable rules. 2017-05-30 10:49:35 +02:00
Wojciech Tyczynski
070f393bc8 Precompute probabilities in iptables kube-proxy. 2017-05-30 10:49:34 +02:00
Wojciech Tyczynski
1242e8ca20 Minor improvement for memory allocations 2017-05-30 08:11:12 +02:00
Tim Hockin
2856fde23b Use BoundedFrequencyRunner in kube-proxy 2017-05-24 20:33:15 -07:00
Tim Hockin
578d9fcf63 Logging/naming cleanup for service port names 2017-05-24 20:33:15 -07:00
Kubernetes Submit Queue
6f5193593d Merge pull request #46201 from wojtek-t/address_kubeproxy_todos
Automatic merge from submit-queue

Address remaining TODOs in kube-proxy.

Followup PR from the previous two.
2017-05-22 20:54:14 -07:00
Wojciech Tyczynski
9e6de42745 Remove Save() from iptables interface 2017-05-22 13:23:49 +02:00
Wojciech Tyczynski
ee505677f7 Address remaining TODOs in kube-proxy. 2017-05-22 09:18:55 +02:00
Wojciech Tyczynski
7ba30afbed Fix codestyle 2017-05-20 18:46:29 +02:00
Wojciech Tyczynski
758c9666e5 Call syncProxyRules when really needed and remove reasons 2017-05-20 18:46:28 +02:00
Wojciech Tyczynski
c0c41aa083 Check whether service changed 2017-05-20 14:22:56 +02:00
Wojciech Tyczynski
05ffcccdc1 Check whether endpoints change 2017-05-20 14:22:07 +02:00
Wojciech Tyczynski
37a6989c79 Cleanup iptables proxier 2017-05-20 14:17:03 +02:00
Wojciech Tyczynski
a3da8d7300 Fix naming and comments in kube-proxy. 2017-05-19 21:34:05 +02:00
Wojciech Tyczynski
7d44f83441 Descrese logs verbosity for iptables 2017-05-19 20:44:26 +02:00
Wojciech Tyczynski
e3bb755270 Reuse buffers for generated iptables rules 2017-05-19 20:44:26 +02:00
Wojciech Tyczynski
4d29c8608f Avoid strings.Join which is expensive 2017-05-19 20:44:25 +02:00
Wojciech Tyczynski
5464c39333 Reuse buffer for getting iptables contents 2017-05-19 20:44:25 +02:00
Zihong Zheng
aca4d469b2 Revert "Remove reasons from iptables syncProxyRules"
This reverts commit 77624a12d3.
2017-05-17 16:33:13 -07:00
Wojciech Tyczynski
45ed99c3a6 Add syncProxyRules prometheus metric 2017-05-17 19:26:58 +02:00
Kubernetes Submit Queue
35eba22cc7 Merge pull request #41162 from MrHohn/esipp-ga
Automatic merge from submit-queue (batch tested with PRs 45623, 45241, 45460, 41162)

Promotes Source IP preservation for Virtual IPs from Beta to GA

Fixes #33625. Feature issue: kubernetes/features#27.

Bullet points:
- Declare 2 fields (ExternalTraffic and HealthCheckNodePort) that mirror the ESIPP annotations.
- ESIPP alpha annotations will be ignored.
- Existing ESIPP beta annotations will still be fully supported.
- Allow promoting beta annotations to first class fields or reversely.
- Disallow setting invalid ExternalTraffic and HealthCheckNodePort on services. Default ExternalTraffic field for nodePort or loadBalancer type service to "Global" if not set.

**Release note**:

```release-note
Promotes Source IP preservation for Virtual IPs to GA.

Two api fields are defined correspondingly:
- Service.Spec.ExternalTrafficPolicy <- 'service.beta.kubernetes.io/external-traffic' annotation.
- Service.Spec.HealthCheckNodePort <- 'service.beta.kubernetes.io/healthcheck-nodeport' annotation.
```
2017-05-12 15:00:46 -07:00
Kubernetes Submit Queue
5576fafc63 Merge pull request #45723 from wojtek-t/simplify_iptables_proxy
Automatic merge from submit-queue (batch tested with PRs 45685, 45572, 45624, 45723, 45733)

Remove reasons from iptables syncProxyRules

The reasons are no longer useful, since we know if something changed anyway, I think.
2017-05-12 14:00:59 -07:00
Zihong Zheng
7ed716a997 Change to use ESIPP first class fields and update comments 2017-05-12 10:59:00 -07:00
Wojciech Tyczynski
77624a12d3 Remove reasons from iptables syncProxyRules 2017-05-12 13:32:02 +02:00
Shyam Jeedigunta
27fa52390b Use real proxier inside hollow-proxy but with mocked syscalls 2017-05-10 23:45:26 +02:00
Kubernetes Submit Queue
332b095ca9 Merge pull request #44968 from MrHohn/kube-proxy-healthcheck
Automatic merge from submit-queue (batch tested with PRs 44727, 45409, 44968, 45122, 45493)

Separate healthz server from metrics server in kube-proxy

From #14661, proposal is on kubernetes/community#552.

Couple bullet points as in commit:
- /healthz will be served on 0.0.0.0:10256 by default.
- /metrics and /proxyMode will be served on port 10249 as before.
- Healthz handler will verify timestamp in iptables mode.

/assign @nicksardo @bowei @thockin 

**Release note**:

```release-note
NONE
```
2017-05-08 14:54:38 -07:00
Zihong Zheng
ca59d909cf Separate healthz server from metrics server in kube-proxy
- /healthz will be served on 0.0.0.0:10256 by default.
- /metrics and /proxyMode will be served on port 10249
  as before.
- Healthz handler will verify timestamp in iptables mode.
2017-05-05 14:43:44 -07:00
Zihong Zheng
1cac5db856 Fix onlylocal endpoint's healthcheck nodeport logic 2017-05-02 09:47:27 -07:00
Wojciech Tyczynski
eb6949a53e Change locking mechanism in kube-proxy 2017-04-28 09:40:39 +02:00
Ketan Kulkarni
ac7c026ee7 Reject Rules for ExternalIP and svc port if no ep
- Install ICMP Reject Rules for externalIP and svc port
  if no endpoints are present
- Includes Unit Test case
- Fixes #44516
2017-04-21 16:48:24 -07:00
Wojciech Tyczynski
c7353432df Don't rebuild service map in iptables kube-proxy all the time 2017-04-21 09:41:27 +02:00
Wojciech Tyczynski
2f250435fd Don't rebuild endpoints map in iptables kube-proxy all the time. 2017-04-20 08:34:46 +02:00
Wojciech Tyczynski
7a647f9d1a Event-based iptables proxy for services 2017-04-18 13:30:59 +02:00
Zihong Zheng
ae93b0da15 Refine NeedsHealthCheck logic 2017-04-17 14:26:02 -07:00
Kubernetes Submit Queue
284615d79d Merge pull request #43702 from wojtek-t/edge_based_proxy
Automatic merge from submit-queue

Edge-based userspace LB in kube-proxy

@thockin @bowei - if one of you could take a look if that PR doesn't break some basic kube-proxy assumptions. The similar change for winuserproxy should be pretty trivial.

And we should also do that for iptables, but that requires splitting the iptables code to syncProxyRules (which from what I know @thockin already started working on so we should probably wait for it to be done).
2017-04-12 00:30:53 -07:00
Chao Xu
08aa712a6c move helpers.go to helper 2017-04-11 15:49:11 -07:00
Dan Williams
70e53ace17 proxy/iptables: precompute svcPortName strings
With many services, the calls to svcPortName.String() show up as a
somewhat significant CPU user under syncProxyRules().
2017-04-10 12:49:06 -05:00
Wojciech Tyczynski
b1475565e6 Edge-based iptables proxy 2017-04-10 13:12:45 +02:00
Tim Hockin
9bfb88d2d7 Fix a couple nits from previous reviews. 2017-04-07 20:47:11 -07:00
Tim Hockin
c716886215 Put service/endpoint sync into syncProxyRules
After this, syncProxyRules() can reliably be called in any context to do
the right thing.  Now it cn be made async.
2017-04-07 20:47:00 -07:00
Kubernetes Submit Queue
6cd23c6023 Merge pull request #44167 from soundcloud/mr/restore-updating-endpoints-log-message
Automatic merge from submit-queue

Restore "Setting endpoints" log message

**What this PR does / why we need it**:

The "Setting endpoints" message from kube-proxy at high verbosity was
lost as part of a larger simplification in kubernetes/kubernetes#42747.

This change brings it back, simply outputting the just-constructed
addresses list.

I need this message to monitor delays in propagating endpoints changes across nodes.

**Release note**:

```release-note
NONE
```
2017-04-06 14:04:09 -07:00
Kubernetes Submit Queue
033bf6fd8b Merge pull request #44053 from thockin/proxy-healthchecks
Automatic merge from submit-queue (batch tested with PRs 43871, 44053)

Proxy healthchecks overhaul

The first commit is #44051 

These three commits are tightly coupled, but should be reviewed one-by-one.  The first adds tests for healthchecks, and found a bug.  The second basically rewrites the healthcheck pkg to be much simpler and less flexible (since we weren't using the flexibility).  The third tweaks how healthchecks are handled in endpoints-path to be more like they are in services-path.

@MrHohn because I know you were in here for source-IP GA work.

@wojtek-t
2017-04-06 12:36:26 -07:00
Matthias Rampke
7bc6f81dd6 Generate dereferenced array of endpoints
for printing. Only do this if verbosity requires it.
2017-04-06 18:26:10 +00:00
Matthias Rampke
06ed262ff8 Restore "Setting endpoints" log message
The "Setting endpoints" message from kube-proxy at high verbosity was
lost as part of a larger simplification in kubernetes/kubernetes#42747.

This change brings it back, simply outputting the just-constructed
addresses list.
2017-04-06 15:40:52 +00:00
Kubernetes Submit Queue
bc8a7556d8 Merge pull request #43972 from thockin/fix-43969-proxy-filter-input
Automatic merge from submit-queue

kube-proxy: filter INPUT as well as OUTPUT

We need to apply filter rules on the way in (nodeports) and out (cluster
IPs).  Testing here is insufficient to have caught this - will come back
for that.

Fixes #43969

@justinsb since you have the best repro, can you test?  It passes what I think is repro.

@ethernetdan we will want this in 1.6.x

```release-note
Fix bug with service nodeports that have no backends not being rejected, when they should be.  This is not a regression vs v1.5 - it's a fix that didn't quite fix hard enough.
```
2017-04-05 23:18:29 -07:00
Tim Hockin
5e43c14098 Return healthcheck info from buildNewEndpointsMap 2017-04-05 14:23:04 -07:00
Tim Hockin
87d3f2c622 overhaul proxy healthchecks
The existing healthcheck lib was pretty complicated and was hiding some
bugs (like the count always being 1),  This is a reboot of the interface
and implementation to be significantly simpler and better tested.
2017-04-05 14:22:56 -07:00
Tim Hockin
7664b97ed2 Add tests for kube-proxy healthcheck, fix bug
Adding test cases for HC updates found a bug with an update that
simultaneously removes one port and adds another.  Map iteration is
randomized, so sometimes no HC would be created.
2017-04-04 20:11:06 -07:00