Commit Graph

220 Commits

Author SHA1 Message Date
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
Davanum Srinivas
a9593d634c
Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00
Jack Francis
ab14cba2cf kubelet: more resilient node allocatable ephemeral-storage data getter 2022-03-29 18:13:57 -07:00
Kir Kolyshkin
37761a329e
pkg/kubelet: changes to update runc to 1.1.0
The changes (mostly in pkg/kubelet/cm) are there to adopt changed
runc 1.1 API, and simplify things a bit. In particular:

1. simplify cgroup manager instantiation, using a new, easier way of
   libcontainers/cgroups/manager.New;

2. replace libcontainerAdapter with a boolean variable (all it did
   was passing on whether systemd manager should be used);

3. trivial change due to removed cgroupfs.HugePageSizes and added
    cgroups.HugePageSizes();

4. do not calculate cgroup paths in update / destroy, since libcontainer
   cgroup managers now calculate the paths upon creation (previously,
   they were doing that only in Apply, so using e.g. Set or Destroy right
   after creation was impossible without specifying paths).

We currently still calculate cgroup paths in Exists -- this is to be
addressed separately.

Co-Authored-By: Elana Hashman <ehashman@redhat.com>
2022-03-28 16:23:20 -07:00
Steve Kuznetsov
8f2bc39f72
kubelet: cgroups: be verbose about validation
Previously, callers of `Exists()` would not know why the cGroup was or
was not existing. In one call-site in particular, the `kubelet` would
entirely fail to start if the cGroup validation did not succeed. In
these cases we MUST explain what went wrong and pass that information
clearly to the caller. Previously, some but not all of the reasons for
invalidation were logged at a low log-level instead. This led to poor
UX.

The original method was retained on the interface so as to make this
diff small.

Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
2022-03-10 07:25:33 -08:00
chenyw1990
e26df3594c do not return err when PodSandbox not exist
Co-authored-by: pacoxu <paco.xu@daocloud.io>
2022-02-24 14:58:39 +08:00
Matthias Bertschy
9500ee9d9c container_manager: use oomScoreAdj instead of default when set 2022-02-12 15:23:13 +01:00
Danielle Lancashire
c198062da4 cm: Remove legacy docker references
Dockershim and built-in Docker support are gone. Cleans up dead code
references to them.
2022-02-08 16:25:04 +01:00
yxxhero
a90b149be0 add more message for no PodSandbox container
Signed-off-by: yxxhero <aiopsclub@163.com>
2021-12-18 09:52:03 +08:00
Neha Lohia
fa1b6765d5
move pkg/util/node to component-helpers/node/util (#105347)
Signed-off-by: Neha Lohia <nehapithadiya444@gmail.com>
2021-11-12 07:52:27 -08:00
Alexey Perevalov
5d9032007a Return only isolated cpus in podresources interface
Co-Authored-by: Swati Sehgal <swsehgal@redhat.com>
Signed-off-by: Alexey Perevalov <alexey.perevalov@huawei.com>
2021-10-07 15:34:08 +01:00
Ricardo Pchevuzinske Katz
37d11bcdaf Move node and networking related helpers from pkg/util to component helpers
Signed-off-by: Ricardo Katz <rkatz@vmware.com>
2021-09-16 17:00:19 -03:00
Stephen Augustus
481cf6fbe7
generated: Run hack/update-gofmt.sh
Signed-off-by: Stephen Augustus <foo@auggie.dev>
2021-08-24 15:47:49 -04:00
Kir Kolyshkin
e5b434e990 kubelet/cm: don't set Devices
Since runc 1.0.0 it is now sufficient to have SkipDevices: true.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-07-16 12:45:35 -07:00
Francesco Romani
6dcec345df smtalign: cm: factor out admission response
Introduce a new `admission` subpackage to factor out the responsability
to create `PodAdmitResult` objects. This enables resource manager
to report specific errors in Allocate() and to bubble up them
in the relevant fields of the `PodAdmitResult`.

To demonstrate the approach we refactor TopologyAffinityError as a
proper error.

Co-authored-by: Kevin Klues <kklues@nvidia.com>
Co-authored-by: Swati Sehgal <swsehgal@redhat.com>
Signed-off-by: Francesco Romani <fromani@redhat.com>
2021-07-08 23:15:37 +02:00
Francesco Romani
c5cb263dcf smtalign: propagate policy options to cpumanager
The CPUManagerPolicyOptions received from the kubelet config/command line args
is propogated to the Container Manager.

We defer the consumption of the options to a later patch(set).

Co-authored-by: Swati Sehgal <swsehgal@redhat.com>
Signed-off-by: Francesco Romani <fromani@redhat.com>
2021-07-08 23:15:35 +02:00
Li Bo
c3d9b10ca8 feature: support Memory QoS for cgroups v2 2021-07-08 09:26:46 +08:00
Akihiro Suda
dbe0155139
kubelet/cm: ignore sysctl error when running in userns
Errors during setting the following sysctl values are ignored:
- vm.overcommit_memory
- vm.panic_on_oom
- kernel.panic
- kernel.panic_on_oops
- kernel.keys.root_maxkeys
- kernel.keys.root_maxbytes

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2021-07-07 14:23:29 +09:00
Odin Ugedal
61d88af9e4
Revert "Update runc to 1.0.0" 2021-07-05 14:03:04 +02:00
Kir Kolyshkin
ab5b77944e kubelet/cm: don't set Devices
Since runc 1.0.0 it is now sufficient to have SkipDevices: true.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2021-06-30 16:17:35 -07:00
Artyom Lukianov
03830db82d Implement all necessary methods to provide memory manager data under pod resources metrics
Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-06-22 13:06:32 +03:00
Francesco Romani
369416b763 cm: handle nil cpumanager avoiding segfault
If the cpumanager feature gate is disabled, the corresponsing field
of the containerManager will be nil.
A couple functions don't check for this occurrence and happily
deference the pointer unconditionally, leading to possible segfaults.

The relevant functions were introduced to support the podresources API,
so to trigger this segfault all the following are needed:
- cpumanager feature gate has to be disabled explicitely
- any podresources API must be called

Worth pointing out that when the new functions were introduced (around
kubernetes 1.20) the default feature gate for cpumanager was already set
to true, hence this bug is expected to be triggered rarely.

Signed-off-by: Francesco Romani <fromani@redhat.com>
2021-06-10 16:22:43 +02:00
Giuseppe Scrivano
12abc3b7c9 kubelet: reuse manager
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-05-19 23:51:49 -07:00
Jordan Liggitt
4b45d0d921 Revert "Merge pull request 101888 from kolyshkin/update-runc-rc94"
This reverts commit b1b06fe0a4, reversing
changes made to 382a33986b.
2021-05-18 09:13:47 -04:00
Giuseppe Scrivano
fd7ecd3915 kubelet: reuse manager
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2021-05-10 17:34:53 -07:00
Ryan Phillips
4488162bd9 kubelet: change cgroup move message to log level 3 2021-04-28 14:54:54 -05:00
chen zechun
d16d57b7d1 fix delete duplicate logs 2021-04-02 16:18:47 +08:00
Kubernetes Prow Robot
38fbecf0c8
Merge pull request #100001 from shiyajuan123/logs
migrate kubelet/cm/container logs to structured logging
2021-03-16 14:50:06 -07:00
shiyajuan123
d344fc612e fix and update 2021-03-10 14:58:17 +08:00
shiyajuan123
9cee635494 fix and update 2021-03-10 14:29:03 +08:00
Kubernetes Prow Robot
770a9504ea
Merge pull request #95734 from fromanirh/podresources-concrete-resources-apis
podresources APIs: concrete resources apis: implement GetAllocatableResources
2021-03-09 14:29:04 -08:00
Francesco Romani
8afdf4f146 node: podresources: translate types in cm
during the review, we convened that the manager types
(CPUSet, ResourceDeviceInstances) should not cross the
containermanager API boundary; thus, the ContainerManager layer
is the correct place to do the type conversion

We push back the type conversions from the podresources server
layer, fixing tests accordingly.

Signed-off-by: Francesco Romani <fromani@redhat.com>
2021-03-09 13:13:36 +01:00
Francesco Romani
ad68f9588c node: podresources: make GetDevices() consistent
We want to make the return type of the GetDevices() method of the
podresources DevicesProvider interface consistent with
the newly added GetAllocatableDevices type.
This makes the code easier to read and reduces the coupling between
the podresourcesapi server and the devicemanager code.

No intended changes in behaviour, but the different return types
now requires some data massaging. Tests are updated accordingly.

Signed-off-by: Francesco Romani <fromani@redhat.com>
2021-03-09 13:13:36 +01:00
Francesco Romani
6d33354e4c node: podresources: implement GetAllocatableResources API
Extend the podresources API implementing the GetAllocatableResources endpoint,
as specified in the KEPs:

https://github.com/kubernetes/enhancements/tree/master/keps/sig-node/2043-pod-resource-concrete-assigments
https://github.com/kubernetes/enhancements/pull/2404

Signed-off-by: Francesco Romani <fromani@redhat.com>
2021-03-09 13:13:36 +01:00
Francesco Romani
1375c5bdc7 node: podresources: make GetCPUs return cpuset
a upcoming patch wants to add GetAllocatableCPUs() returning a cpuset.
To make the code consistent and a bit more flexible, we change the
existing interface to also return a cpuset.

Signed-off-by: Francesco Romani <fromani@redhat.com>
2021-03-09 13:13:36 +01:00
shiyajuan123
6b53f8c65d migrate kubelet/cm/container logs to structured logging 2021-03-09 18:27:54 +08:00
David Porter
904cb67267 Fixes after runc libcontainer and docker update
- libcontainer renamed
  `github.com/opencontainers/runc/libcontainer/configs` to
  `github.com/opencontainers/runc/libcontainer/devices` so use the new
  references

- Update `dockershim` `ContainerCreate` call after docker update to
  v20.10.2
2021-03-08 22:10:29 -08:00
Kubernetes Prow Robot
d819199065
Merge pull request #97888 from pacoxu/fix/97565
check containerd as well as docker-containerd
2021-02-09 23:46:59 -08:00
Artyom Lukianov
9ae499ae46 memory manager: pass memory manager flags to the container manager
Pass memory manager flags to the container manager and call all relevant memory manager
methods under the container manager.

Signed-off-by: Byonggon Chun <bg.chun@samsung.com>
2021-02-09 00:54:58 +02:00
pacoxu
89c42bd3d5 check containerd as process name instead of docker-containerd
Signed-off-by: pacoxu <paco.xu@daocloud.io>
2021-01-23 10:55:18 +08:00
Artyom Lukianov
60678a24ca Update CPU manager GetCPUs method to return pointer to CPUSet 2021-01-20 13:21:57 +02:00
Seth Jennings
ee60ee26e0 kubelet: remove periodic messages from log-level 2 2020-11-30 11:34:00 -06:00
Krzysztof Wiatrzyk
b2be584e5b Implement topology manager scopes
* Add topologyScopeName parameter to NewManager().
* Add scope interface and structure that implement common logic
* Add pod scope & container scopes
* Add pod lifecycle functions

Co-authored-by: sw.han <sw.han@samsung.com>

Signed-off-by: Krzysztof Wiatrzyk <k.wiatrzyk@samsung.com>
2020-11-12 12:25:54 +01:00
Alexey Perevalov
a8b8995ef2 Implement TopologyInfo and cpu_ids in podresources
It covers deviceplugin & cpumanager.

It has drawback, since cpuset and all other structs including cadvisor's keep
cpu as int, but for protobuf based interface is better to have fixed
int.
This patch also introduces additional interface CPUsProvider, while
DeviceProvider might have been extended too.

Checkpoint not covered by unit test.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
Signed-off-by: Alexey Perevalov <alexey.perevalov@huawei.com>
2020-11-11 13:50:49 +03:00
Alexey Perevalov
9f54dccc92 Change GetDevices interface
This change is necessary for supporting Topology in the ContainerDevices.

Signed-off-by: Alexey Perevalov <alexey.perevalov@huawei.com>
2020-11-11 12:41:31 +03:00
Ali
bfdeda58b7 Delete framework/v1alpha1 folder and change remaining import paths 2020-10-23 13:16:13 +11:00
Srini Brahmaroutu
fbe5daed73 Change code to use staging/k8s.io/mount-utils 2020-09-16 21:51:24 -07:00
Renaud Gaubert
4eadf40448 Run gofmt
Signed-off-by: Renaud Gaubert <rgaubert@nvidia.com>
2020-09-15 06:22:44 -07:00
Renaud Gaubert
60304452ff Move podresources api to k8s.io/kubelet/pkg/apis
Signed-off-by: Renaud Gaubert <rgaubert@nvidia.com>
2020-09-15 05:13:33 -07:00
Kubernetes Prow Robot
119c94214c
Merge pull request #93931 from SataQiu/fix-kubelet-swap-20200812
kubelet: assume that swap is disabled when /proc/swaps does not exist
2020-09-11 04:20:14 -07:00