113 Commits

Author SHA1 Message Date
Tim Hockin
e54719bb66 Use randfill, do API renames 2025-03-08 15:18:00 -08:00
Tim Hockin
c8111709e5 Add an error matcher, convert 2 tests
I fixed up the TestValidateEndpointsCreate path to show the matcher
instead of manual origin checking.

I picked TestValidateTopologySpreadConstraints because it was the last
failing test on my screen when I changed on of the commonly hard-coded
error strings. I fixed exactly those validation errors that were needed
to make this test pass.  Some of the Origin values can be debated.

The `field/testing.Matcher` interface allows tests to configure the
criteria by which they want to match expected and actual errors.  The
hope is that everyone will use Origin for Invalid errors.

There's some collateral impact for tests which use exact-comparisons and
don't expect origins.  These are all candidates for using the matcher.
2025-02-28 08:36:26 -08:00
Dan Winship
83595f500a NFTablesProxyMode to GA 2025-02-13 10:27:14 -05:00
Kubernetes Prow Robot
e8615e2712 Merge pull request #129054 from pohly/remove-import-name
remove import doc comments
2024-12-12 09:58:35 +01:00
Patrick Ohly
8a908e0c0b remove import doc comments
The "// import <path>" comment has been superseded by Go modules.
We don't have to remove them, but doing so has some advantages:

- They are used inconsistently, which is confusing.
- We can then also remove the (currently broken) hack/update-vanity-imports.sh.
- Last but not least, it would be a first step towards avoiding the k8s.io domain.

This commit was generated with
   sed -i -e 's;^package \(.*\) // import.*;package \1;' $(git grep -l '^package.*// import' | grep -v 'vendor/')

Everything was included, except for
   package labels // import k8s.io/kubernetes/pkg/util/labels
because that package is marked as "read-only".
2024-12-02 16:59:34 +01:00
Dan Winship
49080bf02a Document the existence of nftables as a kube-proxy mode. 2024-11-12 09:51:52 -05:00
Paco Xu
0e10a3a28c Revert "re: kube-proxy: internal config: refactor HealthzAddress and MetricsAddress " 2024-10-21 11:36:59 +08:00
Daman Arora
e63260082a kube-proxy: internal config: refactor Healthz and Metrics Address
Refactor Healthz with Metrics Address for internal configuration of
kube-proxy adhering to the v1alpha2 version specifications as detailed
in https://kep.k8s.io/784.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-10-14 22:56:23 +05:30
Antonio Ojea
7c4c7b14b2 Revert "kube-proxy: internal config: refactor HealthzAddress and MetricsAddress " 2024-10-02 15:08:35 +02:00
Kubernetes Prow Robot
98657377dc Merge pull request #126889 from aroradaman/kube-proxy-refactor-healthz-metrics-address
kube-proxy: internal config: refactor HealthzAddress and MetricsAddress
2024-10-01 14:45:49 +01:00
Daman Arora
3fe9ecd5af kube-proxy: internal config: refactor Healthz and Metrics Address
Refactor Healthz with Metrics Address for internal configuration of
kube-proxy adhering to the v1alpha2 version specifications as detailed
in https://kep.k8s.io/784.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-09-23 23:16:30 +05:30
Joe Betz
2595aa1309 generate 2024-09-03 14:26:26 -04:00
Daman Arora
5359098c14 kube-proxy: internal config: fuzz cidr values for unit tests
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-07-25 19:20:24 +05:30
Daman Arora
3d589bd18a kube-proxy: internal config: remove PortRange
Remove PortRange for internal configuration of kube-proxy
adhering to the v1alpha2 version specifications as detailed in
https://kep.k8s.io/784.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-07-23 19:56:23 +05:30
Daman Arora
c57e1156f5 kube-proxy: internal config: refactor ClusterCIDR
Refactor ClusterCIDR for internal configuration of kube-proxy
adhering to the v1alpha2 version specifications as detailed in
https://kep.k8s.io/784.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-07-23 19:45:29 +05:30
Daman Arora
380adb93cc kube-proxy: internal config: consolidate SyncPeriod and MinSyncPeriod
Consolidate SyncPeriod and MinSyncPeriod for internal configuration
of kube-proxy adhering to the v1alpha2 version specifications as
detailed in https://kep.k8s.io/784.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-07-23 19:34:40 +05:30
Daman Arora
6c10c97c3c kube-proxy: internal config: add Linux section
Introduce Linux section for internal configuration of kube-proxy
adhering to the v1alpha2 version specifications as detailed in
https://kep.k8s.io/784.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-07-16 19:20:48 +05:30
Daman Arora
7a6fec3ea7 kube-proxy: internal config: add Windows section
Introduce Windows section for internal configuration of kube-proxy
adhering to the v1alpha2 version specifications as detailed in
https://kep.k8s.io/784. This also introduces WindowsRunAsService
to v1alpha1 configuration.

Signed-off-by: Daman Arora <aroradaman@gmail.com>
2024-07-15 22:43:47 +05:30
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
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
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
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
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
Patrick Ohly
8f4c9c7605 k8s.io/component-base/logs: replace klog text implementation
This replaces the klog formatting and message routing with a simpler
implementation that uses less code. The main difference is that we skip the
entire unused message routing.

Instead, the same split output streams as for JSON gets implemented in the
io.Writer implementation that gets passed to the textlogger.
2024-01-17 13:50:03 +01:00
Dan Winship
1a6b9b811e Simplify nftables/proxier.go by removing localhost nodeport support
and related route_localnet setting / anti-martian-packet rule
2023-10-31 17:33:53 -04:00
Dan Winship
a70653143e Add a dummy nftables kube-proxy backend which is just a copy of iptables 2023-10-31 17:31:42 -04:00
Kubernetes Prow Robot
5d03ce7ae4 Merge pull request #120354 from aroradaman/proxy-conntrack-api
Add support for `nf_conntrack_tcp_be_liberal` sysctl to kube-proxy
2023-10-31 19:15:44 +01:00
Daman Arora
9ae77364e9 pkg/proxy: configure tcp-be-liberal
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2023-10-28 01:11:24 +05:30
Dan Winship
fcc55280b0 Use k8s.io/utils/ptr in pkg/proxy (#121154)
* Use k8s.io/utils/ptr in pkg/proxy

* Replace pointer.String(), pointer.StringPtr(), and pointer.Bool() with ptr.To()

* Replace pointer.Int32(constexpr) with ptr.To[int32](constexpr)

* Replace pointer.Int32(int32(var)) with ptr.To(int32(var))

* Replace remaining pointer.Int32() cases with ptr.To

* Replace 'tcpProtocol := v1.ProtocolTCP; ... &tcpProtocol', etc with ptr.To(v1.ProtocolTCP)

* Replace 'nodeName = testHostname; ... &nodeName' with ptr.To(testHostname)

* Use ptr.To for SessionAffinityConfig.ClientIP.TimeoutSeconds

* Use ptr.To for InternalTrafficPolicy

* Use ptr.To for LoadBalancer.Ingress.IPMode
2023-10-26 20:56:39 +02:00
Kubernetes Prow Robot
cf54acce5c Merge pull request #120274 from danwinship/kube-proxy-config-docs
kube-proxy config/CLI doc fixups
2023-10-15 02:56:24 +02:00
Daman Arora
15ae6cc160 pkg/proxy: add flag to configure udp conntrack timeouts
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2023-10-12 03:08:21 +05:30
Dan Winship
6c9ddf300c update generated 2023-09-30 10:19:10 -04:00
Dan Winship
9242cb1934 Rearrange kube-proxy config fields / CLI flags to make more sense. 2023-09-30 10:19:07 -04:00
Dan Winship
44cb330aa0 Improve kube-proxy config / CLI documentation 2023-09-30 10:18:16 -04:00
Jordan Liggitt
6c0ea702d4 Conditionally serialize flushFrequency as int 2023-07-16 08:37:37 -04:00
cyclinder
71ef0dafa7 add flag 'logging-format' to kube-proxy 2023-07-13 14:33:33 +08:00
Daman
6a5cf99aad pkg/proxy: human-readable messages
Signed-off-by: Daman <aroradaman@gmail.com>
2023-05-05 14:29:24 +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
Dan Winship
c4575c3438 Fix up detect-local-mode validation
Validate the --detect-local-mode value in the API object validation
rather than doing it separately later. Also, remove runtime checks and
unit tests for cases that would be blocked by validation
2023-05-03 08:22:49 -04:00
Tim Hockin
d55b67b349 Clean up brace whitespace in **/validation_test.go
This was making my eyes bleed as I read over code.

I used the following in vim.  I made them up on the fly, but they seemed
to pass manual inspection.

:g/},\n\s*{$/s//}, {/
:w
:g/{$\n\s*{$/s//{{/
:w
:g/^\(\s*\)},\n\1},$/s//}},/
:w
:g/^\(\s*\)},$\n\1}$/s//}}/
:w
2023-05-02 00:48:42 -07:00
Paco Xu
e28f3de656 Revert "proxy startup-time config handling cleanup" 2023-04-30 09:05:42 +08:00
Dan Winship
9d4f10f5d2 Fix up detect-local-mode validation
Validate the --detect-local-mode value in the API object validation
rather than doing it separately later. Also, remove runtime checks and
unit tests for cases that would be blocked by validation
2023-04-27 15:43:35 -04:00
Lars Ekman
c2bae4dfbd Ipvs: remove the scheduler validation 2023-01-06 19:42:13 +01:00
cyclinder
bef2070031 kube-proxy: add a flag to disables the allowing NodePort services to be accessed via localhost 2022-11-02 16:17:52 +08:00