Commit Graph

10487 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
51c54a1e2f
Merge pull request #114179 from lixiaobing1/break
improve performance
2023-01-31 21:01:06 -08:00
mantuliu
3f8ada67c5 impove the coverage
Signed-off-by: mantuliu <240951888@qq.com>
2023-02-01 10:47:38 +08:00
ruiwen-zhao
fabcc91956 Ignore container events with nil PodSandboxStatus
Signed-off-by: ruiwen-zhao <ruiwen@google.com>
2023-01-31 22:50:51 +00:00
mantuliu
52e7bf58cf cut avoid unnecessary code duplications
Signed-off-by: mantuliu <240951888@qq.com>
2023-01-31 23:55:09 +08:00
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
songxiao-wang87
3e6b954290 Making a run test.
Signed-off-by: songxiao-wang87 <wang.xiaosong23@zte.com.cn>
2023-01-31 09:38:48 +00:00
Kubernetes Prow Robot
4df945853e
Merge pull request #115137 from swatisehgal/topologymgr-metrics
node: topologymgr: add metrics about admission requests and errors
2023-01-30 18:43:00 -08:00
Kubernetes Prow Robot
559014f13e
Merge pull request #115273 from SergeyKanzhelev/restartCountRegexFix
use a proper regex looking for the restartCount
2023-01-30 17:36:49 -08:00
Kubernetes Prow Robot
d0584179f4
Merge pull request #114367 from liggitt/kubelet-csr-init
Check for initial kubelet certificates more frequently
2023-01-30 09:07:05 -08:00
Kubernetes Prow Robot
232c0de57a
Merge pull request #115101 from HirazawaUi/delte-pkg-kubelet-unused-functions
delete unused functions in pkg/kubelet directory
2023-01-29 17:21:08 -08:00
mantuliu
8ca97dcde1 Add test for pkg/kubelet/sysctl/allowlist_test.go 2023-01-29 22:48:27 +08:00
Kubernetes Prow Robot
538c6c044f
Merge pull request #115329 from aojea/disable_probe
skip scale test for probes
2023-01-25 22:02:33 -08:00
Kubernetes Prow Robot
083e0d2be1
Merge pull request #114991 from TheOneTheOnlyJJ/skip-failing-unittests
Skip failing Windows unit tests
2023-01-25 22:02:25 -08:00
Antonio Ojea
3fb4edb257 skip scale test for probes
Change-Id: I215e2cf9211348aadcc0d262da01953d6523794a
2023-01-26 00:02:30 +00:00
Sergey Kanzhelev
15b63c380e use a proper regex looking for the restartCount 2023-01-25 23:55:27 +00:00
Kubernetes Prow Robot
a12dd4189e
Merge pull request #115102 from saschagrunert/cri-unavailable
Check for all errors in CRI connection validation
2023-01-24 02:24:17 -08:00
Kubernetes Prow Robot
674eb36f92
Merge pull request #115249 from thockin/codegen-13-proto-go-packages
Set go_package in all proto files
2023-01-23 12:14:07 -08:00
Tim Hockin
60ffa47f4f
Set proto go_package: kubelet example_plugin_apis
This creates some diff to the *.pb.go files to note that
in the "options".

You can dump the gzipped blob with the following program (thanks
StackOverflow!):

```go
package main

import (
	"bytes"
	"compress/gzip"
	"encoding/json"
	"fmt"
	"os"

	"io/ioutil"

	proto "github.com/golang/protobuf/proto"
	dpb "github.com/golang/protobuf/protoc-gen-go/descriptor"
)

func main() {
	m := map[string][]byte{
		"before": blobv1,
		"after": blobv2,
	}
	arg := os.Args[1]
	dump(m[arg])
}

func dump(bytes []byte) {
	fd, err := decodeFileDesc(bytes)
	if err != nil {
		panic(err)
	}
	b, err := json.MarshalIndent(fd, "", "  ")
	if err != nil {
		panic(err)
	}
	fmt.Println(string(b))
}

// decompress does gzip decompression.
func decompress(b []byte) ([]byte, error) {
	r, err := gzip.NewReader(bytes.NewReader(b))
	if err != nil {
		return nil, fmt.Errorf("bad gzipped descriptor: %v", err)
	}
	out, err := ioutil.ReadAll(r)
	if err != nil {
		return nil, fmt.Errorf("bad gzipped descriptor: %v", err)
	}
	return out, nil
}

func decodeFileDesc(enc []byte) (*dpb.FileDescriptorProto, error) {
	raw, err := decompress(enc)
	if err != nil {
		return nil, fmt.Errorf("failed to decompress enc: %v", err)
	}

	fd := new(dpb.FileDescriptorProto)
	if err := proto.Unmarshal(raw, fd); err != nil {
		return nil, fmt.Errorf("bad descriptor: %v", err)
	}
	return fd, nil
}
```
2023-01-23 09:31:18 -08:00
Jan Safranek
cca3d557e6 Split volume reconstruction refactoring from SELinuxMountReadWriteOncePod
Add a new feature gate NewVolumeManagerReconstruction and add the new
volume reconstruction done in 1.26 under that feature gate.
2023-01-23 14:43:29 +01:00
Patrick Ohly
bc6c7fa912 logging: fix names of keys
The stricter checking with the upcoming logcheck v0.4.1 pointed out these names
which don't comply with our recommendations in
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/migration-to-structured-logging.md#name-arguments.
2023-01-23 14:24:29 +01:00
Antonio Ojea
dbf178a8d1 add scale test for probes
Change-Id: I1e49943531b569b5e02f82369750a9ca899ae726
2023-01-22 16:57:41 +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
Kubernetes Prow Robot
c913e6ce62
Merge pull request #114542 from pacoxu/EphemeralContainers
cleanup: EphemeralContainers feature gate related codes
2023-01-17 11:18:34 -08:00
Swati Sehgal
172c55d310 node: topologymgr: add metrics about admission requests and errors
Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2023-01-17 17:50:29 +00:00
Kubernetes Prow Robot
727b5a4b47
Merge pull request #114231 from helio/fix-windows-cpu-maximum
win: fix cpu count to calculate cpu_maximum
2023-01-17 07:56:33 -08:00
Sascha Grunert
e89547d308
Check for all errors in CRI connection validation
We only have one CRI API (v1) to validate during the initial connection
of the kubelet with the container runtime. Therefore we can now verify
all kind of GRPC related issues.

Fixes: https://github.com/kubernetes/kubernetes/issues/114956

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2023-01-17 09:24:31 +01:00
HirazawaUi
a8173eded3 delete unused functions in pkg/kubelet directory 2023-01-16 20:00:49 +08:00
Paco Xu
70e56fa71a cleanup: EphemeralContainers feature gate related codes 2023-01-15 21:15:01 +08:00
David Porter
8e3a02efa8 Remove AcceleratorUsageMetrics from kubelet
The feature gate is GA'd and enabled by default and the metrics have
been removed from cAdvisor.

Signed-off-by: David Porter <david@porter.me>
2023-01-11 16:07:39 -08:00
Kubernetes Prow Robot
6f6c468168
Merge pull request #114802 from moshe010/pod-resource-metrics
kubelet podresource: fix GetAllocatableResources metrics
2023-01-11 06:43:44 -08:00
Kubernetes Prow Robot
2a2f994c24
Merge pull request #114187 from claudiubelu/refactor-platform-deps-3
Refactors kubelet's plugin watcher
2023-01-10 15:25:26 -08:00
TommyStarK
1fcc8fbf59 kubelet: Replace deprecated pointer function
Signed-off-by: TommyStarK <thomasmilox@gmail.com>
2023-01-08 13:44:09 +01:00
Ian K. Coolidge
5533e49e2c cpuset: Add package comment
Describe use cases (node IDs, HT siblings, etc)

Call out novelty (Linux CPU list parse/dump)

Describe future work (relax immutable, refactor to use 'set')
2023-01-06 23:32:51 +00:00
Ian K. Coolidge
cbb985a310 cpuset: Delete 'builder' methods
All usage of builder pattern is convertible to cpuset.New()
with the same or fewer lines of code.

Migrate Builder.Add to a private method of CPUSet, with a comment
that it is only intended for internal use to preserve immutable
propoerty of the exported interface.

This also removes 'require' library dependency, which avoids
non-standard library usage.
2023-01-06 23:32:51 +00:00
Ian K. Coolidge
f3829c4be3 cpuset: Rename 'NewCPUSet' to 'New' 2023-01-06 23:32:51 +00:00
Ian K. Coolidge
768b1ecfb6 cpuset: hide 'Filter' API
FilterNot is only used in this file, and is trivially converted to a
'filter' call site by inverting the predicate.

Filter is only used in this file, so don't export it.
2023-01-06 23:32:51 +00:00
Ian K. Coolidge
e5143d16c2 cpuset: Make 'ToSlice*' methods look like 'set' methods
In 'set', conversions to slice are done also, but with different names:

ToSliceNoSort() -> UnsortedList()
ToSlice() -> List()

Reimplement List() in terms of UnsortedList to save some duplication.
2023-01-06 23:32:51 +00:00
Ian K. Coolidge
a0c989b99a cpuset: Remove *Int64 methods
These are rarely used and can be accommodated with a trivial helper.
2023-01-06 23:32:51 +00:00
Ian K. Coolidge
67a057d4f2 cpuset: Remove 'MustParse' method
Removes exit/fatal from cpuset library.

Usage in podresources test was not necessary.

Library reference in cpu_manager_test was moved to a local function, and
converted to use e2e test framework error catching.
2023-01-06 23:32:51 +00:00
Ian K. Coolidge
824bd57ad6 cpuset: Convert Union arguments to variadic
This allows Union to implement UnionAll easily.
2023-01-06 23:32:50 +00:00
Kubernetes Prow Robot
492637878f
Merge pull request #111660 from pacoxu/key-encipherment-v1.26
Key encipherment usage  v1.27
2023-01-04 15:51:57 -08:00
weizhi
575616cc72
fix: kubelet event about unattached volumes is incorrect (#112719)
* fix kubelet event

* add ut

* fix ut
2023-01-04 01:51:59 -08:00
Moshe Levi
ce46ba7be8 kubelet podresource: fix GetAllocatableResources metrics
The GetAllocatableResources increase twice the PodResourcesEndpointRequestsTotalCount
This PR fix this.

Signed-off-by: Moshe Levi <moshele@nvidia.com>
2023-01-04 10:58:55 +02:00
Kubernetes Prow Robot
b532f2b3e7
Merge pull request #112136 from pacoxu/migrate-runtime-endpoint-flags
kubelet: migrate container runtime endpoint flag to config
2023-01-03 09:29:31 -08:00
huyinhou
4702503d15 update test case
Signed-off-by: huyinhou <huyinhou@bytedance.com>
2023-01-03 15:00:12 +08:00
sorkinl
71d44a9348 Refactors kubelet's plugin watcher
Refactors platform specific code into separate files (*_linux.go / *_windows.go / *_others.go)

Adds unit tests for the pluginwatcher changes.
2023-01-01 00:26:37 +00:00
huyinhou
b9987eeb6c fix allDevices map data race 2022-12-29 18:27:08 +08:00
huyinhou
997cefc9da add unit test 2022-12-29 14:50:18 +08:00
Paco Xu
160f015ef4 kubelet: add key encipherment usage only if it is rsa key
remove allowOmittingUsageKeyEncipherment as it is always true

Signed-off-by: Paco Xu <paco.xu@daocloud.io>
2022-12-27 16:04:25 +08:00
Kubernetes Prow Robot
0b05897c30
Merge pull request #112021 from mrunalp/test_host_path_pv_selinux_fix
Set correct SELinux label for host paths volumes created by host path provisioner
2022-12-23 12:35:27 -08:00
Kubernetes Prow Robot
6a48538090
Merge pull request #114326 from sunnylovestiramisu/fixReconstructionBug
Add pod to dsw if termination is not completed during reconstruction
2022-12-20 16:31:24 -08:00
huyinhou
692f8aab27 fix kubelet crash, concurrent map iteration and map write
When kubelet starts a Pod that requires device resources, if the device
plug-in updates the device at the same time, it may cause kubelet to crash.

Signed-off-by: huyinhou <huyinhou@bytedance.com>
2022-12-19 12:45:17 +08:00
Jordan Liggitt
78cb3862f1
Fix indentation/spacing in comments to render correctly in godoc 2022-12-17 23:27:38 -05:00
Sunny Song
5e8ca18308 Add pod to dsw if termination is not completed during reconstruction #issues/113979 2022-12-16 16:32:34 -08:00
Michael Weibel
8818c215c1 win: fix cpu count to calculate cpu_maximum
take all processor groups into account when calculating cpu maximum.

Signed-off-by: Michael Weibel <michael@helio.exchange>
2022-12-14 13:56:31 +01:00
Kubernetes Prow Robot
68f808e6db
Merge pull request #111371 from sivchari/improve-naming
feat: improve naming
2022-12-14 02:23:37 -08:00
Paco Xu
f28f40e521 remove a flag check that was introduced in #112542; address several comments
Signed-off-by: Paco Xu <paco.xu@daocloud.io>
2022-12-13 14:00:29 +08:00
Aditi Sharma
214a0ee7b8 Migrate container runtime endpoint flag to config
Signed-off-by: Aditi Sharma <adi.sky17@gmail.com>
Signed-off-by: Paco Xu <paco.xu@daocloud.io>
2022-12-13 14:00:29 +08:00
SataQiu
4c60ee00aa remove GA featuregates: CSIInlineVolume, CSIMigration, DaemonSetUpdateSurge, EphemeralContainers, IdentifyPodOS, LocalStorageCapacityIsolation, NetworkPolicyEndPort, StatefulSetMinReadySeconds 2022-12-11 19:27:41 +08:00
Kubernetes Prow Robot
50ed8284ab
Merge pull request #114334 from claudiubelu/fix-files-unittest
unittests: Fixes TestReplaceFile for Windows
2022-12-10 09:05:41 -08:00
Kubernetes Prow Robot
767de11f88
Merge pull request #114178 from Octopusjust/k8s-pr19
pkg/kubelet/network/dns: omit unnecessary `fmt.Sprintf`
2022-12-10 06:05:34 -08:00
Kubernetes Prow Robot
7754f007d6
Merge pull request #114169 from jpbetz/improve-kubelet-flag-errors
Improve error messages of flags that parse quantities and percentages
2022-12-10 06:05:11 -08:00
Kubernetes Prow Robot
a668924cb6
Merge pull request #113255 from claudiubelu/path-filepath-update-kubelet
Replaces path.Operation with filepath.Operation (kubelet)
2022-12-09 22:27:41 -08:00
Jordan Liggitt
933494ab8d
Check for initial kubelet certificates more frequently 2022-12-08 08:57:45 -05:00
Claudiu Belu
ba1195afeb unittests: Fixes TestReplaceFile for Windows
Currently, the test TestReplaceFile/neither_parent_nor_file_exists fails
because the error encountered doesn't match the expected error.

On Windows, if a file is missing, the encountered error is:

The system cannot find the file specified.

And if a folder / parent folder is missing, this error is encoutered instead:

The system cannot find the path specified.
2022-12-07 11:36:13 +00:00
lixiaobing1
fb327ddd15 improve performance 2022-11-29 16:02:47 +08:00
ZhangYu
6553ba246f pkg/kubelet/network/dns: omit unnecessary fmt.Sprintf 2022-11-29 14:44:14 +08:00
Joe Betz
ab3c353227 Improve error messages for parse errors of --kube-reserved, --system-reserved and --qos-reserved 2022-11-28 16:35:26 -05:00
arrowfeng
6a57404e28 kubelet: cleanup secretManager and configManager in podManager
Signed-off-by: arrowfeng <289716347@qq.com>
2022-11-14 23:05:32 +08:00
Ed Bartosh
abcb56defb kubelet: do not enter termination status if pod might need to unprepare resources 2022-11-11 21:58:03 +01:00
Ed Bartosh
ae0f38437c kubelet: add support for dynamic resource allocation
Dependencies need to be updated to use
github.com/container-orchestrated-devices/container-device-interface.

It's not decided yet whether we will implement Topology support
for DRA or not. Not having any toppology-related code
will help to avoid wrong impression that DRA is used as a hint
provider for the Topology Manager.
2022-11-11 21:58:03 +01:00
Kubernetes Prow Robot
2c1b7f5759
Merge pull request #112618 from jingyuanliang/fastStatusUpdateOnce
kubelet: Keep trying fast status update at startup until node is ready
2022-11-09 13:30:53 -08:00
PiotrProkop
540b5bd308 [topologymanager] rely on Cadvisor to calculate NUMA distance
Signed-off-by: PiotrProkop <pprokop@nvidia.com>
2022-11-09 17:52:14 +01:00
PiotrProkop
315f0dc6f1 Fix discovering numa distance when node ids are not starting from 0 or their ids are not sequential
Signed-off-by: PiotrProkop <pprokop@nvidia.com>
2022-11-09 17:52:08 +01:00
Kubernetes Prow Robot
7e0e0c8ec3
Merge pull request #113360 from mimowo/handling-pod-failures-beta-enable
Enable the "Retriable and non-retriable pod failures for jobs" feature into beta
2022-11-09 08:30:24 -08:00
Jingyuan Liang
9f5c5b82a9 kubelet: Keep trying fast status update at startup until node is ready 2022-11-09 15:55:20 +00:00
Jingyuan Liang
4a50fc4b8c kubelet: Refactor tryUpdateNodeStatus() into smaller functions 2022-11-09 15:52:04 +00:00
Kubernetes Prow Robot
70263d55b2
Merge pull request #113501 from pacoxu/fix-startReflector
kubelet: fix nil pointer in startReflector for standalone mode
2022-11-09 03:50:12 -08:00
Michal Wozniak
c803892bd8 Enable the feature into beta 2022-11-09 09:02:40 +01:00
Paco Xu
1b71dc77f2 linux: fix kubelet start unit test 2022-11-09 07:17:05 +08:00
Kubernetes Prow Robot
b4040b3b86
Merge pull request #113609 from haircommander/sandbox-metrics
kubelet: add support for broadcasting metrics from CRI
2022-11-08 15:08:26 -08:00
Kubernetes Prow Robot
da735b5415
Merge pull request #113596 from jsafrane/selinux-reconstruction
Reconstruct SELinux  mount label
2022-11-08 12:43:03 -08:00
Kubernetes Prow Robot
b3082c5e5b
Merge pull request #113582 from wzshiming/fix/grpc-probe-log
Fix grpc probe log
2022-11-08 12:42:56 -08:00
Peter Hunt
95489a26d6 kubelet: add cri metrics to server
Signed-off-by: Peter Hunt <pehunt@redhat.com>
2022-11-08 14:47:08 -05:00
Peter Hunt
1a7388c2ef kubelet/metrics: add cri_metrics
that pulls metrics from the CRI

Signed-off-by: Peter Hunt <pehunt@redhat.com>
2022-11-08 14:47:08 -05:00
Peter Hunt
6298ce68e2 kubelet: wire ListPodSandboxMetrics
Signed-off-by: Peter Hunt <pehunt@redhat.com>
2022-11-08 14:47:08 -05:00
Daniel Ye
dcc7c2f660 Add fake runtimes and CRI changes for KEP-2371
Added new gRPC call 'ListPodSanboxMetrics' which would return additional
container stats currently supported by cAdvisor, but outside the scope
of /stats/summary api. Added new types to support metric exporting of
prometheus, including Metric and other subfields. Added fake runtime
changes associated with the CRI changes.
2022-11-08 14:47:08 -05:00
Kubernetes Prow Robot
c40d961324
Merge pull request #113718 from mimowo/handling-pod-failures-kubelet-nits
Add comments to clarify the updated logic in kubelet's status_manager
2022-11-08 10:38:51 -08:00
Kubernetes Prow Robot
114594e1d2
Merge pull request #111384 from harche/evented_pleg_pr
Add Support for Evented PLEG
2022-11-08 10:38:19 -08: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
Harshal Patil
86284d42f8
Add support for Evented PLEG
Signed-off-by: Harshal Patil <harpatil@redhat.com>
Co-authored-by: Swarup Ghosh <swghosh@redhat.com>
2022-11-08 20:06:16 +05:30
Jan Safranek
cf912a2512 Update SELinux context log
SELinux context discovered from Pod is not final, it can be cleared when a
volume plugin does not support SELinux or the volume is not
ReadWriteOncePod. Update the existing log line + add a new one for easier
debugging.
2022-11-08 11:17:38 +01:00
Jan Safranek
e575e60ea4 Reconstruct SELinux mount option
When reconstructing volumes from disk after kubelet restart, reconstruct
also context=XYZ mount option and add it to the ActualStateOfWorld.
2022-11-08 11:17:38 +01:00
Michal Wozniak
026b97352f Add comments to clarify the updated logic in kubelet's status_manager 2022-11-08 10:21:25 +01:00
Kubernetes Prow Robot
64af9e03f1
Merge pull request #111597 from 249043822/evictionmessage
make eviction message more clear
2022-11-07 21:52:19 -08:00
Kubernetes Prow Robot
f328d3dc3d
Merge pull request #113291 from mengjiao-liu/fix-podAndContainerStatsFromCRI
Fix stats for podAndContainerStatsFromCRI
2022-11-07 19:48:17 -08:00
ZhangKe10140699
62177fd36d make eviction message more clear 2022-11-08 10:07:02 +08:00
Kubernetes Prow Robot
243ba086e7
Merge pull request #112914 from PiotrProkop/topology-manager-policies-flag
node: topologymanager:  Improved multi-numa alignment in Topology Manager
2022-11-07 16:00:51 -08:00
Kubernetes Prow Robot
47952e0917
Merge pull request #112360 from mimowo/handling-pod-failures-beta-kubelet
Add pod disruption conditions for kubelet-initiated failures
2022-11-07 16:00:40 -08:00
Kubernetes Prow Robot
43a2bb4df4
Merge pull request #111772 from pacoxu/image-pull-time
kubelet: make the image pull time more accurate in event
2022-11-07 14:52:16 -08:00