Commit Graph

2336 Commits

Author SHA1 Message Date
galal-hussein
81a4aba901 Ignore nfacct init error in kube-proxy
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>
2026-02-10 19:18:48 -03:00
Prince Pereira
eb8f93348d Fix for preferred dualstack and required dualstack in winkernel proxier. 2026-01-21 05:40:42 +00:00
Dan Winship
b57a77635a Switch ipvs and winkernel back to more regular forced syncs 2026-01-08 22:24:52 -05:00
Prince Pereira
f4fd1e3a62 kube-proxy/winkernel: fix stale RemoteEndpoints due to premature clearing of terminatedEndpoints map. 2025-11-06 07:53:57 +00:00
Kubernetes Prow Robot
0801367982 Merge pull request #134031 from princepereira/automated-cherry-pick-of-#133953-upstream-release-1.34
Automated cherry pick of #133953: Fix ClusterIP load balancer disappearing when InternalTrafficPolicy: Local is set.
2025-09-26 01:34:36 -07:00
Jack Ma
07ac83c146 fix: use iifname for input interface name matches
add tests to cover nftables; also fix NewDetectLocalByBridgeInterface
2025-09-17 09:59:14 -07:00
Prince Pereira
7d43ddbbfb Fix ClusterIP load balancer disappearing when InternalTrafficPolicy: Local is set. 2025-09-11 21:47:13 -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
Daman Arora
c43104cbea 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>
2025-07-11 21:48:52 +05:30
Daman Arora
af7abde0e5 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-11 21:05:19 +05:30
Kubernetes Prow Robot
d269d10bfc Merge pull request #132647 from princepereira/ppereira-incorrect-internalport
Ensure Loadbalancer internal port is set to container port from endpointslice if the targetPort is not specified in service info creation.
2025-07-10 18:41:27 -07:00
Kubernetes Prow Robot
9538d53353 Merge pull request #132456 from aroradaman/nftables-etp-fix
nftables short-circuit local traffic to external addresses
2025-07-09 17:53:27 -07:00
Miles Bryant
1cec0acebf Short circuit CategorizeEndpoints when there are no endpoints
PR feedback
2025-07-08 11:14:08 +01:00
Miles Bryant
1ac5f661ed Don't log irrelevant zone hints message on no endpoints
Update pkg/proxy/topology.go

Co-authored-by: Dan Winship <danwinship@redhat.com>

Add unit test case
2025-07-04 11:10:55 +01:00
Kubernetes Prow Robot
c3b06a5366 Merge pull request #131615 from danwinship/proxy-bfr
update BoundedFrequencyRunner for kube-proxy
2025-07-01 09:21:24 -07:00
Antonio Ojea
459188ce25 Port BoundedFrequencyRunner from flowcontrol.RateLimiter to clock.Clock
Co-authored-by: Dan Winship <danwinship@redhat.com>
2025-07-01 08:54:14 -04:00
Dan Winship
eae17c21b0 Change how BoundedFrequencyRunner retries work
Rather than having a RetryAfter function, do a retry (at a fixed
interval) if the work function returns an error.

Co-authored-by: Antonio Ojea <aojea@google.com>
2025-07-01 08:54:14 -04:00
Dan Winship
c16ee887ef Remove burst syncs from BoundedFrequencyRunner
Burst syncs are theoretically useful for dealing with a single change
that results in multiple Run() calls (eg, a Service and EndpointSlice
both changing), but 2 isn't enough to cover all cases, and a better
way of dealing with this problem is to just use a smaller
minSyncPeriod.

Co-authored-by: Antonio Ojea <aojea@google.com>
2025-07-01 08:54:14 -04:00
Dan Winship
0298e04ea0 Updates to BoundedFrequencyRunner
- Use structured logging.
- Use t.Helper() in unit tests.
- Improve some comments.
- Remove an unnecessary check/panic.

Co-authored-by: Antonio Ojea <aojea@google.com>
2025-07-01 08:54:14 -04:00
Antonio Ojea
6da9d363f3 Copy BoundedFrequencyRunner to kube-proxy 2025-07-01 08:53:54 -04:00
Prince Pereira
d4e49b2eed Ensure Loadbalancer internal port is set to container port from endpointslice if the targetPort is not specified in service info creation. 2025-07-01 02:25:37 -07:00
Daman Arora
7e3945808d nftables: remove filter-output-post-dnat chain
With filter-output chain already operating with priority
post DNAT, we can merge both the chains together.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-06-23 18:12:13 +05:30
Daman Arora
91f2256b34 update filter chains and priority
With this commit the filter-input, filter-forward, and filter-output base chains
are hooked with priority 0. For filtering before DNAT, filter-prerouting-pre-dnat
and filter-output-pre-dnat should be used which have a priority lower than DNAT
(-110)

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-06-23 18:12:13 +05:30
Daman Arora
af89044a78 conntrack: clean stale entries on endpoint port change
With this commit, the conntrack reconciler clears the stales
entries when endpoints change port without changing IP.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-06-23 00:37:28 +05:30
Daman Arora
512563e7b0 pkg/proxy/conntrack: refactor
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-06-18 14:22:26 +05:30
Kubernetes Prow Robot
43bb11b5c1 Merge pull request #131534 from aroradaman/kube-proxy-ipt-init-error-2
kube-proxy: log iptables errors in platformCheckSupported
2025-06-06 21:08:38 -07:00
Daman Arora
858b88bcee kube-proxy: log ipt errors during platformCheckSupported
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-06-07 01:14:33 +05:30
Kubernetes Prow Robot
2f94274c88 Merge pull request #131562 from logica0419/kube-proxy-string-concat
Add missing space in string concatenation (kube-proxy)
2025-05-27 13:36:22 -07:00
Kubernetes Prow Robot
ef66667c8e Merge pull request #131243 from danwinship/kube-proxy-cleanup
Improve `kube-proxy --cleanup` / cleanup on kube-proxy mode switch
2025-05-06 09:29:13 -07:00
Kubernetes Prow Robot
0b8133816b Merge pull request #131477 from pohly/golangci-lint@v2
golangci-lint v2
2025-05-02 23:03:55 -07:00
Matthieu MOREL
4adb58565c chore: bump golangci-lint to v2
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-05-02 12:51:02 +02:00
logica0419
43a0da5880 add missing space in string concatenation (kube-proxy) 2025-04-30 23:35:25 +09:00
Daman Arora
c7a870135a nftables: cleanup service chain checks
A packet can traverse the service-xxxx chains by matching on either
service-ips or service-nodeports verdict map. We masquerade off-cluster
traffic to ClusterIP (when masqueradeAll = false) by adding a rule in
service-xxxx which checks if destination IP is ClusterIP, port and
protocol matches with service specs and source IP doesn't belong to
PodCIDR and masquerade on match.

If the packet reaches the service chain by match on service-ips map,
then ClusterIP, port and protocol are already matching service specs.
If it comes via external-xxxx chain then the destination IP will
never be ClusterIP. Therefore, we can simplify the masquerade
off-cluster traffic to ClusterIP check by simply matching on
destination ip and source ip.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-04-27 01:05:45 +05:30
Kubernetes Prow Robot
b9d2c1b043 Merge pull request #131138 from princepereira/ppereira-130963-endpointcreation
Fix for HNS local endpoint was being deleted instead of the remote endpoint.
2025-04-23 16:00:11 -07:00
Kubernetes Prow Robot
13dd327f0d Merge pull request #130687 from tomma-a/master
Made the unsupportedError msg more readable
2025-04-23 13:31:21 -07:00
Dan Winship
f9c1876b45 Make proxy CleanupLeftovers methods quieter
To make switching to/from nftables easier, kube-proxy runs iptables
and ipvs cleanup when starting in nftables mode, and runs nftables
cleanup when starting in iptables or ipvs mode. But there's no
guarantee that the node actually supports the mode we're trying to
clean up, so don't log errors if it doesn't.
2025-04-10 14:58:37 -04:00
Dan Winship
b61ca041b4 Add some missing cleanup to "kube-proxy --cleanup"
iptables and ipvs were both leaving KUBE-MARK-MASQ behind (even though
the corresponding KUBE-POSTROUTING rule to actually do the masquerade
got deleted).

iptables was failing to clean up its KUBE-PROXY-FIREWALL chain (the
cleanup rules never got updated when that was split out of
KUBE-FIREWALL), and also not cleaning up its canary chain.
2025-04-10 14:58:35 -04:00