Commit Graph

2164 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
db91d45d2d Merge pull request #124152 from danwinship/knftables-versions
update client/kernel version requirements for nftables kube-proxy
2024-07-08 12:45:02 -07:00
Dan Winship
b39fd03ee4 Allow disabling nftables kernel version check 2024-07-08 07:29:27 -04:00
Kubernetes Prow Robot
9039d71dd7 Merge pull request #124092 from princepereira/ppereira-updatelbpolicy-master
Adding modifyloadbalancer api support in Windows KubeProxy for update loadbalancer replacing usage of delete and create loadbalancer api.
2024-07-05 17:40:28 -07:00
Prince Pereira
ef2628d764 Adding support for ModifyLoadbalancer in windows kubeproxy. 2024-07-03 22:13:35 -07:00
Dan Winship
505f6833d9 Require kernel 5.13 for nftables kube-proxy 2024-07-01 10:07:27 -04:00
Dan Winship
912eca9e8b Reorganize nftables proxy init
Move the "nftables is supported" check into a separate function, and
call it before the --init-only return.
2024-07-01 10:07:27 -04:00
Kubernetes Prow Robot
93d56511e6 Merge pull request #125021 from aojea/servicecidrbeta
KEP-1880 Multiple Service CIDRs: Graduate to Beta (2/2)
2024-06-30 08:53:25 -07:00
Antonio Ojea
0e1f9dadd6 modify components to use the networking v1beta1 API 2024-06-30 09:48:46 +00:00
Matthieu MOREL
0cde5f1e28 fix: enable bool-compare rule from testifylint linter (#125135)
* fix: enable bool-compare rule from testifylint linter

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

* Update hack/golangci.yaml.in

Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>

* Update golangci.yaml.in

* Update golangci-strict.yaml

* Update golangci.yaml.in

* Update golangci.yaml.in

* Update golangci.yaml.in

* Update golangci.yaml.in

* Update golangci.yaml

* Update golangci-hints.yaml

* Update golangci-strict.yaml

* Update golangci.yaml.in

* Update golangci.yaml

* Update mux_test.go

---------

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
2024-06-28 10:58:05 -07:00
Claudiu Belu
b5e3b81de6 unittests: Fixes unit tests for Windows (part 12)
Currently, there are some unit tests that are failing on Windows due
to various reasons:

- IPVS proxy mode is not supported on Windows.
- pkg/kubelet/cri/remote was moved to cri-client.
2024-06-28 08:05:38 +00:00
Kubernetes Prow Robot
eb6840928d Merge pull request #124160 from Karthik-K-N/fix-buildconstraints
Add doc.go file without any buildconstraint to run tests on non linux platforms
2024-06-13 16:29:06 -07:00
Quan Tian
9d71e5338d Remove unused sysctl parameter from nftables proxy
Signed-off-by: Quan Tian <quan.tian@broadcom.com>
2024-06-08 21:48:54 +08:00
Daman Arora
bc8b90b07d pkg/proxy: track localhost nodeport accepted packets
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-05-21 20:09:54 +05:30
Daman Arora
985d64cdbe add ct_state_invalid_dropped_pkts nfacct counter to unit tests
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-05-21 20:09:47 +05:30
Daman Arora
f7fae7297c pkg/proxy/metrics: refactor nfacct metrics collection
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-05-21 20:09:39 +05:30
HirazawaUi
facf702e64 Remove useless util functions 2024-05-20 19:57:43 +08:00
Kubernetes Prow Robot
41958b3c16 Merge pull request #124626 from danwinship/endpointslicecache
simplify EndpointSliceCache caching
2024-05-07 16:59:42 -07:00
Kubernetes Prow Robot
29a4812f03 Merge pull request #124080 from claudiubelu/skip-windows-tests
Skip failing Windows tests
2024-05-01 07:48:12 -07:00
Dan Winship
05e14799db Cache EndpointSlices directly rather than copying the data
Given that we are no longer modifying any of the EndpointSlice data,
we can just work with pointers to the actual EndpointSlice objects.
(The informer cache is already holding on to them, so they'll be
taking up memory whether or not the EndpointSliceCache points to
them.)
2024-04-29 17:07:21 -04:00
Dan Winship
f956fdf240 Don't sort endpointSliceData objects
EndpointSliceCache cached EndpointSlices into endpointSliceData
objects, in part so it could sort the ports and addresses, so that if
those fields got reordered without otherwise changing, it would not
trigger an OnEndpointSliceUpdate().

However, the EndpointSlice controller and mirroring controller always
output the ports in the same order, and they never reorder the
addresses of an existing slice unless the set of addresses actually
changed. So in the normal case, sorting the data adds more work than
it saves.
2024-04-29 17:07:21 -04:00
Dan Winship
f1f390f13b clean up LocalTrafficDetector construction / tests (#124582)
* LocalTrafficDetector construction and test improvements

* Reorder getLocalDetector unit test fields so "input" args come before "output" args

* Don't pass DetectLocalMode as a separate arg to getLocalDetector

It's already part of `config`

* Clarify test names in preparation for merging

* Merge single-stack/dual-stack LocalTrafficDetector construction

Also, only warn if the *primary* IP family is not correctly configured
(since we don't actually know if the cluster is really dual-stack or
not), and pass the pair of detectors to the proxiers as a map rather
than an array.

* Remove the rest of Test_getDualStackLocalDetectorTuple
2024-04-28 08:51:23 -07:00
Daman Arora
3363ec4ba1 pkg/proxy/iptables: track ct state invalid dropped packets
Track packets dropped by proxy which were marked invalid by conntrack
using nfacct netfilter extended accounting infrastructure.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-04-27 12:25:14 +05:30
Daman Arora
6b5291654f pkg/proxy/util/nfacct: utility to interact with nfacct subsystem
nfacct is netfilter's accounting subsystem. This utility allows
interactions with the subsystem using lower level netlink API.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-04-27 12:17:50 +05:30
Kubernetes Prow Robot
ae8474adcd Merge pull request #124557 from danwinship/metrics-and-stuff
kube-proxy metrics cleanup (and stuff)
2024-04-26 18:31:57 -07:00
Dan Winship
c4dd2c5ad7 Re-enable V(9) transaction logging in nftables proxy 2024-04-26 11:41:51 -04:00
Dan Winship
d4e6e62134 Add nftables cleanup failure metric, fix cleanup bug
If the sync fails, don't try to cleanup, since it's guaranteed to fail
too.
2024-04-26 11:41:51 -04:00
Dan Winship
3db434d6be Remove errors from LocalTrafficDetector constructors
The constructors only return an error if you pass them invalid data,
but we only ever pass them data which has already been validated,
making the error checking just annoying. Just make them return garbage
output if you give them garbage input.
2024-04-26 11:34:37 -04:00
Dan Winship
fc05a294cc Rename nftables sync failure metric 2024-04-26 09:27:41 -04:00
Dan Winship
1823de063b fix "Iptables" -> "IPTables" in metrics variable names 2024-04-26 09:27:41 -04:00
Dan Winship
ba57fd7c84 Merge linux and windows kube-proxy metric registration together
Windows proxy metric registration was in a separate file, which had
led to some metrics (eg the new ProxyHealthzTotal and ProxyLivezTotal)
not being registered for Windows even though they were implemented by
platform-generic code.

(A few other metrics were neither registered on, nor implemented on
Windows, and that's probably a bug.)

Also, beyond linux-vs-windows, make it clearer which metrics are
specific to individual backends.
2024-04-26 09:27:41 -04:00
Claudiu Belu
2be8baeaef unittests: Skip failing Windows tests
Some of the unit tests are currently failing on Windows.

Skip them for now, and remove the skips later, once the underlying issues
have been resolved.
2024-04-25 14:24:16 +00:00
Dan Winship
59cecf8a36 Simplify redundant LocalTrafficDetector implementations
All of the LocalTrafficDetector implementations were essentially
identical after construction time, so just reduce them to a single
implementation with multiple constructors.

Also, improve the comments.
2024-04-25 08:52:35 -04:00
Dan Winship
dc1155bd53 Move LocalTrafficDetector from pkg/proxy/util/iptables to pkg/proxy/util
Since it's used for nftables as well now.
2024-04-25 08:51:43 -04:00
Marek Siarkowicz
3ee8178768 Cleanup defer from SetFeatureGateDuringTest function call 2024-04-24 20:25:29 +02:00
Kubernetes Prow Robot
06db9962f8 Merge pull request #124452 from danwinship/proxy-config-unit-tests
KubeProxyConfig unit test cleanups
2024-04-24 09:47:35 -07:00
Daman Arora
a577c0b324 kube-proxy: refactor config validation unit test
Refactor the TestValidateKubeProxyConfiguration by adding a mutating
function that adjusts the configuration according to each test case,
thereby enhancing readability.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-04-23 09:03:42 -04:00
Dan Winship
f4ecae8324 Use t.Run and assert.Equal in KubeProxyConfiguration validation tests 2024-04-23 09:03:23 -04:00
Dan Winship
7b9f730804 Merge success and failure cases in KubeProxyConfiguration validation tests 2024-04-23 09:03:23 -04:00
Dan Winship
c7f3caf498 Add names to all KubeProxyConfiguration validation test cases 2024-04-23 09:03:21 -04:00
Dan Winship
7320e54e0e Split Linux/Windows TestValidateKubeProxyMode 2024-04-22 18:25:01 -04:00
Ziqi Zhao
be4535bd34 convert k8s.io/kubernetes/pkg/proxy to contextual logging, part 1
Signed-off-by: Ziqi Zhao <zhaoziqi9146@gmail.com>
2024-04-22 13:08:41 +08:00
Kubernetes Prow Robot
bf07ef3950 Merge pull request #124383 from danwinship/nftables-proxy-to-beta
KEP-3866 kube-proxy nftables to beta
2024-04-18 17:42:20 -07:00
Dan Winship
fdf22533a8 KEP-3866 kube-proxy nftables mode to beta 2024-04-18 13:20:23 -04:00
Kubernetes Prow Robot
b2c32fb015 Merge pull request #123105 from danwinship/nodeport-addresses-primary
Add `--nodeport-addresses primary`, warn on empty `--nodeport-addresses`
2024-04-18 08:49:21 -07:00
Dan Winship
3ecd933276 fix/simplify an nftables unit test
The nodeport-ips value is part of the baseline, which wouldn't change
no matter what Services or EndpointSlices we added/removed.
2024-04-18 09:25:06 -04:00
Dan Winship
19b3a9e194 (Mostly) Revert "change --nodeport-addresses behavior to default to primary node ip only"
This reverts commit 8bccf4873b, except
for the nftables unit test changes, since we still want the "new"
results (not to mention the bugfixes), just for a different reason
now.
2024-04-18 09:25:06 -04:00
Dan Winship
0b599aa8e3 Add --nodeport-addresses primary
The behavior when you specify no --nodeport-addresses value in a
dual-stack cluster is terrible and we can't fix it, for
backward-compatibility reasons. Actually, the behavior when you
specify no --nodeport-addresses value in a single-stack cluster isn't
exactly awesome either...

Allow specifying `--nodeport-addresses primary` to get the
previously-nftables-backend-specific behavior of listening on only the
node's primary IP or IPs.
2024-04-18 09:25:06 -04:00
Dan Winship
8de0fc09aa Remove an unused type from kube-proxy config, move around some helpers 2024-04-13 11:12:28 -04:00
Karthik K N
134e43c279 Add doc.go file without any buildconstraint to run tests on non linux systems 2024-04-03 12:30:59 +05:30
Nadia Pinaeva
56d1011aa5 kube-proxy: ensure nftables unit test parity with iptables.
Add packet tracing unit tests for ipv4 and ipv6.
Remove unreachable code from runChain, since some of the parsed rules
are never generated by the proxy implementation.

Signed-off-by: Nadia Pinaeva <n.m.pinaeva@gmail.com>
2024-04-02 11:57:47 +02:00