Commit Graph

12647 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
b9bbdfa32f Merge pull request #132658 from tkashem/dra-plugin-timeout
kubelet: add a unit test that verifies that the dra plugin enforces timeout
2025-11-03 04:44:05 -08:00
Kubernetes Prow Robot
0d40757969 Merge pull request #133051 from rata/userns-record-pod-error
kubelet/userns: Print podUID on errors
2025-10-31 11:34:06 -07:00
Kubernetes Prow Robot
5caeb4171d Merge pull request #134855 from sprait/fix-nil-deref-container-status
kubelet: add nil check for ContainerStatus in GetContainerStatus
2025-10-31 10:10:14 -07:00
Abu Kashem
11e3147fdd kubelet: add a test to verify that dra plugin enforces timeout 2025-10-31 11:16:54 -04:00
Abu Kashem
344df7835c refactor dra fake grpc server 2025-10-31 10:11:49 -04:00
Lukasz Szaszkiewicz
1951e8dd88 kubelet/config/apiserver_test: expose IsWatchListSemanticsUnSupported on fakePodLW 2025-10-31 12:37:34 +01:00
Rodrigo Campos
05f5051be3 kubelet/userns: Print podUID on errors
We recently received this bug report: #132966. The issue seems to be
that the new range configured doesn't work for existing pods on the
node, and therefore the kubelet fails to start.

While I'll also improve the documentation to mention you need to drain
the node, let's also improve the error message saying which pod this
error comes from.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2025-10-31 12:06:30 +01:00
Nikolay Gorbatov
040516a6e7 fix linter changes 2025-10-31 11:44:17 +04:00
Kubernetes Prow Robot
a13ad97048 Merge pull request #134949 from natasha41575/ippr-ga
Promote InPlacePodVerticalScaling to GA
2025-10-30 20:06:01 -07:00
Richa Banker
c1a95eb7e2 Structured statusz 2025-10-30 10:39:52 -07:00
Natasha Sarkar
1d9c646892 fix unit tests for ippr ga 2025-10-30 17:28:42 +00:00
Kubernetes Prow Robot
906284afc7 Merge pull request #134933 from swatisehgal/node-mm-mgr-ctx-logging-updates
node: mm-mgr: Refactor to use logger parameter instead of context
2025-10-30 01:26:04 -07:00
Kubernetes Prow Robot
1f1ff7d8b2 Merge pull request #133066 from hankfreund/retry_backoff
Propagate backoff duration for crashloop backoff.
2025-10-29 10:14:03 -07:00
Swati Sehgal
e06abce75f node: mm-mgr: Refactor to use logger parameter instead of context
This change completes the contextual logging migration for the memory
manager by updating the Manager interface and all implementations to
accept logr.Logger parameters instead of context.Context.

Key changes:
- Update Manager interface methods to accept logr.Logger:
  * AddContainer, RemoveContainer, GetMemoryNUMANodes
  * GetAllocatableMemory, GetMemory (removed context entirely)
- Update Policy interface methods to accept logr.Logger instead of context.Context
- Pass logger to NewManager() and policy constructors (NewPolicyStatic, NewPolicyNone, NewPolicyBestEffort)
- Update internal_container_lifecycle to use klog.TODO() when calling memory manager methods
- Update fake manager to accept and use logger parameter
- Update all test code to pass logger instead of context

This aligns with the contextual logging migration pattern where:
- Functions that need a logger accept logr.Logger parameter directly
- Logger is passed from the boundary (e.g., Start()) down to implementation
- klog.TODO() is used temporarily in call sites where logger is not yet available
- Context is only used where truly needed (e.g., Start() method)

This follows the same pattern as recent migrations in:
- pkg/kubelet/cm/topologymanager (#134174)
- pkg/kubelet/cm/devicemanager (#134293)
- pkg/kubelet/cm/cpumanager (#125912)

Related to the initial memory manager contextual logging work in #130727.

Signed-off-by: Swati Sehgal <swsehgal@redhat.com>
2025-10-29 16:09:42 +00:00
Kubernetes Prow Robot
f0ed028e75 Merge pull request #133784 from bart0sh/PR197-DRA-process-devices-when-allocatable-is-0
Treat extended resources as inactive when allocatable is 0
2025-10-28 03:29:36 -07:00
Kubernetes Prow Robot
9dae3e2709 Merge pull request #131504 from zhifei92/migrate-kubelet-eviction-to-contextual-logging
chore(kubelet): migrate eviction to contextual logging
2025-10-27 13:21:35 -07:00
Ed Bartosh
7b2acb74c0 DRA: fix admit logic for extended resources
Updated allocateContainerResources to skip resources referring
extended resource claims as they are managed by DRA drivers.
These resources shouldn't be processed by device plugins.
2025-10-27 16:24:35 +02:00
Kubernetes Prow Robot
1474788587 Merge pull request #134727 from p0lyn0mial/upstream-watchlist-unsupported-wl-semantics-kubelet
pkg/kubelet/watch_base_manager: wraps the LW with WatchList semantics
2025-10-27 06:37:36 -07:00
Kubernetes Prow Robot
59616d50fd Merge pull request #134691 from SergeyKanzhelev/watchdogIsGA
Lock SystemdWatchdog feature gate
2025-10-27 03:43:37 -07:00
Francesco Romani
fd5b2efa76 node: cpumanager: migrate to contextual logging
migrate the cpumanager code to contextual logging

design musings:
- golang contexts "[...] carries deadlines, cancellation signals, and
  other request-scoped values across API boundaries and between
  processes." (see: https://pkg.go.dev/context#pkg-overview).
  Thus, it generally makes sense to add contexts to most of the APIs
  and functions  as the resource management is done in the admission flow, when
  ultimately we process a request and we have time bounds;
- however, receiving a context from the outside and depending on it
  kind also conflicts with the goal of having uniform logging and "
  - attach key/value pairs that get included in all log messages
  - add names that describe which component or operation triggered a log messages"
  (see:
https://github.com/kubernetes/enhancements/tree/master/keps/sig-instrumentation/3077-contextual-logging#summary)
  Some of this conflict is due to the transitional nature of the PRs
  which we do when updating the codelet codebase. We can envision a
  final state on which the top level caller adds identifying information
  like pod UID and pod namespace/name pair; but up until all the calling
  chain is updated and wired, the results are gonna be inconsistent.
- continuing from the point above, the most realistic transition plan
  for the kubelet is outlined in
  https://github.com/kubernetes/kubernetes/issues/130069 .
  Since we do want to move in parallel and migrate on a
  subsystem-by-subsystem basis, each subsystem will be in charge to add
  the data they want to their contexts. I think this is the only
  reasonnable way forward, and the cost will be overhead and redundancy.
  We should do sweeping changes to uniform the flows once we completed
  the full transition to ensure uniformity.
- there are some well known packages which want to operate by design
  only in in-memory data structure, which arguably can't block.
  Shoehorning a context feels not great. Instead, we intentionally pass
  only the logger, which still is the core idea of contextual logging
  (see:
https://github.com/kubernetes/kubernetes/pull/125912#discussion_r1935919144)
  examples are the topology subpackage and the cpu_assignment logic
  (takeByTopology and friends)

Signed-off-by: Francesco Romani <fromani@redhat.com>
2025-10-27 08:38:58 +01:00
Kubernetes Prow Robot
4539b9c8f3 Merge pull request #133660 from scaventz/109717-PreStartContainer
Test: Add unit test for PreStartContainer
2025-10-24 13:07:33 -07:00
Kubernetes Prow Robot
60e1f61a63 Merge pull request #133511 from BenTheElder/no-md5
eliminate md5 usage, block new usage
2025-10-24 10:59:35 -07:00
Nikolay Gorbatov
fcef697a45 kubelet: add nil check for ContainerStatus in GetContainerStatus 2025-10-24 17:25:11 +04:00
Xin Wang
5d4d6cc980 Test: Add unit test for PreStartContainer
#109717
2025-10-24 12:58:01 +08:00
Kubernetes Prow Robot
733f552f73 Merge pull request #134741 from zk-123/fix/kubelet_node_status_cleanup_register_schedulable
fix(kubelet_node_status): remove the node.Spec.Unschedulable check
2025-10-23 19:29:33 -07:00
Stephen Kitt
1e2817d589 Avoid no-change lambdas
This replaces functions that wrap another function with no change with
a direct reference to the wrapped function.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2025-10-23 09:46:15 +02:00
Kubernetes Prow Robot
ab7003f2e5 Merge pull request #130182 from marosset/windows-unit-tests-pkg-kubelet-kuberuntime-fixes
Fixing k8s.io/kubernetes/pkg/kubelet/kuberuntime unit tests on Windows
2025-10-22 14:14:39 -07:00
Kubernetes Prow Robot
501b768370 Merge pull request #134545 from novahe/fix-missing-apiversion
Fix missing involvedObject.apiVersion in event
2025-10-22 09:00:40 -07:00
novahe
9d48e7d2d4 fix missing involvedObject.apiVersion in event 2025-10-22 20:13:36 +08:00
Tim Allclair
8fc9921294 Delete dead code 2025-10-21 20:49:42 -07:00
Yuan Wang
f2a4ffd5b8 Promote ContainerRestartRules to beta
Fix prober not running properly with containerRestartRules and add unit test coverage
2025-10-21 23:58:39 +00:00
Mark Rossetti
0a301490f6 Fixing k8s.io/kubernetes/pkg/kubelet/kuberuntime unit tests on Windows
Signed-off-by: Mark Rossetti <marosset@microsoft.com>
2025-10-21 16:42:31 -07:00
Benjamin Elder
dba6c30e96 switch kubelet static pod internal UID to fnv
fnv-1a in 128bit should be a drop-in replacement for md5 in non-cryptographic use that is faster and not obsolete
2025-10-21 15:25:11 -07:00
Benjamin Elder
b3373320da switch volumemanager reconciler tests to fnv-1a
128 bit fnv-1a is a pretty good non-cryptographic drop-in for md5, it should be faster, and this test code is not sensitive anyhow
2025-10-21 15:25:11 -07:00
Benjamin Elder
797d316519 mark remaining md5 usage TODO and exclude from lint 2025-10-21 15:25:11 -07:00
zhengkai
ad2832977c fix(kubelet_node_status): remove the node.Spec.Unschedulable check, after remove the register schedulable 2025-10-21 16:04:14 +08:00
Kubernetes Prow Robot
cba95d3e42 Merge pull request #132601 from toVersus/test/more-pod-level-resources
[PodLevelResources] Add more comprehensive test cases to kubelet
2025-10-20 14:26:36 -07:00
Kubernetes Prow Robot
69b762aacd Merge pull request #134587 from bart0sh/PR204-fix-TestConnectionHandling-flake
DRA: fix TestConnectionHandling flake
2025-10-20 13:36:36 -07:00
Kubernetes Prow Robot
031f4d541a Merge pull request #133072 from AadiDev005/fix-sidecar-startup-probe
Fix startup probe worker termination for sidecar containers
2025-10-20 12:26:37 -07:00
Lukasz Szaszkiewicz
da77cf84ba pkg/kubelet/watch_base_manager: wraps the LW with WatchList semantics 2025-10-20 20:05:22 +02:00
Kubernetes Prow Robot
9dcfb3d04b Merge pull request #133373 from AkihiroSuda/carry-133278
[Carry 133278] kubelet: Don't ignore idsPerPod config #133278
2025-10-17 15:40:43 -07:00
Sergey Kanzhelev
9864c29861 Lock SystemdWatchdog feature gate 2025-10-17 17:50:41 +00:00
Kubernetes Prow Robot
e066b3850f Merge pull request #133912 from tallclair/kube-feature-deps
Mark all Kube feature dependencies, and require dependencies to be declared for all features
2025-10-16 11:14:43 -07:00
Kubernetes Prow Robot
02e576064f Merge pull request #134614 from ffromani/topomgr-max-allowable-nodes-ga
KEP-4622: promote topology manager `max-allowable-numa-nodes` to GA
2025-10-15 18:43:41 -07:00
Tim Allclair
debe026b21 Fix unit tests to work with explicit depndencies 2025-10-15 15:04:26 -07:00
Kubernetes Prow Robot
95fcceb90c Merge pull request #134388 from nokia/kep-4540-ga
KEP-4540: StrictCPUReservationOption moved to GA
2025-10-15 05:59:35 -07:00
Rodrigo Campos
b38d702807 userns: Return nil manager if feature disabled
Golang allows to call methods on a nil object, as long as the methods
don't dereference the nil object. This is what we do here.

This makes all the userns configurations (idsPerPod or mapping configs
in /etc/subuid or /etc/subgid) to be ignored if the feature is off.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2025-10-15 19:49:38 +09:00
Rodrigo Campos
0b5aa1d491 userns: Use better defaults if idsPerPod are used
The first UID used for userns mappings needs to be at least the
idsPerPod. When idsPerPod is extended to be 65536*2, for example, then
the default UID of 65536 doesn't work.

While this can be configured by the user, let's just improve the default
first UID to be the same as idsPerPod. This makes the default first UID
work out of the box if the user just wants to tune that.

This also simplifies testing, as we don't need to create a system user
and /etc/subuid and /etc/subgid files to test the idsPerPod setting.

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2025-10-15 19:49:38 +09:00
Rodrigo Campos
db6a2b2318 kubelet: Don't ignore idsPerPod config
The idsPerPod where completely ignored since they were introduced in PR:
	https://github.com/kubernetes/kubernetes/pull/130028

The problem was the following:
	1. The userns manager (as well as all managers) is created
	   before the config is copied to the kubelet object[1]
	2. The userns manager on creation is calling the kubelet_getter
	   GetUserNamespacesIDsPerPod to get the idsPerPod
	3. The getter checks the configuration stored in the kubelet
	   object, which hasn't been set at that point.
	4. As the config is nil (unset), it returns the default value.

Therefore, the value was ignored.

To solve this, let's just pass the idsPerPod as a parameter to
MakeUserNsManager(). This is the common pattern already used in the
kubelet initialization.

[1]: 461ba83084/pkg/kubelet/kubelet.go (L1078-L1087)
[2]: 461ba83084/pkg/kubelet/kubelet_getters.go (L145)

Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
2025-10-15 19:49:34 +09:00
Francesco Romani
97861325ae KEP-4622: node: topomgr: max-allowable-numa-nodes to GA
promote the policy option to GA.

Signed-off-by: Francesco Romani <fromani@redhat.com>
2025-10-15 12:21:04 +02:00