Commit graph

2365 commits

Author SHA1 Message Date
Kubernetes Prow Robot
437184c055
Merge pull request #136292 from atombrella/feature/modernize_plusbuild
Remove obsolete `// +build` instruction.
2026-01-26 19:05:59 +05:30
Kubernetes Prow Robot
7cdeb11327
Merge pull request #135800 from danwinship/nftables-hairpin
rework nftables masquerading code, part 1
2026-01-24 10:33:39 +05:30
Prince Pereira
4198b789f5 Fix for preferred dualstack and required dualstack in winkernel proxier. 2026-01-21 00:57:09 +05:30
Mads Jensen
64a7d4c741 Remove deprecated +build instruction. 2026-01-19 17:40:33 +01:00
Dan Winship
5cffb4d1f6 Remove mark-for-masquerade chain from nftables kube-proxy
Current kernels have problems with very large rulesets with lots of
jumps (because of inefficiency in the code that ensures the jumps
don't create loops). Get rid of a bunch of jumps (1 per endpoint and
usually 1 or 2 per service) by just doing mark-for-masquerade inline
rather than calling a helper chain to do it.
2026-01-09 12:51:24 -05:00
Dan Winship
36673b618e Rework masquerade handling in nftables tracer
Process the actual rules rather than treating
"jump mark-for-masquerade" as having special semantics.
2026-01-09 12:50:26 -05:00
Dan Winship
c3595012b5 Simplify nftables masquerade rule
We originally made it multiple rules, matching iptables, but nftables
lets you do it all in a single rule.
2026-01-09 12:46:37 -05:00
Kubernetes Prow Robot
25b452b971
Merge pull request #135631 from danwinship/ipvs-winkernel-resync-period
Switch ipvs and winkernel back to more regular forced syncs
2026-01-09 02:11:46 +05:30
Patrick Ohly
ad79e479c2 build: remove deprecated '// +build' tag
This has been replaced by `//build:...` for a long time now.

Removal of the old build tag was automated with:

    for i in $(git grep -l '^// +build' | grep -v -e '^vendor/'); do if ! grep -q '^// Code generated' "$i"; then sed -i -e '/^\/\/ +build/d' "$i"; fi; done
2025-12-18 12:16:21 +01:00
Kubernetes Prow Robot
2fa93a995e
Merge pull request #135593 from danwinship/proxy-duplicate-ips
Handle the case of a pod IP being reused while the old Pod still exists
2025-12-17 23:28:02 -08:00
Kubernetes Prow Robot
101ee1bc9c
Merge pull request #135549 from danwinship/proxy-backend-files
Split up `pkg/proxy/*/proxier.go` a bit more
2025-12-17 23:27:54 -08:00
Kubernetes Prow Robot
1faee42453
Merge pull request #135548 from danwinship/conntrack-setup
Move kube-proxy conntrack setup code to pkg/proxy
2025-12-17 23:27:46 -08:00
Kubernetes Prow Robot
77f5336dbc
Merge pull request #135547 from danwinship/healthcheck-interface
Add a nodeManager interface to pkg/proxy/healthcheck
2025-12-17 23:27:38 -08:00
Dan Winship
1e61027d75 Switch ipvs and winkernel back to more regular forced syncs 2025-12-05 11:28:32 -05:00
Dan Winship
e1b20366e3 Handle the case of a pod IP being reused while the old Pod still exists
If the pod network reuses a pod IP while the old pod is still
terminating, then we may temporarily see two Endpoints for that IP. In
that case, prefer the non-terminating one.
2025-12-04 10:35:34 -05:00
Dan Winship
bc8aa8c067 Remove incorrect special-case when Endpoints move between EndpointSlices
The code was assuming that if an Endpoint got moved from one slice to
another, and one is "local" but the other isn't, then we should prefer
the local one. But this doesn't make sense; if it's actually the same
Endpoint (i.e., same targetRef) then both copies will have the same
Hostname. And if it's not the same Endpoint, then one of the two
Endpoints is wrong, but there's no reason to assume it's the non-local
one.
2025-12-04 10:30:00 -05:00
Antonio Ojea
38e08c231c kube-proxy: optimize conntrack cleanup with O(n) flow filter
Previously, we created a separate filter for each stale flow,
resulting in O(n^2) complexity when deleting flows because the
netlink llibrary iterates over all filters for each flow.

This change introduces a new filter backed by a `sets.Set` for O(1) lookup per flow.
This reduces the overall complexity of cleaning up stale entries to O(n).
2025-12-03 10:35:29 +00:00
Dan Winship
531be81208 Move proxier cleanup code into separate files.
(No code changes, just moving between files.)
2025-12-02 11:05:00 -05:00
Dan Winship
9f4edccb97 Move proxier supportedness-checking code into separate files.
(No code changes, just moving between files.)
2025-12-02 11:05:00 -05:00
Dan Winship
fe84ab85f1 Move conntrack sysctl setup from cmd/kube-proxy/ to pkg/proxy/conntrack/
Eventually this code will be called from the backends themselves.
2025-12-02 11:03:00 -05:00
Dan Winship
3ecc3c9e6e Clean up some code we're about to move
So linter-hints won't complain about it in the new file.
2025-12-02 09:54:56 -05:00
Dan Winship
d6d3bc88a1 Add an interface type to prevent a future import loop 2025-12-01 18:40:12 -05:00
Prince Pereira
a49bc6f2fb kube-proxy/winkernel: fix stale RemoteEndpoints due to premature clearing of terminatedEndpoints map. 2025-11-05 16:23:43 +00:00
Dan Winship
715228f478 Remove LoadBalancerIPMode feature gate 2025-10-24 09:12:03 -04:00
Kubernetes Prow Robot
6652c9fadf
Merge pull request #134457 from danwinship/prefersamenode
KEP-3015: update PreferSameTrafficDistribution to GA
2025-10-23 14:41:33 -07:00
novahe
9d48e7d2d4 fix missing involvedObject.apiVersion in event 2025-10-22 20:13:36 +08:00
Dan Winship
02926c9563 Update PreferSameTrafficDistribution to GA 2025-10-14 08:20:43 -04:00
Kubernetes Prow Robot
9f40c6f62c
Merge pull request #134137 from aditigupta96/refactor-core-waitfornamedcachesync
refactor: Use WaitForNamedCacheSyncWithContext in core components
2025-09-23 01:32:16 -07:00
Aditi Gupta
f44279647b refactor: Use WaitForNamedCacheSyncWithContext in core components
Signed-off-by: Aditi Gupta <aditigpta@google.com>
2025-09-18 11:34:28 -07:00
Dan Winship
f8bfcfc885 Drop utiliptables.NewDualStack()
The semantics (sometimes it returns an error that is really just a
warning) are too confusing, and it turns out that we really only need
it in one place (platformCheckSupported()); after that we've already
figured out what IP families are supported, so we could just use
utiliptables.NewBestEffort() instead, knowing we want exactly what it
returns.

So we can just expand the semantics of the old NewDualStack() inline
in the one place we care, without hiding any of it behind a
too-complicated return value.
2025-09-17 20:14:28 -04:00
Kubernetes Prow Robot
053267ad36
Merge pull request #134024 from jack4it/jack4it/iifname
fix: use iifname for input interface name matches
2025-09-16 15:28:17 -07:00
Jack Ma
b81e87c02f fix: use iifname for input interface name matches
add tests to cover nftables; also fix NewDetectLocalByBridgeInterface
2025-09-12 09:39:08 -07:00
Prince Pereira
c5882e38ff
Fix ClusterIP load balancer disappearing when InternalTrafficPolicy: Local is set. 2025-09-08 22:30:36 -07:00
Kubernetes Prow Robot
1431873b84
Merge pull request #133603 from linux-on-ibm-z/kub-1.32.x-nfacct-testcase-fix
Fix nfacct test cases on s390x
2025-08-27 20:23:44 -07:00
saisindhuri91
3f5b678e98 Update nfacct_linux_test.go
Signed-off-by: saisindhuri91 <Sai.Sindhuri.Avulamanda@ibm.com>
2025-08-21 21:31:33 +05:30
Benjamin Elder
d3ba41467d set default log flush frequency in kube-proxy config validation tests 2025-08-14 18:16:15 -07:00
Dawei Wei
a806e069e2 Remove WinDSR feature gate unit test 2025-07-23 17:40:53 +00:00
Kubernetes Prow Robot
ce9ba81802
Merge pull request #133059 from danwinship/node-manager
kube-proxy node manager (take 2)
2025-07-21 20:36:27 -07:00
Dan Winship
facbb66142 Temporarily revert restart-on-node-IP-change behavior of proxy NodeManager 2025-07-21 17:00:45 -04:00
Daman Arora
e2d37f3cd7 kube-proxy: merge OnNodeAdd and OnNodeUpdate into OnNodeChange
For kube-proxy, node addition and node update is semantically
considered as similar event, we have exactly same handler
logic for these two events resulting in duplicate code and
unit tests.
This merges the `NodeHandler` interface methods OnNodeAdd and
OnNodeUpdate into OnNodeChange along with the implementation
of the interface.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-07-21 17:00:44 -04:00
Daman Arora
0dc51b16f9 kube-proxy: merge NodeEligibleHandler with NodeManager
ProxyHealthServer now consumes NodeManager to get the latest
updated node object for determining node eligibility.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
Co-authored-by: Dan Winship <danwinship@redhat.com>
2025-07-21 17:00:44 -04:00
Daman Arora
d4892fef76 kube-proxy: merge NodePodCIDRHandler with NodeManager
NodeManager, if configured with to watch for PodCIDR watch, watches
for changes in PodCIDRs and crashes kube-proxy if a change is
detected in PodCIDRs.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
Co-authored-by: Dan Winship <danwinship@redhat.com>
2025-07-21 17:00:44 -04:00
Daman Arora
373fb487f6 kube-proxy: add NodeManager to manage life-cycle based on NodeIPs
NodeManager initialises node informers, waits for cache sync and polls for
node object to retrieve NodeIPs, handle node events and crashes kube-proxy
when change in NodeIPs is detected.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
Co-authored-by: Dan Winship <danwinship@redhat.com>
2025-07-21 17:00:44 -04:00
Daman Arora
d21ca8674c kube-proxy: add NodeTopologyConfig for tracking topology labels
This simplifies how the proxier receives update for change in node
labels. Instead of passing the complete Node object we just pass
the proxy relevant topology labels extracted from the complete list
of labels, and the downstream event handlers will only be notified
when there are changes in topology labels.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-07-21 17:00:44 -04:00
Dan Winship
8acda3631f Belatedly add tests of proxy NodeConfig and ServiceCIDRConfig 2025-07-21 17:00:42 -04:00
roc
bfa33b18a0 fix(kube-proxy) avoid add zero-masked loadBalancerSourceRanges to ipset
Signed-off-by: roc <roc@imroc.cc>
2025-07-18 09:55:39 +08:00
Daman Arora
bc5088cbf3
Revert "Kube proxy node manager" 2025-07-15 19:34:05 +05:30
Daman Arora
46e2c22fd7 kube-proxy: merge OnNodeAdd and OnNodeUpdate into OnNodeChange
For kube-proxy, node addition and node update is semantically
considered as similar event, we have exactly same handler
logic for these two events resulting in duplicate code and
unit tests.
This merges the `NodeHandler` interface methods OnNodeAdd and
OnNodeUpdate into OnNodeChange along with the implementation
of the interface.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-07-11 23:06:44 +05:30
Daman Arora
fa9e466945 kube-proxy: merge NodeEligibleHandler with NodeManager
ProxyHealthServer now consumes NodeManager to get the latest
updated node object for determining node eligibility.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-07-11 23:06:44 +05:30
Daman Arora
c6735d9b3b kube-proxy: merge NodePodCIDRHandler with NodeManager
NodeManager, if configured with to watch for PodCIDR watch, watches
for changes in PodCIDRs and crashes kube-proxy if a change is
detected in PodCIDRs.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-07-11 23:06:44 +05:30