Commit Graph

133563 Commits

Author SHA1 Message Date
Patrick Ohly
c69259cb71 DRA device taints: switch to workqueue in controller
The approach copied from node taint eviction was to fire off one goroutine per
pod the intended time. This leads to the "thundering herd" problem: when a
single taint causes eviction of several pods and those all have no or the same
toleration grace period, then they all get deleted concurrently at the same
time.

For node taint eviction that is limited by the number of pods per node, which
is typically ~100. In an integration test, that already led to problems with
watchers:

   cacher.go:855] cacher (pods): 100 objects queued in incoming channel.
   cache_watcher.go:203] Forcing pods watcher close due to unresponsiveness: key: "/pods/", labels: "", fields: "". len(c.input) = 10, len(c.result) = 10, graceful = false

It also causes spikes in memory consumption (mostly the 2KB stack per goroutine
plus closure) with no upper limit.

Using a workqueue makes concurrency more deterministic because there is an
upper limit. In the integration test, 10 workers kept the watch active.

Another advantage is that failures to evict the pod get retried with
exponential backoff per affected pod forever. Previously, evicting was tried a
few times with a fixed rate and then the controller gave up. If the apiserver
was down long enough, pods didn't get evicted.
2025-10-31 18:11:19 +01:00
Patrick Ohly
e5fcd20a26 DRA device taints: tighten controller test
We know how often the controller should get a pod, let's check it.
Must run before we do our own GET call.
2025-10-31 18:11:18 +01:00
Patrick Ohly
6ebd853f17 DRA: implementation of none taint effect
While at it, ensure that future unknown effects are treating like
the None effect.
2025-10-31 18:11:18 +01:00
Patrick Ohly
75c9186792 generated files 2025-10-31 18:11:18 +01:00
Patrick Ohly
e4dda7b282 DRA device taints: fix DeviceTaintRule + missing slice case
When the ResourceSlice no longer exists, the ResourceSlice tracker didn't and
couldn't report the tainted devices even if they are allocated and in use. The
controller must keep track of DeviceTaintRules itself and handle this scenario.

In this scenario it is impossible to evaluation CEL expressions because the
necessary device attributes aren't available. We could:
- Copy them in the allocation result: too large, big change.
- Limit usage of CEL expressions to rules with no eviction: inconsistent.
- Remove the fields which cannot be supported well.

The last option is chosen.

The tracker is now no longer needed by the eviction controller. Reading
directly from the informer means that we cannot assume that pointers are
consistent. We have to track ResourceSlices by their name, not their pointer.
2025-10-31 18:11:18 +01:00
Patrick Ohly
fee14ffca2 DRA API: device taints 1.35
This raises the number of allowed taints per device to 16 by lowering
the number of allowed devices to 64 per ResourceSlice if (and only if!)
taints are used.

"effect: None" and DeviceTaintRule status with conditions get added
to support giving feedback to admins.

Instead of merely adding the new effect value, this also changes validation of
the enum so that unknown values are valid if they were already stored. This
will simplify adding new effects in the future because validation won't fail
for them after a downgrade. Consumers must treat them like this new None
effect, i.e. ignore them.
2025-10-31 18:11:18 +01:00
Patrick Ohly
2e543d151b DRA device taints: convert unit test to synctest
The immediate benefit is that the time required for running the package's unit
test goes down from ~10 seconds (because of required real-world delays) to ~0.5
seconds (depending on the CPU performance of the host). It can also make
writing tests easier because after a `Wait` there is no need for locking before
accessing internal state (all background goroutines are known to be blocked
waiting for the main goroutine).

What somewhat ruins the perfect determinism is the polling for informer cache
syncs: that can take an unknown number of loop iterations. Probably could be
fixed by making the waiting block on channels (requires work in client-go).

The only change required in the implementation is avoiding the sleep when
deleting a pod failed for the last time in the loop (a useful, albeit minor
improvement by itself): the test proceeds after having blocked that last Delete
call, in which case synctest expects the background goroutine to exit without
delay.
2025-10-30 17:29:58 +01:00
Kubernetes Prow Robot
6056b0dfa4 Merge pull request #134973 from pohly/dra-test-utilities
DRA: test improvements
2025-10-30 09:26:05 -07:00
Kubernetes Prow Robot
34988e758d Merge pull request #134453 from stlaz/node-conformance-e2e
Fix node conformance tests with fake registry
2025-10-30 07:48:06 -07:00
Stanislav Láznička
428be46ba2 node conformance e2e: move registry cleanup to ginkgo.DeferCleanup
Signed-off-by: Stanislav Láznička <slznika@microsoft.com>
2025-10-30 15:00:57 +01:00
Kubernetes Prow Robot
6eee830d4f Merge pull request #134919 from p0lyn0mial/upstream-watchlist-unsupported-wl-wrapp-remaining-lws
watchlist: wrap remaining LW with ToListWatcherWithWatchListSemantics
2025-10-30 06:32:11 -07:00
Kubernetes Prow Robot
ab39c8be55 Merge pull request #134854 from serathius/informer-benchmark
Benchmark SharedIndexInformer
2025-10-30 06:32:04 -07:00
Patrick Ohly
8d3bc085ce DRA integration: refactor helper functions
They now live in a separate file, use ktesting+Gomega consistently, and
follow (mostly) best practices:
- strict validation during create
- wait for completion of delete

The latter is not complete yet because it was found that some binding condition
test keeps a ResourceCLaim in an undeletable state. That's okayish (namespace
stays around until apiserver gets restarted), but is worth looking into later.
2025-10-30 13:58:02 +01:00
Kubernetes Prow Robot
150b4dc15e Merge pull request #134955 from natasha41575/podgen-conformance
Promote Pod Generation e2e tests to conformance
2025-10-30 02:22:11 -07:00
Kubernetes Prow Robot
9e284866c3 Merge pull request #134740 from hoskeri/untolerated-taint-generic
Do not log untolerated taint in pod status updates.
2025-10-30 02:22:03 -07:00
Marek Siarkowicz
7a9d718cdf Benchmark SharedIndexInformer 2025-10-30 10:09:50 +01:00
Kubernetes Prow Robot
808d320de1 Merge pull request #134956 from yliaog/blockowner
removed BlockOwnerDeletion
2025-10-30 01:26:11 -07: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
37c72027f6 Merge pull request #134924 from mariafromano-25/cleanup-swap-feature
Cleanup Swap Feature to Node Conformance
2025-10-29 19:34:03 -07:00
Kubernetes Prow Robot
de28a5bfea Merge pull request #134602 from lalitc375/device-attirubute
[feat] Add k8s-resource-fully-qualified-name format
2025-10-29 16:36:01 -07:00
Maria Romano Silva
1d2b87c2e9 updated nodeswap description only 2025-10-29 23:00:29 +00:00
yliao
4f647b3f3d removed BlockOwnerDeletion 2025-10-29 22:41:10 +00:00
Natasha Sarkar
2a217a9bfd promote pod generation tests to conformance 2025-10-29 20:57:59 +00:00
Kubernetes Prow Robot
3ec2d82da5 Merge pull request #134784 from michaelasp/svm_beta2
SVM: bump the API to beta, remove unused fields
2025-10-29 13:56:02 -07:00
Michael Aspinwall
3b72759d1b Update SVM to Beta
Co-authored-by: Stanislav Láznička <stlaz.devel@proton.me>
2025-10-29 19:36:11 +00:00
Kubernetes Prow Robot
a490c43f0e Merge pull request #134948 from natasha41575/podgeneration-ga
Promote Pod Generation to GA
2025-10-29 12:10:01 -07:00
Kubernetes Prow Robot
412bfec7a1 Merge pull request #134157 from macsko/forget_pod_immediately_when_it_is_deleted
Forget pod from scheduler's cache immediately when it's deleted
2025-10-29 10:14:10 -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
Natasha Sarkar
4a991bbbd9 fix unit tests for pod gen GA 2025-10-29 16:34:18 +00: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
Natasha Sarkar
21c832b47d promote pod generation to GA 2025-10-29 15:52:17 +00:00
Kubernetes Prow Robot
a8a43a5e25 Merge pull request #134795 from aditigupta96/fix-runwithcontext-controller-tests
pkg/controller: Use informer.RunWithContext in tests
2025-10-29 07:14:04 -07:00
Stanislav Láznička
842cd0ea77 node conformance e2e: don't recreate test container on an error
Signed-off-by: Stanislav Láznička <slznika@microsoft.com>
2025-10-29 13:18:07 +01:00
Stanislav Láznička
135b46974a e2e registry: have SetupRegistry() return registry address 2025-10-29 13:18:06 +01:00
Stanislav Láznička
ee777bef91 test/utils: remove GcAuthenticatedRegistry from RegistryList
Signed-off-by: Stanislav Láznička <slznika@microsoft.com>
2025-10-29 13:17:05 +01:00
Stanislav Láznička
bb1b23a34e e2e fake registry: add function docs
Signed-off-by: Stanislav Láznička <slznika@microsoft.com>
2025-10-29 13:17:04 +01:00
Stanislav Láznička
fc81e22735 fix Node Conformance Container Runtime test with fake registry
Signed-off-by: Stanislav Láznička <slznika@microsoft.com>
2025-10-29 13:17:03 +01:00
Stanislav Láznička
a0e64c21f2 Use fake registry in Node's container runtime image pulling tests
Signed-off-by: Stanislav Láznička <slznika@microsoft.com>
2025-10-29 13:06:34 +01:00
Maciej Skoczeń
b29fdd1551 Forget pod from scheduler's cache immediately when it's deleted or has DeletionTimestamp set 2025-10-29 10:00:38 +00:00
Maciej Skoczeń
1502996787 Refactor scheduler event handlers for pods to handle binding event in one place 2025-10-29 09:59:35 +00:00
Kubernetes Prow Robot
3daf280c46 Merge pull request #134103 from sunya-ch/fix-134100
[DRA] Fix ConsumableCapacity to be able to allocate the same device that previously consumed the counterSet
2025-10-28 23:52:01 -07:00
Lalit Chauhan
37ba7bb454 Address feedbacks 2025-10-29 04:41:10 +00:00
Lalit Chauhan
94101ba6e0 Add new method to validate C Identifier 2025-10-29 04:41:10 +00:00
Lalit Chauhan
ec8c2246b2 Use k8s-resource-fully-qualified-name format to validate MatchAttribute 2025-10-29 04:41:07 +00:00
Lalit Chauhan
2de03899da Add k8s-resource-fully-qualified-name format in valdiation-gen 2025-10-29 04:39:55 +00:00
Kubernetes Prow Robot
b6e7ee359d Merge pull request #134644 from vikasbolla/fix_change_permission
Fix volume mount changePermissions test flake
2025-10-28 19:08:00 -07:00
Kubernetes Prow Robot
06bbf2abbc Merge pull request #134796 from darshansreenivas/dtumkur-pr-storage-tag-migration
feat: wire storage group for declarative validation and +k8s:required to StorageClass.Provisioner
2025-10-28 17:54:00 -07:00
Kubernetes Prow Robot
dbf19f370a Merge pull request #134836 from lalitc375/maxLen
Use eachKey DV in DRA resources.
2025-10-28 17:04:07 -07:00
Kubernetes Prow Robot
0b90cb5e5a Merge pull request #134493 from adrianmoisey/promote-kep-5311-to-beta
Promote KEP-5311 (Relaxed validation for Services names) to beta
2025-10-28 17:04:00 -07:00
Kubernetes Prow Robot
239c3c32ef Merge pull request #134922 from soltysh/registry_owners
Update OWNERS to sig-apps owned registry packages (batch & policy)
2025-10-28 16:12:07 -07:00