Commit graph

2524 commits

Author SHA1 Message Date
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
Heba
aceb89debc
KEP-5471: Extend tolerations operators (#134665)
* Add numeric operations to tolerations

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* code review feedback

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* add default feature gate

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* Add integration tests

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* Add toleration value validation

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>

* Add validate options for new operators

Signed-off-by: helayoty <heelayot@microsoft.com>

* Remove log

Signed-off-by: helayoty <heelayot@microsoft.com>

* Update feature gate check

Signed-off-by: helayoty <heelayot@microsoft.com>

* emove IsValidNumericString func

Signed-off-by: helayoty <heelayot@microsoft.com>

* Implement IsDecimalInteger

Signed-off-by: helayoty <heelayot@microsoft.com>

* code review feedback

Signed-off-by: helayoty <heelayot@microsoft.com>

* Add logs to v1/toleration

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>
Signed-off-by: helayoty <heelayot@microsoft.com>

* Update integration tests and address code review feedback

Signed-off-by: helayoty <heelayot@microsoft.com>

* Add feature gate to the scheduler framework

Signed-off-by: helayoty <heelayot@microsoft.com>

* Remove extra test

Signed-off-by: helayoty <heelayot@microsoft.com>

* Fix integration test

Signed-off-by: helayoty <heelayot@microsoft.com>

* pass feature gate via TolerationsTolerateTaint

Signed-off-by: helayoty <heelayot@microsoft.com>

---------

Signed-off-by: Heba Elayoty <heelayot@microsoft.com>
Signed-off-by: helayoty <heelayot@microsoft.com>
2025-11-10 12:42:54 -08:00
PersistentJZH
b738e8c3ca fix panic in cron.ParseStandard
Signed-off-by: PersistentJZH <zhihao.kan17@gmail.com>

fix

optimize logic

fix unit test
2025-10-10 23:51:05 +08: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
6f4d3e0f87
Merge pull request #132365 from mohiuddin-khan-shiam/master
flag: fix nil-ptr panic & typo messages
2025-09-01 18:29:13 -07:00
Kubernetes Prow Robot
df696c3189
Merge pull request #132657 from danwinship/drop-bfr
Drop BoundedFrequencyRunner from pkg/util/async
2025-07-23 22:52:32 -07:00
Kubernetes Prow Robot
84c00d8538
Merge pull request #124318 from liangyuanpeng/drop-ptr-wrappers-pkg-util
pkg/util: drop pointer wrapper functions.
2025-07-04 15:25:24 -07:00
Dan Winship
12330a6c42 Drop BoundedFrequencyRunner from pkg/util/async
It is no longer used by anything (since kube-proxy now has its own
custom copy).
2025-07-01 12:49:16 -04:00
Kubernetes Prow Robot
b3e438aef9
Merge pull request #132220 from BenTheElder/a-little-owners-cleanup
emeritus spiffxp and backfill OWNERS
2025-06-25 19:16:28 -07:00
S. M. Mohiuddin Khan Shiam
e7d76f37a4 flag: fix nil-ptr panic & typo messages
### What changed
* [RegisterWithTaintsVar](cci:2://file:///d:/Github/kubernetes/pkg/util/flag/flags.go:260:0-262:1)
  * Added nil-target checks in [Set](cci:1://file:///d:/Github/kubernetes/pkg/util/flag/flags.go:170:0-231:1) and [String](cci:1://file:///d:/Github/kubernetes/pkg/util/flag/flags.go:151:0-157:1); avoids panic when slice pointer isn’t pre-initialised.
* [ReservedMemoryVar](cci:2://file:///d:/Github/kubernetes/pkg/util/flag/flags.go:165:0-168:1)
  * Closed missing parenthesis in error string.
  * Corrected spelling in three user-visible error messages.

### Why it matters
* Prevents kubelet (and any consumer) from crashing during flag parsing if the `--register-with-taints` target slice wasn’t set up.
* Clear, correctly-spelled errors make mis-configured `--reserved-memory` flags easier to diagnose.

_No functional behaviour altered; only robustness and usability improved._
2025-06-18 02:06:11 +06:00
PatrickLaabs
72654620a2 removing WaitIntervalString from iptables 2025-06-17 13:49:58 +02:00
Benjamin Elder
ad68a4b4cd emeritus spiffxp
spiffxp moved on from the project years ago, he is still missed
2025-06-10 20:05:40 -07:00
Dan Winship
97ec8618d3 Fix kubelet iptables startup, clarify semantics of utiliptables calls. 2025-06-07 10:28:36 -04:00
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
Lan Liang
253a08d7e3 pkg/util: drop pointer wrapper functions.
The new k8s.io/utils/ptr package provides generic wrapper functions,
which can be used instead of type-specific pointer wrapper functions.
This replaces the latter with the former, and migrates other uses of
the deprecated pointer package to ptr in affacted files.

See kubernetes/utils#283 for details.

Signed-off-by: Lan Liang <gcslyp@gmail.com>
2025-06-05 04:48:25 +00:00
Cyclinder Kuo
0a96613754 proxy: remove iptables wait interval flag
Signed-off-by: cyclinder <kuocyclinder@gmail.com>
2025-05-30 16:13:06 +08:00
Daman Arora
57218ac969 Revert "kube-proxy: log errors during proxy boot"
This reverts commit 9cb3dfb5d3.
2025-05-07 19:53:45 +05:30
Daman Arora
9cb3dfb5d3 kube-proxy: log errors during proxy boot
Signed-off-by: Daman Arora <aroradaman@gmail.com>
2025-04-26 16:06:18 +05:30
Sreeram
f035e37c4b Added e2e test and fixed existing pod test 2025-03-25 02:05:30 +05:30
Dan Winship
8c98dee1ed Add utiliptables.NewDualStack
Basically all callers want dual-stack-if-possible, so simplify that.

Also, tweak the startup-time checking in kubelet to treat "no iptables
support" as interesting but not an error.
2025-03-08 10:14:17 -05:00
Dan Winship
b031258969 Improve utiliptables error handling when there's no iptables binary
If `iptables --version` failed, utiliptables.New() would log a warning
and assume that the problem was that you had an implausibly ancient
version of iptables installed. Change it to instead assume that the
problem is that you don't have iptables installed at all (and don't
log anything; the caller will discover this later).
2025-03-08 10:11:16 -05:00
Dan Winship
f1d0eb4fe4 Add a unit test for utiliptables.New() 2025-03-08 10:11:16 -05:00
Dan Winship
9c98d29795 Remove exec arg from utiliptables.New
It was there so you could mock the results via a FakeExec, but these
days any unit tests outside of pkg/util/iptables that want to mock
iptables results use a FakeIPTables instead of a real
utiliptables.Interface with a FakeExec.
2025-03-08 10:11:15 -05:00
Kubernetes Prow Robot
0eaee48ecb
Merge pull request #130569 from dims/update-to-latest-cadvisor-v0.52.0
Update to latest cadvisor @ v0.52.1 and new opencontainer/cgroups and drops opencontainers/runc
2025-03-07 17:09:51 -08:00
Kubernetes Prow Robot
1c9840c58e
Merge pull request #130243 from rata/revert-userns-kernel-check
Revert userns kernel check
2025-03-07 02:35:44 -08:00
Davanum Srinivas
5ecddb6571
update to latest cadvisor @ v0.52.0
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2025-03-05 06:36:39 -05:00
Kubernetes Prow Robot
47dbade7f4
Merge pull request #130245 from marosset/windows-unit-tests-pkg-util-filesystem-fixes
Fixing k8s.io/kubernetes/pkg/util/filesystem unit tests for Windows
2025-03-03 16:59:41 -08:00
Mark Rossetti
5eb37b073c
Fixing k8s.io/kubernetes/pkg/util/filesystem unit tests for Windows
Signed-off-by: Mark Rossetti <marosset@microsoft.com>
2025-02-27 13:50:24 -08:00
mansikulkarni96
dfc8b271cf
[kubelet] Make use of os.ModeSocket info 2025-02-21 18:02:25 -05:00
Kubernetes Prow Robot
b84cb65f93
Merge pull request #129370 from andyzhangx/adopt-go1.23-behavior-change
fix: adopt go1.23 behavior change in mount point parsing on Windows#2
2025-02-21 12:50:26 -08:00
Rodrigo Campos
7deb49e3a6 Revert "Enforce the Minimum Kernel Version 6.3 for UserNamespacesSupport feature"
This reverts commit 8597b343fa.

I wrote in the Kubernetes documentation:

	In practice this means you need at least Linux 6.3, as tmpfs started
	supporting idmap mounts in that version. This is usually needed as
	several Kubernetes features use tmpfs (the service account token that is
	mounted by default uses a tmpfs, Secrets use a tmpfs, etc.)

The check is wrong for several reasons:
	* Pods can use userns before 6.3, they will just need to be
	  careful to not use a tmpfs (like a serviceaccount). MOST users
	  will probably need 6.3, but it is possible to use earlier kernel
	  versions. 5.19 probably works fine and with improvements in
          the runtime 5.12 can probably be supported too.
	* Several distros backport changes and the recommended way is
	  usually to try the syscall instead of testing kernel versions.
	  I expect support for simple fs like tmpfs will be backported
	  in several distros, but with this check it can generate confusion.
	* Today a clear error is shown when the pod is created, so it's
	  unlikely a user will not understand why it fails.
	* Returning an error if utilkernel fails to understand what
	  kernel version is running is also too strict (as we are
	  logging a warning even if it is not the expected version)
	* We are switching to enabled by default, which will log a
	  warning on every user that runs on an older than 6.3 kernel,
	  adding noise to the logs.

For there reasons, let's just remove the hardcoded kernel version check.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2025-02-18 17:24:50 +01:00
andyzhangx
bb49a05fb5 fix: adopt go1.23 behavior change in mount point parsing on Windows
fix comments
2025-02-18 07:17:51 +00:00
Tim Allclair
a7340ff36c [windows] Don't chown existing directory in MkdirAll 2024-12-16 14:10:56 -08: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
Kubernetes Prow Robot
469524442f
Merge pull request #126621 from my-git9/node-deadcode-remove
Remove deadcode in pkg/util/node
2024-11-08 16:38:45 +00:00
nikzayn
ab87218cf1 feat: support changes for net.ipv4.tcp_rmem and net.ipv4.tcp_wmem #125234
Signed-off-by: nikzayn <nikhilvaidyar1997@gmail.com>
2024-09-20 11:22:28 +08:00
Kubernetes Prow Robot
b005b40027
Merge pull request #125136 from mauri870/feature/wsl2-kernel-test
util: add test case for WSL kernel version parsing
2024-09-19 20:23:27 +01:00
xin.li
b24804faf8 remove deadcode in pkg/util/node
Signed-off-by: xin.li <xin.li@daocloud.io>
2024-08-10 23:32:23 +08:00
Kubernetes Prow Robot
9c763a9c9f
Merge pull request #126104 from cji/5321
Add funcs in pkg/filesystem/util to set file permissions on Windows and update container log dir perms
2024-07-16 10:33:05 -07:00
Mark Rossetti
b377dfba0c
Add funcs in pkg/filesystem/util that can actually set file permissiosn
on Windows and update container log dir perms to 660 on Windows
2024-07-15 14:22:59 -07:00
Kubernetes Prow Robot
fe1840205c
Merge pull request #125926 from MadhavJivrajani/bump-staticcheck-exclude-SA1006
[go1.23] hack: bump go-tools and exclude SA1006
2024-07-15 10:05:19 -07:00
Madhav Jivrajani
c5481b0413 .*: fix lint errors
Fix SA4032 and SA3000 which are flagged after bumping to go1.23rc1
and v0.5.0-rc1 of go-tools.

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
2024-07-15 15:03:15 +05:30
Dan Winship
505f6833d9 Require kernel 5.13 for nftables kube-proxy 2024-07-01 10:07:27 -04:00
Antonio Ojea
f36975b193 remove iptree from tree 2024-06-27 11:33:36 +00:00
Kubernetes Prow Robot
eb6840928d
Merge pull request #124160 from Karthik-K-N/fix-buildconstraints
Add doc.go file without any buildconstraint to run tests on non linux platforms
2024-06-13 16:29:06 -07:00
Sascha Grunert
0c9949b6ec
Move pkg/kubelet/kuberuntime/logs to k8s.io/cri-client staging
Particulary helpful to decouple cri-tools from k/k.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2024-05-30 15:13:22 +02:00
Mauri de Souza Meneguzzo
b8e5a3ed32 pkg/util/coverage: update fakeTestDeps methods
Go 1.23 changed the signature of the testDeps interface so we need to
add a blank implementation for InitRuntimeCoverage to fakeTestDeps.
2024-05-29 12:31:22 -03:00
Mauri de Souza Meneguzzo
7fcaaa5585 util: add test case for WSL kernel version parsing 2024-05-26 18:40:10 -03:00
Itamar Holder
2a174d09fa If the kernel version is at least 6.4, assume tmpfs noswap is supported
Signed-off-by: Itamar Holder <iholder@redhat.com>
2024-05-21 13:18:16 +03:00