Commit Graph

417 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
ff90c1cc73
Merge pull request #119374 from danwinship/kep-3178-ga
move KEP-3178 IPTablesOwnershipCleanup to GA
2023-07-17 15:53:47 -07:00
Dan Winship
d486736dd3 Remove IPTablesOwnershipCleanup checks and dead code 2023-07-17 16:51:47 -04:00
Aohan Yang
7eab0d7a0d Proxy changes for IP mode field 2023-07-17 16:02:36 +08:00
Kubernetes Prow Robot
f34365789d
Merge pull request #116470 from alexanderConstantinescu/kep-3836-impl
[Kube-proxy]: Implement KEP-3836
2023-07-15 05:43:04 -07:00
Dan Winship
883d0c3b71 Add a dummy implementation of proxyutil.LineBuffer
Rather than actually assembling all of the rules we aren't going to
use, just count them and throw them away.
2023-07-14 08:38:25 -04:00
Alexander Constantinescu
9b1c4c7b57 Implement KEP-3836
TL;DR: we want to start failing the LB HC if a node is tainted with ToBeDeletedByClusterAutoscaler.
This field might need refinement, but currently is deemed our best way of understanding if
a node is about to get deleted. We want to do this only for eTP:Cluster services.

The goal is to connection draining terminating nodes
2023-07-10 10:30:54 +02:00
Kubernetes Prow Robot
b2042d6ce4
Merge pull request #118338 from aroradaman/mv-ipset
move pkg/util/ipset inside pkg/proxy/ipvs
2023-06-09 08:14:24 -07:00
Dan Winship
4962e6eacb Squash detectNodeIP and nodeIPTuple together 2023-06-06 20:48:00 -04:00
Kubernetes Prow Robot
7d24586663
Merge pull request #118334 from danwinship/proxyutil
Consistently use proxyutil as the name for pkg/proxy/util
2023-05-30 12:49:46 -07:00
Daman Arora
2d8c820741 move pkg/util/ipset inside pkg/proxy/ipvs
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2023-05-31 00:30:20 +05:30
Dan Winship
f3ba935336 Consistently use proxyutil as the name for pkg/proxy/util
Some places were using utilproxy, but that implies that it's
pkg/util/proxy...
2023-05-30 12:18:49 -04:00
Lars Ekman
4aa5441de2 Move pkg/util/ipvs inside pkg/proxy/ipvs
Ipvs will never be used by any other component within K8s than
the proxy/ipvs

Signed-off-by: Lars Ekman <uablrek@gmail.com>
2023-05-27 18:37:50 +02:00
Dan Winship
a744a186b6 Rename GetNodeAddresses to GetNodeIPs, return net.IP 2023-05-16 09:14:09 -04:00
Dan Winship
2ca215fd99 Add NodePortAddresses.MatchAll()
Rather than having GetNodeAddresses() return a special magic value
indicating that it matches all IPs, add a separate method to check
that. (And have GetNodeAddresses() just return the IPs as expected
instead.)
2023-05-16 09:09:24 -04:00
Dan Winship
9ac657bb94 Make NodePortAddresses explicitly IP-family-specific
Both proxies handle IPv4 and IPv6 nodeport addresses separately, but
GetNodeAddresses went out of its way to make that difficult. Fix that.

This commit does not change any externally-visible semantics, but it
makes the existing weird semantics more obvious. Specifically, if you
say "--nodeport-addresses 10.0.0.0/8,192.168.0.0/16", then the
dual-stack proxy code would have split that into a list of IPv4 CIDRs
(["10.0.0.0/8", "192.168.0.0/16"]) to pass to the IPv4 proxier, and a
list of IPv6 CIDRs ([]) to pass to the IPv6 proxier, and then the IPv6
proxier would say "well since the list of nodeport addresses is empty,
I'll listen on all IPv6 addresses", which probably isn't what you
meant, but that's what it did.
2023-05-15 10:53:44 -04:00
Dan Winship
f7bb9a9a0a Remove a mostly-unused variable in the ipvs proxy
It probably was used for something else in the past but it's pointless
now.
2023-05-15 10:53:21 -04:00
Daman Arora
808098c4c6 proxy/ipvs: healthzServer for instantiating the proxier
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2023-05-12 12:57:47 +05:30
Daman
c2c8b8d178 pkg/proxy: using generic sets
pkg/proxy: using generic sets

Signed-off-by: Daman <aroradaman@gmail.com>
2023-05-05 14:29:23 +05:30
Lars Ekman
e496085bd3 Kube-proxy/ipvs: accept access to healthCheckNodePort on LbIP 2023-05-02 15:51:22 +02:00
Lars Ekman
5ece6541b8 proxy/ipvs: don't bind nodeips to the dummy device 2023-04-27 21:02:25 +02:00
Lars Ekman
5310305098 proxy/ipvs: add a GetAllLocalAddressesExcept() function 2023-04-27 21:02:20 +02:00
Daman
a6339e2702 proxy/conntrack: using common conntrack cleaning function in proxiers 2023-04-16 15:59:14 +05:30
Daman
efb0563094 proxy/conntrack: moved pkg/util/conntrack -> pkg/proxy/conntrack 2023-04-16 15:52:52 +05:30
Dan Winship
2bb35e08f4 Clarify kubelet/kube-proxy iptables rule skew constraints 2023-04-13 14:05:58 -04:00
Dan Winship
7696bcd10c Remove some now-obviously-unnecessary checks
Now that the endpoint update fields have names that make it clear that
they only contain UDP objects, it's obvious that the "protocol == UDP"
checks in the iptables and ipvs proxiers were no-ops, so remove them.
2023-03-14 12:18:58 -04:00
Dan Winship
dea8e34ea7 Improve the naming of the stale-conntrack-entry-tracking fields
The APIs talked about "stale services" and "stale endpoints", but the
thing that is actually "stale" is the conntrack entries, not the
services/endpoints. Fix the names to indicate what they actual keep
track of.

Also, all three fields (2 in the endpoints update object and 1 in the
service update object) are currently UDP-specific, but only the
service one made that clear. Fix that too.
2023-03-14 12:18:58 -04:00
Dan Winship
4381973a44 Revert (most of) "Issue 70020; Flush Conntrack entities for SCTP"
This commit did not actually work; in between when it was first
written and tested, and when it merged, the code in
pkg/proxy/endpoints.go was changed to only add UDP endpoints to the
"stale endpoints"/"stale services" lists, and so checking for "either
UDP or SCTP" rather than just UDP when processing those lists had no
effect.

This reverts most of commit aa8521df66
(but leaves the changes related to
ipvs.IsRsGracefulTerminationNeeded() since that actually did have the
effect it meant to have).
2023-03-14 12:18:58 -04:00
Kubernetes Prow Robot
611273a5bb
Merge pull request #115253 from danwinship/proxy-update-healthchecknodeport
Split out HealthCheckNodePort stuff from service/endpoint map Update()
2023-03-13 15:22:48 -07:00
Kubernetes Prow Robot
86bf570711
Merge pull request #111661 from alexanderConstantinescu/etp-local-svc-hc-kube-proxy
[Proxy]: add `healthz` verification when determining HC response for eTP:Local
2023-03-07 05:34:36 -08:00
Alexander Constantinescu
ec917850af Add proxy healthz result to ETP=local health check
Today, the health check response to the load balancers asking Kube-proxy for
the status of ETP:Local services does not include the healthz state of Kube-
proxy. This means that Kube-proxy might indicate to load balancers that they
should forward traffic to the node in question, simply because the endpoint
is running on the node - this overlooks the fact that Kube-proxy might be
not-healthy and hasn't successfully written the rules enabling traffic to
reach the endpoint.
2023-03-06 10:53:17 +01:00
Daman
42a91c29e5 proxier: track metrics before conntrack cleaning 2023-03-02 20:56:05 +05:30
Daman
b23cb97704 proxier: syncing ipvs conntrack cleaning with iptables. 2023-03-02 20:54:34 +05:30
Dan Winship
0c2711bf24 Make NodePortAddresses abstraction around GetNodeAddresses/ContainsIPv4Loopback 2023-02-22 08:32:19 -05:00
Lars Ekman
a05b04ad96 Remove un-used function 2023-02-20 07:26:45 +01:00
Lars Ekman
32f8066119 Simplification and cleanup 2023-02-19 18:25:13 +01:00
Lars Ekman
8d63750c35 Generic sets in netlink and utils 2023-02-19 18:25:07 +01:00
Lars Ekman
17e2c7d535 Move variable closer to it's use 2023-02-19 18:25:02 +01:00
Lars Ekman
3325c7031d Generic sets in ipset.go 2023-02-19 18:24:56 +01:00
Lars Ekman
fbe671d3f0 Use generic sets 2023-02-19 18:24:51 +01:00
Lars Ekman
547db63bdf Drop the IPGetter 2023-02-19 18:24:45 +01:00
Son Dinh
4f75949bcb Ipvs: Add a new FlagSourceHash to "mh" distribution method.
With the flag, ipvs uses both source IP and source port (instead of
only source IP) to distribute new connections evently to endpoints
that avoids sending all connections from the same client (i.e. same
source IP) to one single endpoint.

User can explicitly set sessionAffinity in service spec to keep all
connections from a source IP to end up on the same endpoint if needed.

Change-Id: I42f950c0840ac06a4ee68a7bbdeab0fc5505c71f
2023-02-11 20:51:02 +11:00
Dan Winship
d901992eae Split out HealthCheckNodePort stuff from service/endpoint map Update()
In addition to actually updating their data from the provided list of
changes, EndpointsMap.Update() and ServicePortMap.Update() return a
struct with some information about things that changed because of that
update (eg services with stale conntrack entries).

For some reason, they were also returning information about
HealthCheckNodePorts, but they were returning *static* information
based on the current (post-Update) state of the map, not information
about what had *changed* in the update. Since this doesn't match how
the other data in the struct is used (and since there's no reason to
have the data only be returned when you call Update() anyway) , split
it out.
2023-01-22 10:33:33 -05:00
Hao Ruan
7f3de6e53a fix a typo in pkg/proxy/ipvs/proxier.go 2023-01-09 09:29:22 +08:00
Dan Winship
169604d906 Validate single-stack --nodeport-addresses sooner
In the dual-stack case, iptables.NewDualStackProxier and
ipvs.NewDualStackProxier filtered the nodeport addresses values by IP
family before creating the single-stack proxiers. But in the
single-stack case, the kube-proxy startup code just passed the value
to the single-stack proxiers without validation, so they had to
re-check it themselves. Fix that.
2023-01-03 09:01:45 -05:00
Dan Winship
e7ed7220eb Explicitly pass IP family to proxier
Rather than re-determining it from the iptables object in both proxies.
2023-01-03 09:01:45 -05:00
Lars Ekman
5ff705fd77 proxy/ipvs: Describe and handle a bug in moby/ipvs
Handle https://github.com/moby/ipvs/issues/27
A work-around was already in place, but a segv would occur
when the bug is fixed. That will not happen now.
2022-12-24 10:21:27 +01:00
Lars Ekman
68d78c89ec use netutils.ParseIPSloppy 2022-12-23 14:19:28 +01:00
Lars Ekman
dc86bdc3aa Handle an empty scheduler ("") 2022-12-23 13:23:02 +01:00
Lars Ekman
4adc687275 Fixed typo 2022-12-23 11:13:55 +01:00
Lars Ekman
cf214d0738 Clean-up un-used code 2022-12-23 10:54:51 +01:00