Commit Graph

284 Commits

Author SHA1 Message Date
Tim Allclair
532607ecbb Revert "Change default filestore permissions to 0700" 2024-12-13 16:59:12 -08:00
Tim Allclair
b2c84061c9 Change default filestore permissions to 0700 2024-12-13 13:11:52 -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
c462d4c8e5 Merge pull request #126096 from utam0k/support-disabling-oom-group-kill
kubelet: new kubelet config option for disabling group oom kill
2024-11-07 06:29:36 +00:00
utam0k
4f909c14a0 kubelet: new kubelet config option for disabling group oom kill
Signed-off-by: utam0k <k0ma@utam0k.jp>
2024-11-07 12:03:04 +09:00
Kubernetes Prow Robot
a2b19b3edb Merge pull request #127910 from leonzz/leonzz-tmp
fix node start time inconsistency in kubelet
2024-11-04 23:15:29 +00:00
leonzz
d5067208e4 fix boottime inconsistency with accurate uptime
`golang.org/x/sys/unix`.`Sysinfo` only provide uptime in whole second,
which leads to +-1s drifting in the boot time calculation. Reading from
/proc/stat is a better option as there's a reliable boot time directly
returned from linux kernel.
2024-11-04 19:09:27 +00:00
Kir Kolyshkin
54d43ecaed pkg/kubelet/user/userns: remove, use moby/sys/userns
The code from github.com/opencontainers/runc/libcontainer/userns package
was moved into github.com/moby/sys/user and github.com/moby/sys/userns
(see [1]), and the runc package is now deprecated in favor of moby/sys
(see [2]).

In addition, moby/sys/userns now has a non-Linux implementation, so
pkg/kubelet/user/userns package (introduced in commit 2e999ff to make a
non-Linux implementation) is not really needed anymore.

Let's switch to moby/sys/userns, and remove the package.

[1]: https://github.com/moby/sys/releases/tag/userns%2Fv0.1.0
[2]: https://github.com/opencontainers/runc/pull/4350

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2024-10-22 14:36:14 -07:00
Matthieu MOREL
f736cca0e5 fix: enable expected-actual rule from testifylint in module k8s.io/kubernetes
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-09-27 07:56:31 +02:00
Matthieu MOREL
27b98be303 fix: enable nil-compare and error-nil rules from testifylint in module k8s.io/kubernetes
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-09-25 06:02:47 +02:00
Kubernetes Prow Robot
36de77c4e0 Merge pull request #125142 from TommyStarK/unit-tests/kubelet-util-manager
kubelet/util/manager: small cleanup and start replacing deprecated functions wait.Poll/wait.PollImmediate
2024-09-14 17:13:13 +01:00
TommyStarK
2ed556ae00 kubelet/util/manager: small cleanup and start replacing deprecated functions wait.Poll/wait.PollImmediate
Signed-off-by: TommyStarK <thomasmilox@gmail.com>
2024-09-14 11:07:16 +02:00
Itamar Holder
b811af496c fix misleading log about swap being on
Currently, a log is triggered about swap
being on even if swap is off.

After this commit, the log would be triggered
only if swap is truly turned on.

Signed-off-by: Itamar Holder <iholder@redhat.com>
2024-09-12 18:23:25 +03:00
Matthieu MOREL
f014b754fb fix: enable empty and len rules from testifylint on pkg package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
2024-07-06 23:15:43 +00:00
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
Kubernetes Prow Robot
e6616033cb Merge pull request #120844 from bzsuni/cleanup/sets/kubelet
[kubelet] Use a generic Set instead of a specified Set
2024-06-14 09:09:17 -07:00
Kubernetes Prow Robot
d145bf0907 Merge pull request #125138 from AkihiroSuda/fix-125137
kubelet: fix `Turning off swap in unprivileged tmpfs mounts unsupported`
2024-06-09 19:43:11 -07:00
Kubernetes Prow Robot
9c4181e234 Merge pull request #119786 from bzsuni/ut/pkg/kubelet/util
[UT] add ut for pkg/kubelet/util
2024-06-04 11:23:28 -07:00
Kubernetes Prow Robot
a8d51f4f05 Use a generic Set instead of a specified Set in kubelet
Signed-off-by: bzsuni <bingzhe.sun@daocloud.io>
2024-06-04 14:25:43 +08:00
Akihiro Suda
b3175b8e99 kubelet: fix Turning off swap in unprivileged tmpfs mounts unsupported
Fix issue 125137

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-05-27 19:07:06 +09:00
Itamar Holder
a6b971f14b Use kubelet owned directories for mounting rather than /tmp
Signed-off-by: Itamar Holder <iholder@redhat.com>
2024-05-21 13:18:16 +03:00
Itamar Holder
29535c0463 Warn of swap is enabled on the OS and tmpfs noswap is not supported
When --fail-swap-on=false kubelet CLI argument
is provided, but tmpfs noswap is not supported
by the kernel, warn about the risks of memory-backed
volumes being swapped into disk

Signed-off-by: Itamar Holder <iholder@redhat.com>
2024-05-21 13:18:16 +03:00
Itamar Holder
e7df4d17c4 Add a isSwapOnAccordingToProcSwaps() function and swap utils unit tests
Signed-off-by: Itamar Holder <iholder@redhat.com>
2024-05-21 13:18:16 +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
Itamar Holder
fb6c78c90b Use tmpfs noswap if supported
use the tmpfs noswap option in order
to mount memory-backed volumes if it's supported.

Signed-off-by: Itamar Holder <iholder@redhat.com>
2024-05-21 13:18:16 +03:00
Sascha Grunert
2aa9e76be1 Move pkg/kubelet/cri/remote to cri-client
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2024-05-14 10:58:18 +02:00
Wojciech Tyczyński
36141fa6fb Bump min watch timeout for secret & configmap manager in Kubelet 2024-04-10 19:36:29 +02:00
Tim Hockin
6dbc754ed6 Retool typecheck to be simpler
Instead of walking paths ourselves, just let Go's packages library do
it.  This is a slight CLI change - it wants "./foo" rather than "foo".

This also flagged a few things which seem to be legit failures.
2024-02-29 22:07:00 -08:00
Antonio Ojea
b8533f7976 kubelet: add metric for the first pod with network latency
The first pod with network latency impact user workloads, however,
it is difficuly to understand where is the problem of this latency,
since it depends on the CNI plugin to be ready at the moment of the
pod creation.

Add a new internal metric in the kubelet that allow developers and cluster
administrator to understand the source of the latency problems on
node startups.

kubelet_first_network_pod_start_sli_duration_seconds

Change-Id: I4cdb55b0df72c96a3a65b78ce2aae404c5195006
2023-11-15 06:09:49 +00:00
ruiwen-zhao
1165609036 Add metric for e2e pod startup latency including image pull
Signed-off-by: ruiwen-zhao <ruiwen@google.com>
2023-10-25 20:34:17 +00:00
bzsuni
4e315b85eb add ut for pkg/kubelet/util
Signed-off-by: bzsuni <bingzhe.sun@daocloud.io>
2023-10-25 22:16:02 +08:00
Kubernetes Prow Robot
7824ac0f3e Merge pull request #114336 from claudiubelu/fixes-test-get-file-type
unittests: Fixes hostutil.GetFileType for Windows
2023-10-17 20:07:39 +02:00
Kubernetes Prow Robot
4fd8bd9975 Merge pull request #118568 from qiutongs/node-startup-latency
Create a node startup latency tracker
2023-09-15 13:00:12 -07:00
Qiutong Song
d3eb082568 Create a node startup latency tracker
Signed-off-by: Qiutong Song <songqt01@gmail.com>
2023-09-11 05:54:25 +00:00
likakuli
e167ecbb9e fix: only invoke AddReference first time when to sync same pod to minimize unnecessary API requests to the API server for the configmap/secret get API
Signed-off-by: likakuli <1154584512@qq.com>
2023-08-31 22:56:49 +08:00
Gunju Kim
b94fa250c2 Sidecar: Implement lifecycle of the restartable init container
- Implement `computeInitContainerActions` to sets the actions for the
  init containers, including those with `RestartPolicyAlways`.
- Allow StartupProbe on the restartable init containers.
- Update PodPhase considering the restartable init containers.
- Update PodInitialized status and status manager considering the
  restartable init containers.

Co-authored-by: Matthias Bertschy <matthias.bertschy@gmail.com>
2023-07-08 07:26:12 +09:00
Claudiu Belu
b4d1440063 unittests: Fixes hostutil.GetFileType for Windows
GetFileType is meant to return the type of the given file by using os.Stat.
However, os.Stat doesn't work on Windows for Unix Sockets, causing an error to occur:

[2-Socket Test] unexpected error :
CreateFile C:\Users\Administrator\AppData\Local\Temp\test-get-filetype-2776877299\mt.sock:
The file cannot be accessed by the system.

This is a known issue and we're already using a workaround for this in
pkg/kubelet/util/util_windows.go.

This commit fixes this issue for GetFileType on Windows.
2023-06-01 16:02:07 +00:00
Claudiu Belu
11f1d24165 unit tests: Fixes kubelet util unit tests for Windows
The unit tests are currently failing due to missing imports. This commit
addresses this issue.

Additionally, TestIsUnixDomainSocket expects an error to be raised by
IsUnixDomainSocket if the file does not exist, but on Windows we do not
raise such error.

This issue is addressed by Stat-ing the file, and checking
if the file exists or not. We're also handling the case in which the given
filePath is a named pipe, returning false immediately, instead of trying to
dial it as a Unix domain socket.
2023-05-10 11:25:49 +00:00
Kubernetes Prow Robot
65c13c5c21 Merge pull request #117836 from ruquanzhao/addPodUID
Passing podUID in AddReference and DeleteReference
2023-05-10 00:18:59 -07:00
RuquanZhao
9150e6b55a s/of referencedFrom/from referenceFrom/
Signed-off-by: Ruquan Zhao <ruquan.zhao@arm.com>
2023-05-10 10:22:52 +08:00
RuquanZhao
308ab380d7 Add unit testcases of refMap.
Signed-off-by: Ruquan Zhao <ruquan.zhao@arm.com>
2023-05-09 18:05:43 +08:00
RuquanZhao
ccb4ca8954 record podUID in refMap in watchBasedManager
Signed-off-by: Ruquan Zhao <ruquan.zhao@arm.com>
2023-05-08 15:32:10 +08:00
RuquanZhao
936265e870 Add podUID in AddReference and DeleteReference
Signed-off-by: Ruquan Zhao <ruquan.zhao@arm.com>
2023-05-06 13:58:14 +08:00
Francesco Romani
6b4ffdb9f7 node: re-implement Localendpoint on windows
this will allows us to move forward with the podresources
endpoint GA graduation.

xref: https://github.com/kubernetes/kubernetes/issues/78628

Signed-off-by: Francesco Romani <fromani@redhat.com>
2023-03-14 22:39:56 +01:00
Kubernetes Prow Robot
8bf7805e05 Merge pull request #115397 from sourcelliu/boottime
Add test for pkg/kubelet/util
2023-03-14 09:39:18 -07:00
Kubernetes Prow Robot
af97bb9ac5 Merge pull request #115053 from qingwave/remove-unuse-code
Remove unuse code in pkg/kubelet/util
2023-03-14 09:39:10 -07:00
Kubernetes Prow Robot
898143a96a Merge pull request #114904 from TommyStarK/kubelet/pod_startup_latency_tracker
kubelet: fix recording when pulling image did finish
2023-03-14 09:39:02 -07:00
Kubernetes Prow Robot
15f5a5c6ef Merge pull request #110949 from claudiubelu/adds-unittests-4
tests: Ports kubelet unit tests to Windows
2023-03-09 21:32:30 -08:00
Kubernetes Prow Robot
54ec651ab5 Merge pull request #110741 from zhoumingcheng/master-unit-v1
add unit test coverage for pkg/kubelet/util/queue
2023-03-09 11:15:51 -08:00
TommyStarK
951decd1e6 kubelet: fix recording when pulling image did finish
Signed-off-by: TommyStarK <thomasmilox@gmail.com>
2023-03-02 20:21:35 +01:00