Commit Graph

77 Commits

Author SHA1 Message Date
cyclinder
bef2070031
kube-proxy: add a flag to disables the allowing NodePort services to be accessed via localhost 2022-11-02 16:17:52 +08:00
Claudiu Belu
af77381e01 unit tests: Skip Windows-unrelated tests on Windows
Some of the unit tests cannot pass on Windows due to various reasons:

- fsnotify does not have a Windows implementation.
- Proxy Mode IPVS not supported on Windows.
- Seccomp not supported on Windows.
- VolumeMode=Block is not supported on Windows.
- iSCSI volumes are mounted differently on Windows, and iscsiadm is a
  Linux utility.
2022-10-18 12:43:07 +03:00
Amim Knabben
7df6c02288 Remove Linux and Windows Kube-proxy Userspace mode 2022-10-05 16:59:02 -03:00
ialidzhikov
17c14ced18 cmd/kube-proxy: Replace deprecated func usage from the k8s.io/utils/pointer pkg 2022-08-13 22:01:02 +03:00
Surya Seetharaman
7d480d8ac8 Enable local traffic detection using the interface options
This commit adds the framework for the new local detection
modes BridgeInterface and InterfaceNamePrefix to work.

Signed-off-by: Surya Seetharaman <suryaseetharaman.9@gmail.com>
2022-03-25 20:06:12 +01:00
ahrtr
972dc46a1f replace deprecated io/ioutil with os and io for cmd 2022-02-01 13:59:41 +08:00
Kubernetes Prow Robot
9c35c491f0
Merge pull request #91450 from gaurav1086/kube_proxy_test_fix_goroutine_leak
kube-proxy-test: fix goroutine leak
2020-12-08 16:28:08 -08:00
Antonio Ojea
56df70b639 kube-proxy detect IP family based on nodeIP
We were detecting the IP family that kube-proxy should use
based on the bind address, however, this is not valid when
using an unspecified address, because on those cases
kube-proxy adopts the IP family of the address reported
in the Node API object.

The IP family will be determined by the nodeIP used by the proxier
The order of precedence is:
1. config.bindAddress if bindAddress is not 0.0.0.0 or ::
2. the primary IP from the Node object, if set
3. if no IP is found it defaults to 127.0.0.1 and IPv4

Signed-off-by: Antonio Ojea <antonio.ojea.garcia@gmail.com>
2020-06-17 14:51:35 +02:00
Gaurav Singh
501f709c9d kube-proxy-test: fix goroutine leak
Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
2020-05-26 09:21:55 -04:00
cici37
7f4d19167e Move pkg/util/configz to k8s.io/component-base 2020-04-29 12:17:25 -07:00
SataQiu
871b90ba23 kube-proxy: add '--bind-address-hard-fail' flag to treat failure to bind to a port as fatal
Signed-off-by: SataQiu <1527062125@qq.com>
2020-04-02 13:13:10 +08:00
Satyadeep Musuvathy
8c6956e5bb Refactor handling of local traffic detection. 2020-02-21 17:57:34 -08:00
Joe Searcy
10879d3bd4 Add lenient decoding path for v1alpha1 kube-proxy
Removed unneeded comments

Matched style from other PR's

Only print error when lenient decoding is successful

Update Bazel for BUILD

Comment out existing strict decoder tests

Added tests for leniant path

Added comments to explain test additions

Cleanup TODO's and tests

Add explicit newline for appended config
2019-10-30 01:26:27 -04:00
obitech
f9b152abb0 Add strict serializer to codec factory in kube-proxy 2019-09-23 19:39:00 +02: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
Kubernetes Prow Robot
e084c281ac
Merge pull request #72771 from yanghaichao12/proxy0110
add a test case for HostnameOverride
2019-08-13 21:38:23 -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
Emrecan BATI
90ce2d50d3 Add GetKernelVersion to ipvs.KernelHandler interface
ipvs `getProxyMode` test fails on mac as `utilipvs.GetRequiredIPVSMods`
try to reach `/proc/sys/kernel/osrelease` to find version of the running
linux kernel. Linux kernel version is used to determine the list of required
kernel modules for ipvs.

Logic to determine kernel version is moved to GetKernelVersion
method in LinuxKernelHandler which implements ipvs.KernelHandler.
Mock KernelHandler is used in the test cases.

Read and parse file is converted to go function instead of execing cut.
2019-07-31 22:10:44 +03:00
David Xia
fabfd950b1
cleanup: fix some log and error capitalizations
Part of https://github.com/kubernetes/kubernetes/issues/15863
2019-07-20 18:26:16 -04:00
Vallery Lancey
dc0f14312e Removed deprecated --resource-container flag from kube-proxy. 2019-06-16 08:36:42 -07:00
Ricardo Pchevuzinske Katz
82c42bb6ee Remove deprecated flag --conntrack-max from kube-proxy 2019-06-01 18:10:28 -03:00
Àbéjídé Àyodélé
109f1c479e Clean up kube-proxy.
These are based on recommendation from
[staticcheck](http://staticcheck.io/).

- Removes dead type/function along with the import that the function
introduced.
- Removes unused struct fields.
- Removes select nested in a tight for loop, the select does not have a
default, so it will be blocking.
2019-05-09 14:39:03 +00:00
JieJhih
94731c5dcd
Merge branch 'master' into proxy/server 2019-04-27 13:48:29 +08:00
JieJhih Jhang
48f431aae5 os exit when option is true 2019-04-24 16:32:11 +08:00
JieJhih Jhang
08e320fa4e support ipv6 in bind address
use split host port func instead trim specific character

add unit test for metrics and healthz bind address

recover import package

refactor set default kube proxy configuration

fix ipv4 condition

fix set default port condition

rewrite call function occasion to reduce error

set ipv6 default value

move get GetBindAddressHostPort to util

use one func to handle deprecated series

update bazel

define address type

return earlier in the error case

refactor set default kube proxy configuration logic

recover import package

preserve some of the original comments

add get default address func

add append port if needed unit test

rewrite unit test for deprecated flags

remove unused codes
2019-04-17 15:31:42 +08:00
Manjunath A Kumatagi
782409255a Use ioutil.TempDir for temporary dir creating 2019-02-07 12:27:19 -05:00
Di Xu
cc16d64368 exit kube-proxy when configuration file changes 2019-01-29 18:05:51 +08:00
yanghaichao12
cd5415f0ab add a test case for HostnameOverride
modify
2019-01-21 08:55:02 -05:00
Lucas Käldström
0140c82c16
Updated references from k8s.io/{apiserver,apimachinery} to the new k8s.io/component-base repo. Co-authored-by @Klaven 2019-01-06 14:01:26 +02:00
Steve Sloka
5834f94598 Allow hostname-override flag to be used if specified
Signed-off-by: Steve Sloka <steves@heptio.com>
2018-10-02 16:09:01 -04:00
liangwei
152e326722 referencing ClientConnectionConfiguration from k8s.io/apimachinery/pkg/apis/config 2018-08-28 09:10:11 +08:00
liangwei
6a048c3b96 Move pkg/proxy/apis/kubeproxyconfig to pkg/proxy/apis/config 2018-08-27 10:30:42 +08:00
stewart-yu
55251c716a update the import file for move util/pointer to k8s.io/utils 2018-07-27 19:47:02 +08:00
m1093782566
674a31e4d6 remove ipvs feature gateway 2018-05-30 10:43:16 +08:00
Rohit Ramkumar
056ae4421c Add --ipvs-exclude-cidrs flag to kube-proxy. 2018-04-13 10:09:14 -07:00
Ryan Hitchman
01a9f83028 Move linux-only getProxyMode tests to a linux-only file. 2018-02-27 13:53:32 -08:00
m1093782566
bc850adce4 add nodeport-addresses flag for kube-proxy 2018-02-26 23:48:46 +08:00
xiangpengzhao
57071d85ee Migrate FeatureGates type of kube-proxy from string to map[string]bool 2018-02-11 14:40:13 +08:00
Andy Goldstein
fa3fb91a76 kube-proxy: fix field name comments & json tags
Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2018-01-02 10:20:43 -05:00
m1093782566
1a10652173 test ipvs proxy mode when feature gateway set 2017-11-28 09:33:09 +08:00
m1093782566
7b372143c5 test ipvs proxy mode when feature gateway unset 2017-11-27 20:06:51 +08:00
m1093782566
dc2e57ba74 refactor canUseIPVSMode and test it 2017-11-27 20:06:47 +08:00
Tim Hockin
79778288de Fix NewProxyServer
Different OSes need different args.  This is not a great fix, but better
than adding an arg to Windows which doesn't need it.
2017-11-22 14:17:10 -08:00
m1093782566
f3e744b661 add cleanup-ipvs flag 2017-11-21 15:05:23 +08:00
m1093782566
268da85445 fix fakeIPSet ut error 2017-11-19 12:39:43 +08:00
Dr. Stefan Schimanski
012b085ac8 pkg/apis/core: mechanical import fixes in dependencies 2017-11-09 12:14:08 +01:00
Andy Goldstein
ea78586832 Re-allow 0 for kube-proxy conntrack settings
When kube-proxy was refactored to use a configuration file, the ability
to use 0 for conntrack min, max, max per core, and tcp timeouts was
inadvertently broken; if you specified 0, it would instead apply the
default value from defaults.go.

This change restores the ability to use 0 to mean 0.

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2017-11-07 14:45:30 -05:00
xiangpengzhao
291647e6d9 Use "kubeproxy.config.k8s.io" as final group name. 2017-11-04 11:42:36 +08:00
xiangpengzhao
ff36eefd17 Rename kubeproxy config pkg and group. 2017-11-04 11:42:36 +08:00
xiangpengzhao
91ab8fe1e7 NewOptions doesn't need to return error in signature. 2017-11-04 11:38:57 +08:00