Commit Graph

442 Commits

Author SHA1 Message Date
Simone Tiraboschi
e56144c7a2 fix(descheduler): reset prometheus usage client at each extension point
Profile creation was moved outside the descheduling cycle in b214c147,
but reconcileInClusterSAToken() still runs only in runFnc(), after
newDescheduler() returns. This leaves the prometheus client nil when
LowNodeUtilization's New() runs, causing "prometheus client not
initialized" at startup.

Avoid failing at plugin creation time if the prometheus
client is not yet available. Instead, usageClientForMetrics() is now
called at the start of every extension point via a resetUsageClient()
helper, so each descheduling cycle picks up the latest client regardless
of when the SA token is reconciled or rotated.

Fixes: https://github.com/kubernetes-sigs/descheduler/issues/1840

Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
2026-04-29 11:36:32 +02:00
Amir Alavi
a4391ea73b Extract shared container state matching helpers into podutil
Move container waiting/terminated state checking from PodLifeTime and
RemovePodsHavingTooManyRestarts into podutil as separate exported helpers:
HasMatchingContainerWaitingState and HasMatchingContainerTerminatedState.
Each plugin composes only the helpers it needs.
2026-03-06 12:18:05 -05:00
Amir Alavi
a845ed3b36 Extend PodLifeTime with condition, exit code, owner kind, and transition time filters 2026-03-06 12:17:07 -05:00
Kubernetes Prow Robot
0de5bad232 Merge pull request #1827 from a7i/k8s-1.35
[v0.35.0] bump to kubernetes 1.35 deps
2026-02-18 16:31:37 +05:30
Jan Chaloupka
a868c8d129 chore: update the code based on golangci-lint report 2026-02-17 22:01:25 +01:00
Amir Alavi
a206a88d86 [v0.35.0] bump to kubernetes 1.35 deps
Signed-off-by: Amir Alavi <amiralavi7@gmail.com>
2026-02-15 19:50:50 -05:00
Jan Chaloupka
b214c14793 feat(pkg/descheduler): create profiles outside the descheduling cycle 2026-02-04 20:04:31 +01:00
Danila Bobkov
4361eefaf2 add namespaceLabelSelector
Signed-off-by: Danila Bobkov <danila.bobkov@flant.com>
2026-02-02 15:22:11 +03:00
Jan Chaloupka
cf9edca33c feat(profile): inject a plugin instance ID to each built plugin 2026-01-06 12:26:35 +01:00
Jan Chaloupka
38f0f15787 chore: make gen 2026-01-04 20:23:13 +01:00
Jan Chaloupka
52f2aea444 refactor(pkg/framework/profile): add registerDefaultEvictor helper function 2026-01-04 19:43:47 +01:00
Jan Chaloupka
f3c63011cc refactor(pkg/framework/profile): add fake plugin registration helpers 2026-01-04 19:43:29 +01:00
Jan Chaloupka
47b939dd86 refactor(pkg/framework/profile): build a profile through a shared function to reduce code duplication 2026-01-04 19:42:30 +01:00
Jan Chaloupka
7ef3673d4c refactor: inline single-statement apply functions in BuildTestPod calls 2025-12-21 21:41:59 +01:00
Jan Chaloupka
988e0b8868 refactor: replace pod.Spec.Volumes with test.SetHostPathEmptyDirVolumeSource in plugin tests 2025-12-21 21:36:24 +01:00
Jan Chaloupka
fc8ae3b4e8 refactor: replace pod.Spec.Priority with test.SetPodPriority in plugin tests 2025-12-21 21:36:05 +01:00
Jan Chaloupka
769ded35f1 make fmt 2025-12-20 15:24:37 +01:00
Jan Chaloupka
3283635149 refactor(defaultevictor_test): move newProtectedStorageClassesConfig to package level
Move the newProtectedStorageClassesConfig helper function from local scope
to package level so it can be reused by both TestDefaultEvictorFilter and
Test_protectedPVCStorageClasses, eliminating code duplication.
2025-12-20 15:17:06 +01:00
Jan Chaloupka
994ce3e2f7 refactor(TestDefaultEvictor): add setPodPVCVolumeWithFooClaimName helper function 2025-12-20 14:36:10 +01:00
Jan Chaloupka
90e4115b78 refactor(TestDefaultEvictor): add setPodLocalStorage helper function 2025-12-20 14:29:19 +01:00
Jan Chaloupka
8913d79d14 refactor(TestDefaultEvictor): replace mirror pod annotation assignments with test.SetMirrorPodAnnotation 2025-12-20 14:28:08 +01:00
Jan Chaloupka
9a5d7e8286 refactor(TestDefaultEvictor): replace system critical priority assignments with test.SetPodPriority 2025-12-20 14:27:18 +01:00
Jan Chaloupka
674e463bc2 refactor(TestDefaultEvictor): replace manual owner reference assignments with test utilities 2025-12-20 14:25:58 +01:00
Jan Chaloupka
1df3ef5030 refactor(TestDefaultEvictor): add setPodEvictAnnotation helper function 2025-12-20 14:22:28 +01:00
Jan Chaloupka
3068f8431a refactor(TestDefaultEvictor): add setPodNodeSelector helper function 2025-12-20 14:11:46 +01:00
Jan Chaloupka
dfd2b95d2d refactor(TestDefaultEvictor): add setNodeLabel helper function 2025-12-20 14:08:11 +01:00
Jan Chaloupka
3bb4529c34 refactor(TestDefaultEvictor): use test.SetNormalOwnerRef 2025-12-20 14:00:40 +01:00
Jan Chaloupka
b8765bd8ee refactor(TestDefaultEvictor): add setNodeTaint helper function 2025-12-20 13:54:50 +01:00
Jan Chaloupka
d666e4b830 refactor(TestDefaultEvictor): add buildTestPod helper function 2025-12-20 13:43:00 +01:00
Jan Chaloupka
08f733863e refactor(TestDefaultEvictor): add buildTestNode helper function 2025-12-20 13:25:39 +01:00
Kubernetes Prow Robot
b56f3cdae9 Merge pull request #1797 from ingvagabund/nodetaint-unit-test
refactor(TestDeletePodsViolatingNodeTaints): inline object creation
2025-12-15 09:51:45 -08:00
Jan Chaloupka
162a2d14b7 refactor(TestRemovePodsHavingTooManyRestarts): remove leftover comments 2025-12-15 18:20:38 +01:00
Jan Chaloupka
78788d72de refactor(node_taint_test): inline p15 2025-12-15 18:19:04 +01:00
Jan Chaloupka
956eeefede refactor(node_taint_test): inline p14 2025-12-15 18:18:59 +01:00
Jan Chaloupka
1f7bd1fba9 refactor(node_taint_test): inline p13 2025-12-15 18:18:56 +01:00
Jan Chaloupka
5fdf368593 refactor(node_taint_test): inline p12 2025-12-15 18:18:51 +01:00
Jan Chaloupka
50b6e178c1 refactor(node_taint_test): inline p11 2025-12-15 18:18:47 +01:00
Jan Chaloupka
c1ad532c46 refactor(node_taint_test): inline p10 2025-12-15 18:18:43 +01:00
Jan Chaloupka
7e40aae2dc refactor(node_taint_test): inline p9 2025-12-15 18:18:39 +01:00
Jan Chaloupka
e09bd976f5 refactor(node_taint_test): inline p8 2025-12-15 18:18:35 +01:00
Jan Chaloupka
ffb1f44144 refactor(node_taint_test): inline p7 2025-12-15 18:18:24 +01:00
Jan Chaloupka
cb595f2524 refactor(node_taint_test): inline p6 2025-12-15 18:17:34 +01:00
Jan Chaloupka
c46817f6df refactor(node_taint_test): inline p5 2025-12-15 18:17:30 +01:00
Jan Chaloupka
032db38d6c refactor(node_taint_test): inline p4 2025-12-15 18:17:26 +01:00
Jan Chaloupka
c1cd3ae794 refactor(node_taint_test): inline p3 2025-12-15 18:17:21 +01:00
Jan Chaloupka
060d9c8573 refactor(node_taint_test): inline p2 2025-12-15 18:17:17 +01:00
Jan Chaloupka
51bcf60ccf refactor(node_taint_test): inline p1 2025-12-15 18:17:12 +01:00
Jan Chaloupka
b472549cf6 refactor(node_taint_test): add withKubeSystemCriticalPod helper 2025-12-15 18:16:58 +01:00
Jan Chaloupka
c68e8a6d06 refactor(node_taint_test): add withTestTaintXToleration1 helper 2025-12-15 18:16:19 +01:00
Jan Chaloupka
68d9d4d044 refactor(node_taint_test): add datacenter label constants 2025-12-15 18:16:14 +01:00