Commit Graph

841 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
f057f2de1c Merge pull request #124956 from TommyStarK/remove-deprecated-otel-noop-tracer
cmd/kubelet: remove deprecated otel NewNoopTracerProvider
2024-06-06 17:05:34 -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
Shingo Omura
552fd7e850 KEP-3619: Fine-grained SupplementalGroups control (#117842)
* Add `Linux{Sandbox,Container}SecurityContext.SupplementalGroupsPolicy` and `ContainerStatus.user` in cri-api

* Add `PodSecurityContext.SupplementalGroupsPolicy`, `ContainerStatus.User` and its featuregate

* Implement DropDisabledPodFields for PodSecurityContext.SupplementalGroupsPolicy and ContainerStatus.User fields

* Implement kubelet so to wire between SecurityContext.SupplementalGroupsPolicy/ContainerStatus.User and cri-api in kubelet

* Clarify `SupplementalGroupsPolicy` is an OS depdendent field.

* Make `ContainerStatus.User` is initially attached user identity to the first process in the ContainerStatus

It is because, the process identity can be dynamic if the initially attached identity
has enough privilege calling setuid/setgid/setgroups syscalls in Linux.

* Rewording suggestion applied

* Add TODO comment for updating SupplementalGroupsPolicy default value in v1.34

* Added validations for SupplementalGroupsPolicy and ContainerUser

* No need featuregate check in validation when adding new field with no default value

* fix typo: identitiy -> identity
2024-05-29 15:40:29 -07:00
Kubernetes Prow Robot
dad8fe71f2 Merge pull request #124220 from HirazawaUi/fix-pod-restarted
[kubelet]: fixed container restart due to pod spec field changes
2024-05-22 15:43:36 -07:00
TommyStarK
c0ed4972ac kubelet: remove deprecated otel NewNoopTracerProvider
Signed-off-by: TommyStarK <thomasmilox@gmail.com>
2024-05-22 17:38:20 +02:00
HirazawaUi
3ec13c5e37 remove HashWithoutResources field 2024-05-22 10:01:31 +08:00
HirazawaUi
f6b650430a fixed container restart due to field changes 2024-05-22 09:55:46 +08: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
Kubernetes Prow Robot
29a4812f03 Merge pull request #124080 from claudiubelu/skip-windows-tests
Skip failing Windows tests
2024-05-01 07:48:12 -07:00
Kubernetes Prow Robot
3d49956fde Merge pull request #123795 from saschagrunert/metrics-remote-runtime
Decouple `kubelet/cri/remote` package from `kubelet/metrics`
2024-04-26 18:31:48 -07:00
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
Kubernetes Prow Robot
7f68d014e5 Merge pull request #123749 from iholder101/swap_log/only_once_avoid_spam
[KEP2400] Avoid logging that swap cgroup controller is missing for every container
2024-04-19 17:00:46 -07:00
Kubernetes Prow Robot
528cff12f6 Merge pull request #120969 from skitt/uber-go-mock
Switch from golang/mock to uber-go/mock
2024-04-17 23:59:24 -07:00
Akihiro Suda
8963e73f12 kubelet: fix mixing up runtime classes with runtime handlers
Fix issue 123906

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-03-14 08:14:48 +09:00
Akihiro Suda
c7f52b34f3 kubelet: KEP-3857: Recursive Read-only (RRO) mounts
See <https://kep.k8s.io/3857>.

An example manifest:
```yaml
apiVersion: v1
kind: Pod
metadata:
  name: rro
spec:
  volumes:
    - name: mnt
      hostPath:
        # tmpfs is mounted on /mnt/tmpfs
        path: /mnt
  containers:
    - name: busybox
      image: busybox
      args: ["sleep", "infinity"]
      volumeMounts:
        # /mnt-rro/tmpfs is not writable
        - name: mnt
          mountPath: /mnt-rro
          readOnly: true
          mountPropagation: None
          recursiveReadOnly: IfPossible
        # /mnt-ro/tmpfs is writable
        - name: mnt
          mountPath: /mnt-ro
          readOnly: true
        # /mnt-rw/tmpfs is writable
        - name: mnt
          mountPath: /mnt-rw
```

Requirements:
- Feature gate "RecursiveReadOnlyMounts" to be enabled
- Linux kernel >= 5.12
- runc >= 1.1

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-03-10 03:00:59 +09:00
Akihiro Suda
76081a10c2 kubelet: RuntimeHandler: add SupportsRecursiveReadOnlyMounts
For KEP-3857: Recursive Read-only (RRO) mounts

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-03-09 09:48:09 +09:00
Akihiro Suda
27f24a62e3 kubelet: change map[string]RuntimeHandler to []RuntimeHandler
The map is changed to an array so as to retain the order of the original array
propagated from the CRI runtime.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-03-09 09:48:07 +09:00
Tim Allclair
04ac13b6b7 Keep providing the deprecated AppArmor CRI API for runtimes that haven't migrated 2024-03-07 15:00:07 -08:00
Sascha Grunert
51199deaa0 Decouple kubelet/cri/remote package from kubelet/metrics
Importing the `k8s.io/kubernetes/pkg/kubelet/metrics` package in the
remote runtime implementation makes it harder to separate the
functionalities at some later point in time. We now decouple both
packages by extending the CRI API services to allow a callback on
`GetContainerEvents`. This callback can be used to do additional work if
the connection got established, because `GetContainerEvents` will go
into blocking mode after that.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2024-03-07 11:46:06 +01: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
bd25605619 Merge pull request #123435 from tallclair/apparmor-ga
AppArmor fields API
2024-03-06 15:35:14 -08:00
Itamar Holder
f6e537d7a1 Avoid logging that swap cgroup controller is missing for every container
Signed-off-by: Itamar Holder <iholder@redhat.com>
2024-03-06 13:53:55 +02:00
Kevin Hannon
6a4e19a4ec add no swap as the default option for swap 2024-03-05 16:10:42 -05:00
Tim Allclair
bf3c8464ba Implement Kubelet AppArmor field handling 2024-03-05 12:22:50 -08: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
Sascha Grunert
e38531e9a2 Add image_id to CRI ContainerStatus message
There is a conversion function `ConvertPodStatusToRunningPod`, which
can override the `Container.ImageID` into a digested reference from the
`ContainerStatus` CRI RPC, which gets mapped from the `image_ref`:

411c29c39f/pkg/kubelet/container/helpers.go (L259-L292)

To avoid that failure case, we now introduce the same `image_id` into
the container status and let runtimes separate the fields.

We also add a note that the mapping from the digested reference of the
CRI to the Kubernetes Pod API `ImageID` field is intentional and should
not change.

Follow-up on: https://github.com/kubernetes/kubernetes/pull/123508

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2024-02-29 12:41:55 +01:00
Kubernetes Prow Robot
68a47053d1 Merge pull request #123508 from saschagrunert/image-id-container
Add `image_id` to CRI `Container` message
2024-02-28 11:01:35 -08:00
Sascha Grunert
e663285ccf Add image_id to CRI Container message
This new field allows fixing the kubelet image garbage collection in
container runtimes. The `image_ref` has been historically used by
container runtimes to reference images by digest.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2024-02-28 10:05:07 +01:00
Giuseppe Scrivano
b2a92406ef KEP-127: check for runtime handler userns support
block the creation of a pod that requires a user namespace, unless the
runtime handler has support for it.

If the pod requested for a user namespace, and the handler does not
support it then return an error regardless of the feature gate.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-02-27 12:01:00 +01:00
Giuseppe Scrivano
024146f705 KEP-127: the kubelet stores runtime helpers
as they are received from the ResponseStatus request to the runtime.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2024-02-27 11:07:35 +01: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
19d9405a1c Update comments and error messages
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
2024-02-16 09:56:01 -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
Kubernetes Prow Robot
5b2c919583 Merge pull request #114301 from harshanarayana/kubelet/log-rotate-improvements
kubelet: enable configurable rotation duration and parallel rotate
2024-02-14 15:56:38 -08:00
Kubernetes Prow Robot
14f8f5519d Merge pull request #121719 from ruiwen-zhao/metric-size
Add image pull duration metric with bucketed image size
2024-02-13 16:23:50 -08:00
Harsha Narayana
ab8c784ee9 kubelet: enable configurable rotation duration and parallel rotate 2024-02-09 16:49:11 +05:30
ruiwen-zhao
0f5cf6c1cd Add image pull duration metric with bucketed image size
Signed-off-by: ruiwen-zhao <ruiwen@google.com>
2024-02-08 00:30:31 +00:00
Kubernetes Prow Robot
ce28021839 Merge pull request #121923 from saschagrunert/resources-windows
Enable pod container resources tests on Windows
2024-02-05 08:45:08 -08:00
Kubernetes Prow Robot
6427e2c9c8 Merge pull request #122578 from carlory/lock-default-ConsistentHTTPGetHandlers
lock GA feature-gate ConsistentHTTPGetHandlers to default
2024-01-04 18:00:52 +01:00
Kubernetes Prow Robot
014149d66e Merge pull request #121565 from srivastav-abhishek/logs_test_datarace
[FLAKE] Fixed UT pkg/kubelet/kuberuntime/logs/TestReadRotatedLog caused due to data race
2024-01-04 16:49:23 +01:00
carlory
55c5db172e lock GA feature-gate ConsistentHTTPGetHandlers to default 2024-01-04 15:12:08 +08:00
Sascha Grunert
2076429e43 Enable pod container resources tests on Windows
PR https://github.com/kubernetes/kubernetes/pull/112599 merged so it
seems that we can now enable the tests on Windows.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2023-11-16 14:13:06 +01:00
Kevin Hannon
26923b91e8 implementation of split disk kep 2023-11-01 14:46:33 -04:00
kiashok
252e1d2dfe Imagepull per runtime class alpha release changes
This commit does the following:
1. Add RuntimeClassInImageCriApi feature gate
2. Extend pkg/kubelet/container Image struct
3. Adds runtimeHandler string in the following CRI calls
   i.   ImageStatus
   ii.  PullImageRequest
   iii.  RemoveImage

Signed-off-by: kiashok <kiashok@microsoft.com>
2023-10-31 15:52:46 -07:00
Kubernetes Prow Robot
ac6f707155 Merge pull request #120620 from tzneal/sidecar-termination-ordering
sidecars: terminate sidecars after main containers
2023-10-31 19:16:11 +01:00
Kubernetes Prow Robot
2c300ef6b0 Merge pull request #120269 from gjkim42/fix-restart-containers-in-right-order-after-podsandbox-changed
Restart containers in right order with SidecarContainers enabled
2023-10-31 19:15:35 +01:00
Kubernetes Prow Robot
dea3f1a119 Merge pull request #112599 from fabi200123/Adding-Windows-Support-for-InPlaceVerticalScaling
Adding Windows support for InPlace Pod Vertical Scaling
2023-10-31 19:15:12 +01:00
Abhishek Kr Srivastav
81bf3a59d1 Added mutex locks when accessing file object : addressed review comments 2023-10-28 17:32:13 +05:30
Abhishek Kr Srivastav
0e76e2c2bb Added mutex locks when accessing file object : lint check fix 2023-10-27 19:12:01 +05:30