Commit Graph

266 Commits (750881c0ab62a9f59d53582bc33826caa167aa83)

Author SHA1 Message Date
Laurent Bernaille 7acb5a67fb [kube-proxy/ipvs] Display RS complete name in logs
Help distinguish UDP and TCP RS (useful for DNS which uses both)
2018-11-28 18:02:11 +01:00
Lars Ekman 2e5a985e47 Updates after review 2018-11-19 11:44:17 +01:00
Lars Ekman 1be71b8a99 Add the extra parameter for non-linux code 2018-11-19 10:02:48 +01:00
liangwei f39060c604 set net/ipv4/vs/conn_reuse_mode to 0 2018-11-16 15:17:24 +08:00
Lars Ekman e2409a054b Fixes NodePort in ipv6 with proxy-mode=ipvs. #68437
Use ipv6 addresses for NodePort with proxy-mode=ipvs in a
ipv6-only cluster.
2018-11-14 12:34:06 +01:00
AdamDang cc4d38c768 Typo fix: healtcheck->healthcheck (#65394)
Typo fix: healtcheck->healthcheck

Typo fix: healtcheck->healthcheck
2018-11-13 19:45:24 -08:00
k8s-ci-robot d8e78c8ac5
Merge pull request #66149 from honkiko/do-not-take-all-endpoints-into-ipset
hairpin ipset could only contain local endpoints
2018-11-12 02:04:09 -08:00
Davanum Srinivas 954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
k8s-ci-robot 7984a2bf60
Merge pull request #70564 from KevinWang15/master
Fix typos
2018-11-05 19:04:45 -08:00
Ke Wang 946c701b05 Fix Typo: mataData -> metaData; masquared -> masquerade 2018-11-05 21:19:25 +08:00
Weibin Lin 4b90559369 use 'nf_conntrack' instead of 'nf_conntrack_ipv4' for linux kernel >= 4.19 2018-11-05 10:33:31 +08:00
Timo Derstappen 90d2c5ca5a
flush iptable chains first and then remove them
while cleaning up ipvs mode. flushing iptable chains first and then
remove the chains. this avoids trying to remove chains that are still
referenced by rules in other chains.

fixes #70615
2018-11-03 11:36:14 +01:00
kvaps 489e95bc30 Set arp_ignore and arp_announce flags 2018-11-01 10:38:42 +01:00
Weibin Lin 95d379021b add module 'nf_conntrack' in ipvs prerequisite check 2018-10-27 16:40:38 +08:00
k8s-ci-robot 3b5d2e865e
Merge pull request #68436 from Nordix/issue-67799
Create ipsets with family inet6 in an ipv6-only cluster
2018-10-24 02:16:11 -07:00
xujieasd 4eab9406fa add UT code for cleanLegacyBindAddr
gofmt modify

change api to v1
2018-10-17 11:04:26 +08:00
Weibin Lin 73e3d8a081 Improve the ipvs error message 2018-10-10 16:16:58 +08:00
liangwei 456c351e31 fix bugs introduced by ipvs graceful termination 2018-09-30 16:40:13 +08:00
liangwei 9e4f84f42e ipvs connection based graceful termination 2018-09-27 15:16:48 +08:00
liangwei 80ff8b359c ipvs support graceful termination 2018-09-27 15:14:51 +08:00
k8s-ci-robot 3fe21e5433
Merge pull request #68922 from BenTheElder/version-staging
move pkg/util/version to staging
2018-09-26 22:59:42 -07:00
k8s-ci-robot 4ca9fa737e
Merge pull request #68760 from jessfraz/only-set-sysctl-if-not-set
pkg/proxy: only set sysctl if not already set
2018-09-26 04:56:59 -07:00
k8s-ci-robot fdd9c2e2a0
Merge pull request #67990 from tizhou86/newPR5
Fix golint error under pkg/proxy.
2018-09-24 17:17:19 -07:00
Benjamin Elder 8b56eb8588 hack/update-gofmt.sh 2018-09-24 12:21:29 -07:00
Benjamin Elder f828c6f662 hack/update-bazel.sh 2018-09-24 12:03:24 -07:00
Benjamin Elder 088cf3c37b find & replace version import 2018-09-24 12:03:24 -07:00
Jess Frazelle f8ba640ced
pkg/proxy: only set sysctl if not already set
This will allow for kube-proxy to be run without `privileged` and
with only adding the capability `NET_ADMIN`.

Signed-off-by: Jess Frazelle <acidburn@microsoft.com>
2018-09-19 15:29:53 -04:00
Jia Xin 4ca62e4f39 Restore *filter table for ipvs
Resolve: #68194
2018-09-18 20:26:27 +08:00
Lars Ekman 0db4f6af4a Fix for #67799
Ipsets are now created with "family inet6" in an ipv6-only
cluster.
2018-09-08 19:48:40 +02:00
song a3b40dd7b7 fix typo in ipvs RADME.md 2018-09-03 11:34:09 +08:00
Kubernetes Submit Queue ef741c3038
Merge pull request #68075 from riverzhang/fix-ipvs-readme
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Fix how to use ipvs mode by kubeadm

**What this PR does / why we need it**:
how to use ipvs mode by kubeadm
**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

```
2018-08-31 14:16:16 -07:00
rongzhang 4f6b5734a1 Fix how to use ipvs mode by kubeadm 2018-08-31 22:16:40 +08:00
Kubernetes Submit Queue 11c47e1872
Merge pull request #67948 from wojtek-t/use_buffers_in_kube_proxy
Automatic merge from submit-queue (batch tested with PRs 66577, 67948, 68001, 67982). If you want to cherry-pick this change to another branch, please follow the instructions here: https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md.

Reduce amount of allocations in kube-proxy

Follow up from https://github.com/kubernetes/kubernetes/pull/65902
2018-08-29 16:33:34 -07:00
tizhou86 f18c133360 Fix golint error under pkg/proxy. 2018-08-29 16:16:29 +08:00
wojtekt 8fb365df32 Reduce amount of allocations in kube-proxy 2018-08-28 15:18:58 +02:00
Laszlo Janosi cbe94df8c6 gofmt update 2018-08-27 05:59:50 +00:00
Laszlo Janosi e466bdc67e Changes according to the approved KEP. SCTP is supported for HostPort and LoadBalancer. Alpha feature flag SCTPSupport controls the support of SCTP. Kube-proxy config parameter is removed. 2018-08-27 05:58:36 +00:00
Laszlo Janosi a6da2b1472 K8s SCTP support implementation for the first pull request
The requested Service Protocol is checked against the supported protocols of GCE Internal LB. The supported protocols are TCP and UDP.

SCTP is not supported by OpenStack LBaaS. If SCTP is requested in a Service with type=LoadBalancer, the request is rejected. Comment style is also corrected.

SCTP is not allowed for LoadBalancer Service and for HostPort. Kube-proxy can be configured not to start listening on the host port for SCTP: see the new SCTPUserSpaceNode parameter

changed the vendor github.com/nokia/sctp to github.com/ishidawataru/sctp. I.e. from now on we use the upstream version.

netexec.go compilation fixed. Various test cases fixed

SCTP related conformance tests removed. Netexec's pod definition and Dockerfile are updated to expose the new SCTP port(8082)

SCTP related e2e test cases are removed as the e2e test systems do not support SCTP

sctp related firewall config is removed from cluster/gce/util.sh. Variable name sctp_addr is corrected to sctpAddr in pkg/proxy/ipvs/proxier.go

cluster/gce/util.sh is copied from master
2018-08-27 05:56:27 +00:00
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
Hong Zhiguo 647edfd6ed only add local endpoints into the hairpin ipset 2018-07-13 13:00:50 +08: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
Kubernetes Submit Queue 191d3c5681
Merge pull request #62718 from Lion-Wei/ipvs-host
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 problem that ipvs can't work with hostPort

**What this PR does / why we need it**:
Make ipvs proxy mode can work with pods that have hostPort.

**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 #61938
#60688 and #60305 are related too.

**Special notes for your reviewer**:
IPVS proxier will create dummy device named `kube-ipvs0`, which will maintain all ipvs virtual service address. That means all ipvs maintained clusterIP/externalIP/ingress will be treat as local address.

Then if we have a pod with hostPort, cni will attach this rule to `PREROUTING` chain:
```
KUBE-HOSTPORTS  all  --  0.0.0.0/0            0.0.0.0/0            /* kube hostport portals */ ADDRTYPE match dst-type LOCAL
```
so if a service have same port with pod's hostport, then this service can't be access.

In this pr, we added `ACCESS` rule for traffic that aim to ipvs virtual service, to prevent those traffic from be blocked by other rules.

**Release note**:
```release-note
NONE
```
2018-04-27 19:50:45 -07:00
Lion-Wei 76f6158b6c add accept for ipvs 2018-04-27 14:38:09 +08:00
Kubernetes Submit Queue 9a841b3efd
Merge pull request #63066 from Lion-Wei/ipvs-dummy
Automatic merge from submit-queue (batch tested with PRs 63129, 63066, 60009, 63136, 63086). 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 proxy bind externalIP and lb ingress.IP to dummy interface

**What this PR does / why we need it**:
IPVS proxy bind externalIP and lb ingress.IP to dummy interface.

**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 #59976

**Special notes for your reviewer**:

**Release note**:
```release-note
NONE
```
2018-04-25 06:29:19 -07:00
Kubernetes Submit Queue c0d1ab8e99
Merge pull request #62083 from rramkumar1/ipvs-exclude-cidrs-flag
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 --ipvs-exclude-cidrs flag to kube-proxy. 

**What this PR does / why we need it**:
Add a flag to kube-proxy called --ipvs-exclude-cidrs. This flag allows a user to specify a list of CIDR ranges that should not be included in the cleanup of IPVS rules. 

Fixes: #59507

**Release note**:
```
Use --ipvs-exclude-cidrs to specify a list of CIDR's which the IPVS proxier should not touch when cleaning up IPVS rules.
```
/assign @m1093782566
2018-04-24 11:13:14 -07:00
Lion-Wei 1824053000 bind externalIP and lb IP 2018-04-24 15:40:20 +08:00
Lion-Wei 74e28b6402 fix ipvs delay on sync rules 2018-04-19 17:02:44 +08:00
Rohit Ramkumar 056ae4421c Add --ipvs-exclude-cidrs flag to kube-proxy. 2018-04-13 10:09:14 -07:00
m1093782566 00430b4b6c fix nodeport FORWARD chain 2018-04-12 17:25:28 +08:00
Kubernetes Submit Queue 9bd6c62a36
Merge pull request #61329 from Lion-Wei/ipvs-esipp
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 externaltrafficpolicy=local related ipvs ci case

**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 #61328

**Special notes for your reviewer**:
To realize externalTrafficPolicy=local, but do not affect traffic inside the cluster.
If thie pr got merged, the iptables rules of ipvs proxy mode ESIPP should be like(for loadbalance case):
```
Chain KUBE-FIRE-WALL (1 references)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            match-set KUBE-LB-INGRESS-LOCAL dst,dst
KUBE-MARK-MASQ  all  --  0.0.0.0/0            0.0.0.0/0            /* mark MASQ for external traffic policy not local */

Chain KUBE-MARK-DROP (0 references)
target     prot opt source               destination         
MARK       all  --  0.0.0.0/0            0.0.0.0/0            MARK or 0x8000

Chain KUBE-MARK-MASQ (3 references)
target     prot opt source               destination         
MARK       all  --  0.0.0.0/0            0.0.0.0/0            MARK or 0x4000

Chain KUBE-NODE-PORT (1 references)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            match-set KUBE-NODE-PORT-LOCAL-TCP dst
KUBE-MARK-MASQ  all  --  0.0.0.0/0            0.0.0.0/0            /* mark MASQ for external traffic policy not local */

Chain KUBE-POSTROUTING (0 references)
target     prot opt source               destination         
MASQUERADE  all  --  0.0.0.0/0            0.0.0.0/0            /* kubernetes service traffic requiring SNAT */ mark match 0x4000/0x4000
MASQUERADE  all  --  0.0.0.0/0            0.0.0.0/0            match-set KUBE-LOOP-BACK dst,dst,src

Chain KUBE-SERVICES (2 references)
target     prot opt source               destination         
KUBE-MARK-MASQ  all  -- !10.64.0.0/14         0.0.0.0/0            match-set KUBE-CLUSTER-IP dst,dst
KUBE-FIRE-WALL  all  --  0.0.0.0/0            0.0.0.0/0            match-set KUBE-LOAD-BALANCER-MASQ dst,dst
KUBE-NODE-PORT  tcp  --  0.0.0.0/0            0.0.0.0/0            tcp match-set KUBE-NODE-PORT-TCP dst
```

**Release note**:
```release-note
NONE
```
2018-04-07 21:33:13 -07:00
Lion-Wei 076007b25d update build and s/where/which 2018-04-08 10:32:56 +08:00
Lion-Wei 2acd0abd8c add ut 2018-04-08 10:32:49 +08:00