Commit graph

2338 commits

Author SHA1 Message Date
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
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