Commit Graph

177 Commits (abb70aee9875be5170b4a06b0fb45d4b0795c214)

Author SHA1 Message Date
fisherxu 5a9bea0353 update bazel 2018-08-16 09:59:33 +08:00
x00416946 fisherxu 79e17e6cd7 use versioned api in kube-proxy 2018-08-16 09:59:33 +08:00
Kubernetes Submit Queue 61226bdd7b
Merge pull request #66491 from Lion-Wei/ipvs-nodeip
Automatic merge from submit-queue (batch tested with PRs 66491, 66587, 66856, 66657, 66923). 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>.

optimize ipvs get nodeIP

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

Optimize ipvs get nodeIP.

The original ipvs `NodeIPs` need first get all local type address to set1, then get address of dummy device `kube-ipvs0` to set2, then do diff of set1 and set2 to get local addresses we need.
This work gonna result in unnecessary resource consumption, especially for large cluster, will have lots address in dummy device `kube-ipvs0`. 

This pr optimized the workaround.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:


**Release note**:
```release-note
NONE
```
2018-08-14 17:55:04 -07:00
liangwei 8a8b5845a9 optimize ipvs get nodeIP 2018-08-14 09:14:15 +08:00
Kubernetes Submit Queue 4492337dbf
Merge pull request #65803 from honkiko/ipvs-add-addrtype-match
Automatic merge from submit-queue. 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>.

ipvs: add addrtype match for nodeport

**What this PR does / why we need it**:
before this PR:
```
-A KUBE-SERVICES -m comment --comment "Kubernetes nodeport TCP port for masquerade purpose" -m set --match-set KUBE-NODE-PORT-TCP dst -j KUBE-NODE-PORT
-A KUBE-SERVICES -m comment --comment "Kubernetes service cluster ip + port for masquerade purpose" -m set --match-set KUBE-CLUSTER-IP dst,dst -j KUBE-MARK-MASQ
-A KUBE-SERVICES -m set --match-set KUBE-CLUSTER-IP dst,dst -j ACCEPT
-A KUBE-NODE-PORT -p tcp -m comment --comment "Kubernetes nodeport TCP port with externalTrafficPolicy=local" -m set --match-set KUBE-NODE-PORT-LOCAL-TCP dst -j RETURN
-A KUBE-NODE-PORT -j KUBE-MARK-MASQ
```
after this PR:
```
-A KUBE-NODE-PORT -p tcp -m comment --comment "Kubernetes nodeport TCP port with externalTrafficPolicy=local" -m set --match-set KUBE-NODE-PORT-LOCAL-TCP dst -j RETURN
-A KUBE-NODE-PORT -p tcp -m comment --comment "Kubernetes nodeport TCP port for masquerade purpose" -m set --match-set KUBE-NODE-PORT-TCP dst -j KUBE-MARK-MASQ
-A KUBE-SERVICES -m comment --comment "Kubernetes service cluster ip + port for masquerade purpose" -m set --match-set KUBE-CLUSTER-IP dst,dst -j KUBE-MARK-MASQ
-A KUBE-SERVICES -m set --match-set KUBE-CLUSTER-IP dst,dst -j ACCEPT
-A KUBE-SERVICES -m addrtype --dst-type LOCAL -j KUBE-NODE-PORT
```

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #65459

**Special notes for your reviewer**:
manually tested cases:
- ClusterIP distributed to pod on same node
- ClusterIP distributed to pod on other node
- NodePort distributed to pod on same node
- NodePort distributed to pod on other node

**Release note**:

```release-note

```
2018-08-13 00:28:43 -07:00
Kubernetes Submit Queue f250d676f9
Merge pull request #65960 from feiskyer/doc-ipvs
Automatic merge from submit-queue. 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>.

Document ipvs mode has GA in v1.11

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

Document ipvs mode has GA in v1.11.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-17 19:53:10 -07:00
Kubernetes Submit Queue fce58d25ac
Merge pull request #65425 from islinwb/ipvs_cleanup_rules
Automatic merge from submit-queue (batch tested with PRs 66136, 64999, 65425, 66120, 66074). 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>.

Not step into ipvs.CleanupLeftovers() if canUseIPVS's false

**What this PR does / why we need it**:
Earlier we decide whether we should clean up the left-over ipvs rules inside `ipvs.CleanupLeftovers()`, therefore we call function  `ipvs.CanUseIPVSProxier()` two times (and `GetModules()` two times).  Actually no need to step into `ipvs.CleanupLeftovers()` if `canUseIPVS` is false.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-07-12 15:14:16 -07:00
Kubernetes Submit Queue bcb74bc2db
Merge pull request #66064 from honkiko/fix-nodeport-local
Automatic merge from submit-queue (batch tested with PRs 66064, 66040). 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>.

fix Local externalTrafficPolicy is not respected for ipvs NodePort

**What this PR does / why we need it**:
Local externalTrafficPolicy is not respected for ipvs NodePort.
This PR fixes it.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #66062

**Special notes for your reviewer**:
Manually tested accessing NodePort with externalTrafficPolicy=Local  and externalTrafficPolicy=Cluster.

**Release note**:

```release-note

```
2018-07-12 01:34:23 -07:00
Hong Zhiguo 8bb6a5fa9c update TestOnlyLocalNodePorts to make sure only add local RS 2018-07-12 11:31:33 +08:00
Hong Zhiguo c6990f973f fix NodePort with Local policy not working 2018-07-11 16:48:34 +08:00
Russ Cox 2bd91dda64 kubernetes: fix printf format errors
These are all flagged by Go 1.11's
more accurate printf checking in go vet,
which runs as part of go test.

Lubomir I. Ivanov <neolit123@gmail.com>
applied ammend for:
  pkg/cloudprovider/provivers/vsphere/nodemanager.go
2018-07-11 00:10:15 +03:00
Pengfei Ni 1bc6102110 Document ipvs mode has GA in v1.11 2018-07-09 12:49:45 +08:00
wojtekt 6e50f39dbd Avoid allocations when parsing iptables 2018-07-08 10:55:19 +02:00
Kubernetes Submit Queue e1ed79c804
Merge pull request #65264 from xujieasd/ipvs-bind-address
Automatic merge from submit-queue. 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>.

add cleanLegacyBindAddr

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

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #65263

**Special notes for your reviewer**:
To fix the issue,   
use `activeBindAddrs` map which represents ip address successfully bind to DefaultDummyDevice in the round of sync  
use `currentBindAddrs` map which represents ip addresses bind to DefaultDummyDevice from the system  
create a function `cleanLegacyBindAddr` to unbind address which is in `currentBindAddrs` map but not in `activeBindAddrs` map

**Release note**:

```release-note
NONE
```

/sig network
/area kube-proxy
2018-07-06 05:54:39 -07:00
Hong Zhiguo b2bf173aaf ipvs: add addrtype match for nodeport 2018-07-04 17:33:31 +08:00
Hong Zhiguo 56a717ef3d fix missing protocol match in ipvs mode 2018-07-01 12:17:55 +08:00
Hong Zhiguo 0e6f0736ce ipvs: remove duplicated masq rules
Duplicated masq rules are created by current implementation:

    -A KUBE-NODE-PORT -m comment --comment "mark MASQ for
externaltrafficpolicy=cluster" -j KUBE-MARK-MASQ
    -A KUBE-NODE-PORT -j KUBE-MARK-MASQ

The last one is always there. So the one inside if statement could
just be removed.
2018-06-27 22:17:21 +08:00
Weibin Lin 405d5f802c Not step into ipvs.CleanupLeftovers() if canUseIPVS's false 2018-06-25 11:18:18 +08:00
xujieasd 7973626e94 add cleanLegacyBindAddr
update gofmt && modify comment && modify currentBindAddrs

modify log to Upper-case
2018-06-25 10:37:57 +08:00
Kubernetes Submit Queue 966c77c83f
Merge pull request #65388 from DataDog/lbernail/fix-ipvs-from-host
Automatic merge from submit-queue (batch tested with PRs 65388, 64995). 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>.

Always create kubeClusterIPSet in ipvs proxier

**What this PR does / why we need it**:
This PR creates the kubeClusterIPSet ipset even if kube-proxy is started without masqueradeAll and clusterCIDR.
This is necessary to masquerade traffic sent to a clusterIP from the host network namespace. The code to do so is actually already present here: https://github.com/kubernetes/kubernetes/blob/master/pkg/proxy/ipvs/proxier.go#L1220-L1244

However the second else (neither masqueradeAll nor clusterCIDR are set) cannot be used because, before this PR, the initial test `if !proxier.ipsetList[kubeClusterIPSet].isEmpty()` can never return true when masqueradeAll and clusterCIDR are not set because kubeClusterIPSet is empty.

**Which issue(s) this PR fixes** 
Fixes #65158

```release-note
Allow access to ClusterIP from the host network namespace when kube-proxy is started in IPVS mode without either masqueradeAll or clusterCIDR flags
```

**Additional comment**
Issue #65158 is closed because ClusterIP access from the host has already fixed in master, except for the case described here (no masquerade flag). More detail in the issue.
2018-06-23 05:52:04 -07:00
Jeff Grafton 23ceebac22 Run hack/update-bazel.sh 2018-06-22 16:22:57 -07:00
Jeff Grafton a725660640 Update to gazelle 0.12.0 and run hack/update-bazel.sh 2018-06-22 16:22:18 -07:00
Laurent Bernaille e1cf2eec09 Always create kubeClusterIPSet 2018-06-22 22:53:03 +02:00
Kubernetes Submit Queue 4905c339cc
Merge pull request #64941 from Lion-Wei/ipvs-test
Automatic merge from submit-queue (batch tested with PRs 65024, 65287, 65345, 64693, 64941). 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>.

complete ipvs proxier ut

**What this PR does / why we need it**:
Complete ipvs proxier ut:
1. Finish loadbalancer type service test.
2. Add external ip local case.
3. Add UDP type nodeport test.
4. Add TestCleanupLeftovers test.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #61390

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2018-06-22 06:10:24 -07:00
Kubernetes Submit Queue 79a7845582
Merge pull request #63640 from Lion-Wei/ipvs-readme
Automatic merge from submit-queue. 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>.

update ipvs readme file

**What this PR does / why we need it**:
Since some iptables rules that ipvs proxier installed have changed, we need update ipvs readme file.

**Special notes for your reviewer**:
1. fix some error, like nodePort realization.
2. Update iptables rules.
3. Add externalIP
4. Add ipset sets introduction

**Release note**:
```release-note
NONE
```
2018-06-19 18:46:09 -07:00
Kubernetes Submit Queue 6edcdae5d7
Merge pull request #64737 from Lion-Wei/ipvs-review
Automatic merge from submit-queue. 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>.

add Lion-Wei to ipvs reviewers list
2018-06-19 18:45:16 -07:00
Kubernetes Submit Queue 24323e2ee6
Merge pull request #62513 from gyliu513/ipvs-beta
Automatic merge from submit-queue. 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>.

Do not need to set SupportIPVSProxyMode after 1.10.

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

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```

`SupportIPVSProxyMode` is `true` by default since 1.10, there is no need to set it explicitly any more.

/area ipvs

/cc @m1093782566
2018-06-19 18:44:05 -07:00
liangwei a270d14a00 complete ipvs proxier test 2018-06-09 16:00:54 +08:00
Kubernetes Submit Queue 5aa8d690a1
Merge pull request #64554 from hanxiaoshuai/fix05312
Automatic merge from submit-queue. 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>.

fix bug excludeCIDRs was not assign in func NewProxier

**What this PR does / why we need it**:
fix bug excludeCIDRs was not assign in func NewProxier
**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-06-09 00:01:29 -07:00
Guangya Liu 9cba55dac1 SupportIPVSProxyMode is true by default. 2018-06-07 19:44:11 +08:00
Lion-Wei c20bb4a7ee modify ipvs readme 2018-06-07 14:39:12 +08:00
Lion-Wei ec752d416c add Lion-Wei to ipvs reviewers list 2018-06-05 11:23:50 +08:00
Kubernetes Submit Queue 440b2b6ea7
Merge pull request #61077 from islinwb/fix_ipvs_warninfo
Automatic merge from submit-queue. 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>.

Init ipvsInterface only when ipvs modules are present

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

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #61074 

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-31 20:01:26 -07:00
hangaoshuai c3ee2802e4 fix bug excludeCIDRs was not assign in func NewProxier 2018-06-01 09:27:55 +08:00
hangaoshuai 9d944d30a6 remove unused parameter in func buildFakeProxier 2018-05-30 15:18:07 +08:00
Kubernetes Submit Queue 85f9108df1
Merge pull request #63964 from islinwb/update_ipvs_docs
Automatic merge from submit-queue. 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>.

Update ipvs docs --- check the prerequisite

**What this PR does / why we need it**:
As #63850 have been merged, the `Prerequisite` should be updated.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-28 04:24:30 -07:00
Rene Treffer f66d4e183f Always masquerade node-originating traffic with a service VIP source ip 2018-05-24 09:42:48 +02:00
Kubernetes Submit Queue 094e605cd0
Merge pull request #64146 from Lion-Wei/ipvs-lb
Automatic merge from submit-queue (batch tested with PRs 64034, 64072, 64146, 64059, 64161). 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>.

fix session affinity for LoadBalancer service with ESIPP

**What this PR does / why we need it**:
fix session affinity for LoadBalancer service with ESIPP

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #63351

**Special notes for your reviewer**:
In cases that loadbalancer type service with externaltrafficpolicy=local and session-affinity specified, traffic to loadbalancer should only route to backends that in the same node with kube-proxy. 

**Release note**:
```release-note
NONE
```
2018-05-22 19:20:18 -07:00
liangwei 62e3285cf8 ipvs lb local session affinity 2018-05-22 19:51:54 +08:00
Weibin Lin f86af07526 Update ipvs docs --- check the prerequisite 2018-05-18 09:46:10 +08:00
Weibin Lin ff8b70c409 Init ipvsInterface only when ipvs modules are present 2018-05-17 15:04:20 +08:00
Kubernetes Submit Queue 6406b9653d
Merge pull request #63850 from islinwb/check_ipvs_mod
Automatic merge from submit-queue. 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>.

Enable checking whether ipvs modules are built-in or not

**What this PR does / why we need it**:
Enable checking whether ipvs modules are built-in or not.

**Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*:
Fixes #63801

**Special notes for your reviewer**:

**Release note**:

```release-note
NONE
```
2018-05-16 03:33:20 -07:00
Weibin Lin c3e2fc0c0f Enable checking whether ipvs modules are built-in or not 2018-05-16 15:23:01 +08:00
Lion-Wei 339f92c175 abstract duplicated code in ipvs proxier 2018-05-16 11:53:15 +08:00
Weibin Lin 1558d13ca0
Add comments for ipset entries in kube-proxy - fix 2018-05-15 17:27:12 +08:00
Kubernetes Submit Queue fc28745535
Merge pull request #62003 from m1093782566/fix-nodeport
Automatic merge from submit-queue (batch tested with PRs 63787, 62003). 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>.

Fix localport open with --nodeport-addresses specified

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

Fix localport open with --nodeport-addresses specified.

**Which issue(s) this PR fixes**:
Fixes #61953

**Special notes for your reviewer**:

@ephur

**Release note**:

```release-note
Services can listen on same host ports on different interfaces with --nodeport-addresses specified
```
2018-05-14 12:21:12 -07:00
m1093782566 029a16a1eb fix review comments 2018-05-14 16:07:13 +08:00
Weibin Lin 10664ee8c6 Add comments for ipset entries in kube-proxy 2018-05-11 17:11:34 +08:00
Lion-Wei e90de22a5e fix ipvs fw 2018-05-07 11:22:34 +08:00
m1093782566 8b16d66b46 add some comment message 2018-05-02 17:02:07 +08:00