Commit Graph

196 Commits

Author SHA1 Message Date
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
Marek Siarkowicz
3ee8178768 Cleanup defer from SetFeatureGateDuringTest function call 2024-04-24 20:25:29 +02:00
Stephen Kitt
6bf667af06 Switch from golang/mock to uber-go/mock
See https://github.com/golang/mock#gomock: golang/mock is no longer
maintained, and should be replaced by go.uber.org/mock.

This allows golang/mock to be dropped from the status and vendored
fields in unwanted-dependencies.json.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2024-03-07 09:12:16 +01:00
Kubernetes Prow Robot
dc3f5ec6cc Merge pull request #112957 from mxpv/log-dir
Allow changing pod log directory
2024-03-04 21:07:06 -08:00
Paco Xu
0f49a1e36e fix panic in CRI stats of windows 2024-02-18 15:03:11 +08:00
Maksym Pavlenko
ae0a813be1 Fix tests after rebase
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-16 16:02:10 -08:00
Maksym Pavlenko
ff4f2907c5 Use non-default directory for pod logs and limit path to ASCII characters
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-16 09:57:17 -08:00
Maksym Pavlenko
d9e2487d0c Add PodLogsPath to kubelet config
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-16 09:55:59 -08:00
Mark Rossetti
5ba3883be0 Adding unit test for makeWinContainerStats
Signed-off-by: Mark Rossetti <marosset@microsoft.com>
2024-02-12 09:56:58 -08:00
Mark Rossetti
5691a7899e Fixing bug with windows criStatsProvider sometimes not reporting AvailableBytes correctly
Signed-off-by: Mark Rossetti <marosset@microsoft.com>
2024-01-18 10:13:49 -08:00
Kubernetes Prow Robot
e1576c8e43 Merge pull request #121924 from saschagrunert/leaky
Remove `leaky` package and move `PodInfraContainerName` to staging
2024-01-04 17:59:30 +01:00
Davanum Srinivas
d621e09a52 remove unused GetRawContainerInfo
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2023-12-15 05:56:22 -08:00
Davanum Srinivas
e2cf9692fc Remove unused code in kubelet - take 1
spotted `DockerContainer` in types.go and pulling on whether we
really needed it found that a bunch of code is not really
required.

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2023-12-14 13:31:38 -08:00
Sascha Grunert
140abfc010 Remove leaky package and move PodInfraContainerName to staging
The variable can be reused in other projects like cadvisor or container
runtimes later on to identify the pod infra container. The `leaky`
package itself is actually not needed any more.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2023-11-16 14:34:22 +01:00
Kevin Hannon
26923b91e8 implementation of split disk kep 2023-11-01 14:46:33 -04:00
Kubernetes Prow Robot
92c4b3254f Merge pull request #118432 from testwill/stats
chore: loop optimization
2023-10-26 06:25:25 +02:00
Kevin Hannon
8ae0d390d7 add container filesystem to CRI api
Co-authored-by: Mike Brown <brownwm@us.ibm.com>
2023-10-23 15:04:30 -04:00
Sascha Grunert
39dcad8a19 Populate CRI filesystem info error
Usually we just log the error but since it's used by the GC we now
populate it up the call stack.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2023-10-16 13:09:04 +02:00
Kubernetes Prow Robot
95bd8b95a7 Merge pull request #100448 from saschagrunert/cri-stats-log
Do not error log CRI stats for not cached partitions
2023-10-14 23:49:12 +02:00
Christoph Mewes
79a7833ade fix typo Mininum => Minimum 2023-09-17 11:24:29 +02:00
Kubernetes Prow Robot
b27670dfbd Merge pull request #118740 from saschagrunert/kubelet-label-types
Make kubelet label types public
2023-09-06 23:46:57 -07:00
Kubernetes Prow Robot
6b0e66abad Merge pull request #116968 from mansikulkarni96/windowsStatsFromCRI
kubelet: Implement support for Windows podAndContainerStatsFromCRI
2023-07-18 11:07:10 -07:00
Itamar Holder
7d187f967b Unit tests: CRI swap stats
Signed-off-by: Itamar Holder <iholder@redhat.com>
2023-07-18 02:55:56 +03:00
Itamar Holder
59e3e3897e Add SwapStats to summary API through CRI
Signed-off-by: Itamar Holder <iholder@redhat.com>
2023-07-18 02:55:56 +03:00
Itamar Holder
87ff9c4525 Add swap statistics to CRI-API
Signed-off-by: Itamar Holder <iholder@redhat.com>
2023-07-18 02:55:53 +03:00
Itamar Holder
053d7ac61f Unit tests: cadvisor swap stats
Signed-off-by: Itamar Holder <iholder@redhat.com>
2023-07-18 02:40:02 +03:00
Itamar Holder
c74ee8045d Add SwapStats to summary API through cadvisor
Signed-off-by: Itamar Holder <iholder@redhat.com>
2023-07-18 02:40:02 +03:00
Sascha Grunert
a6554b9d5d Make kubelet label types public
We use the label definitions in CRI-O, means we now make them public to
stop vendoring/copying this part of Kubernetes.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2023-07-10 10:58:44 +02:00
guoguangwu
9378e580cf chore: loop optimization 2023-06-03 13:39:50 +08:00
Kubernetes Prow Robot
484645e817 Merge pull request #116659 from claudiubelu/skip-flaky-tests-2
unit tests: Skip flaky tests on Windows (part 2)
2023-05-23 20:04:48 -07:00
Clayton Coleman
166256f73e kubelet: Reduce the interface pod.Manager consumers accept
Every component that uses a pod.Manager should use a stub interface
(like we do for podWorker) that explicitly describes what methods
they use. This will allow podWorker to implement the minimum set
of manager interfaces.
2023-05-12 12:57:27 -04:00
mansikulkarni96
7926656038 kubelet: Implement support for Windows podAndContainerStatsFromCRI
Part of kubernetes/enhancements#2371

Follow up to the initial work introducing CRI API fields for Windows
metrics collection #110754
Windows equivalent work for adding support for Windows
podAndContainerStatsFromCRI #103095, which will allow users to get
Windows pod and container stats only from CRI.

Signed-off-by: mansikulkarni96 <mankulka@redhat.com>
2023-05-01 01:02:44 -04:00
mansikulkarni96
14952cef5b kubelet: Move Linux stats to a Linux specific file
This commit moves the Linux stats from CRI to a linux specific
file and adds unimplemented methods for platform other than
Linux and Windows.
2023-05-01 01:02:36 -04:00
Claudiu Belu
0979d55443 unit tests: Skip flaky tests on Windows (part 2)
Some of the unit tests are currently flaky on Windows. This commit
skips them until they are resolved.
2023-04-13 12:07:18 +00:00
Sascha Grunert
337f4e524a Do not error log CRI stats for not cached partitions
We do not have any cached partitions available on Kubelet start with an
empty container storage in CRI-O. This means that the error log message
is not actually an error and more an information.

This means we now pre-filter those cases and do not `klog.ErrorS` any
more. This helps to avoid log spamming in huge clusters.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2023-03-02 10:10:00 +01:00
Madhav Jivrajani
5e1f440d0a *: Fix linter warnings
Adapt to newly improved linters in golangci-lint v1.51.1

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
2023-02-07 13:01:41 +05:30
Claudiu Belu
ec753fcb55 unittests: Fixes unit tests for Windows (part 6)
Currently, there are some unit tests that are failing on Windows due to
various reasons:

- On Windows, consecutive time.Now() calls may return the same timestamp, which would cause
  the TestFreeSpaceRemoveByLeastRecentlyUsed test to flake.
- tests in kuberuntime_container_windows_test.go fail on Nodes that have fewer than 3 CPUs,
  expecting the CPU max set to be more than 100% of available CPUs, which is not possible.
- calls in summary_windows_test.go are missing context.
- filterTerminatedContainerInfoAndAssembleByPodCgroupKey will filter and group container
  information by the Pod cgroup key, if it exists. However, we don't have cgroups on Windows,
  thus we can't make the same assertions.
2023-01-31 11:49:26 +00:00
Jurj Andrei George
4df989d719 Skip failing Windows unit tests
As discussed during the SIG Testing meeting on January 10, 2023, failing
Windows unit tests are now skipped.
These changes should be reverted when the unit tests wil get fixed.
Mentioned SIG Testing meeting:
https://docs.google.com/document/d/1z8MQpr_jTwhmjLMUaqQyBk1EYG_Y_3D4y4YdMJ7V1Kk/edit#heading=h.qwblxf2uhgoo
2023-01-18 14:18:41 +02:00
Claudiu Belu
b9bf3e5c49 Replaces path.Operation with filepath.Operation (kubelet)
The path module has a few different functions:
Clean, Split, Join, Ext, Dir, Base, IsAbs. These functions do not
take into account the OS-specific path separator, meaning that they
won't behave as intended on Windows.

For example, Dir is supposed to return all but the last element of the
path. For the path "C:\some\dir\somewhere", it is supposed to return
"C:\some\dir\", however, it returns ".".

Instead of these functions, the ones in filepath should be used instead.
2022-11-08 16:05:48 +00:00
Mengjiao Liu
2940484a9a Fix stats for podAndContainerStatsFromCRI 2022-11-07 10:41:45 +08:00
David Ashpole
64af1adace Second attempt: Plumb context to Kubelet CRI calls (#113591)
* plumb context from CRI calls through kubelet

* clean up extra timeouts

* try fixing incorrectly cancelled context
2022-11-05 06:02:13 -07:00
Antonio Ojea
9c2b333925 Revert "plumb context from CRI calls through kubelet"
This reverts commit f43b4f1b95.
2022-11-02 13:37:23 +00:00
David Ashpole
f43b4f1b95 plumb context from CRI calls through kubelet 2022-10-28 02:55:28 +00:00
Kubernetes Prow Robot
127f33f63d Merge pull request #111221 from inosato/remove-ioutil-from-kubelet
Remove ioutil in kubelet/kubeadm and its tests
2022-09-17 21:56:28 -07:00
Peter Hunt~
d6ffca04c9 kubelet/stats: drop makePodStorageStats errors to V(6)
and by doing so, fix a bug where the stats providers report a directory is not found after a pod's storage is removed

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2022-08-16 16:54:29 -04:00
Peter Hunt
6d9264247d kubelet/stats: deduplicate makePodStorageStats
Signed-off-by: Peter Hunt <pehunt@redhat.com>
2022-08-16 16:54:29 -04:00
Paco Xu
e073b0fd65 Disable AcceleratorUsage Metrics: ga 2022-07-30 12:31:43 +08:00
inosato
3b95d3b076 Remove ioutil in kubelet and its tests
Signed-off-by: inosato <si17_21@yahoo.co.jp>
2022-07-30 12:35:26 +09:00
Kubernetes Prow Robot
1c1efde70d Merge pull request #109639 from Abirdcfly/fixduplicateimport
cleanup: remove all duplicate import
2022-07-18 16:55:23 -07:00
Abirdcfly
00b9ead02c cleanup: remove duplicate import
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-07-14 11:25:19 +08:00