Commit Graph

7159 Commits

Author SHA1 Message Date
Kubernetes Prow Robot
11c10dc5a0 Merge pull request #136939 from pohly/dra-device-taints-unit-test-improvements
DRA device taints: update unit tests
2026-03-03 02:48:54 +05:30
Kubernetes Prow Robot
330950ca52 Merge pull request #137254 from michaelasp/statefulConsistency
Add the ability for the statefulset controller to read its own writes
2026-02-28 01:39:30 +05:30
Michael Aspinwall
c8e8bd5085 Add the ability for the statefulset controller to read its own writes 2026-02-27 18:21:30 +00:00
Patrick Ohly
29e92367db DRA device taints: avoid unnecessary Pod lookup
When rapidly processing informer events it can happen that a pod gets scheduled
twice (seen only in the TestEviction/update unit test):

- Claim update observed, pod from informer cache with NodeName from update -> queue pod for eviction.
- Pod update observed, claim from informer cache -> queue pod again.

The effect is one additional Get call to the apiserver. We can avoid it by
maintaining an LRU cache with the UIDs of the pods which we have evicted and
thus don't need to do anything for.
2026-02-27 14:38:30 +01:00
Patrick Ohly
017a53a1a9 DRA device taints: simplify more tests with synctest
In these cases it's certain that no time needs to pass, so Wait can
replace polling with Eventually. This also means that locking is
not necessary to prevent data races.
2026-02-27 07:47:28 +01:00
Patrick Ohly
4521c34276 DRA device taints: remove usage of testify for unit test
In particular with the builtin tCtx.Assert/Expect the assertions are also short
when using gomega and often more readable (no more confusion in Equal which one
is the expected and which the actual value).
2026-02-27 07:47:28 +01:00
Patrick Ohly
fb94a99d2f DRA device taints: artificially delay pod deletion during test
We can observe the delay in the metric histogram. Because we run in a synctest
bubble, the delay is 100% predictable.

Unfortunately we cannot use the reactor mechanism of the fake client: that
delays while holding the fake's mutex. When some other goroutine (in this case,
the event recorder) calls the client, it gets blocked without being considered
durably blocked by synctest, so time does not advance and the test gets stuck.
2026-02-27 07:47:28 +01:00
Patrick Ohly
7d7b4c3dcb DRA device taint tests: remove List+Watch workaround
This was fixed in client-go itself, no workaround needed anymore.
2026-02-27 07:46:33 +01:00
Patrick Ohly
75626bcf3f DRA device taints: update unit tests
Thanks for waiting for cache sync via channels the random delays caused by
polling are gone, making the initial setup including cache sync happen
"immediately" when a test starts (= same virtual time). This makes the tests
more predictable and simplifies making further assertions about when something
happens or how long it takes.

While at it, restore previous performance by setting feature gates once and
running tests in parallel again.
2026-02-27 07:46:19 +01:00
Karthik Bhat
43bfd8615d Refactor NewTestContext to return Context instead of TContext 2026-02-26 11:27:26 +05:30
Kubernetes Prow Robot
7ad86d14df Merge pull request #137243 from michaelasp/fixJobClear
Fix clearing job consistency store for all deletes
2026-02-26 01:12:23 +05:30
Michael Aspinwall
f18f0df7fe Add the ability for the replicaset controller to read its own writes 2026-02-25 17:15:53 +00:00
Michael Aspinwall
008b92e0f6 Fix clearing job consistency store for all deletes 2026-02-25 17:13:50 +00:00
Kubernetes Prow Robot
c6d1649721 Merge pull request #137226 from tchap/selinuxwarning-reverse-index
controller/selinuxwarning/cache: Add reverse index to speed up DeletePod
2026-02-25 21:16:34 +05:30
Kubernetes Prow Robot
9f65538a35 Merge pull request #137224 from tchap/conflicts-parsed
controller/selinuxwarning: Pre-parse SELinux label
2026-02-25 16:27:50 +05:30
Ondra Kupka
911a61d050 controller/selinuxwarning/cache: Add reverse index
Added podToVolumes reverse index to optimize DeletePod.
Currently we simply iterate through all the volumes and remove the pod
being deleted from there. This is inefficient and takes longer the
longer the volume list becomes.

Keeping a map pod -> volumes makes removing a pod fast. We can just jump
to the relevant volumes directly and remove the pod from there.
2026-02-25 11:38:50 +01:00
Michael Aspinwall
61d0dd30fb Add the ability for the job controller to read its own writes 2026-02-25 01:19:48 +00:00
Ondra Kupka
a34456319d controller/selinuxwarning: Pre-parse SELinux label
When calling ControllerSELinuxTranslator.Conflicts(), the SELinux label
is repeatedly split into []string to detect conflicts. This causes a huge
number of allocations when there are many comparisons.

This is now made more efficient by pre-parsing the SELinux label and
storing it in podInfo as [4]string for fast comparison when needed.
2026-02-24 18:08:36 +01:00
Kubernetes Prow Robot
8812ec563c Merge pull request #134353 from skitt/drop-string-slice
Deprecate obsolete slice utility functions
2026-02-20 00:57:41 +05:30
Michael Aspinwall
65eb0e94c2 Daemonset Consistency
Add the ability for the daemonset controller to figure out whether it has read its own writes for pods and daemonset objects.
2026-02-19 16:53:19 +00:00
Stephen Kitt
d42d1e3d1f Deprecate obsolete slice utility functions
... and update users to use standard library functions.

Signed-off-by: Stephen Kitt <skitt@redhat.com>
2026-02-16 10:04:33 +01:00
Kubernetes Prow Robot
d7f6f91dae Merge pull request #135820 from pohly/dra-sharing-claim-sequentially-test
DRA: sharing claim sequentially test
2026-02-13 01:50:09 +05:30
Kubernetes Prow Robot
98dd4d8e60 Merge pull request #136812 from rpb-ant/rpb/sts-not-found
Add 404 handling for the statefulset controller pod deletion codepath
2026-02-13 00:18:00 +05:30
Kubernetes Prow Robot
5b63a8c68e Merge pull request #136921 from dims/dump-from-utils
Move dump package from apimachinery to k8s.io/utils
2026-02-12 22:28:10 +05:30
Ryan Brewster
11c6f8c7c8 Clean up redundant IsNotFound checks in stateful_set_control
🏠 Remote-Dev: homespace
2026-02-12 14:35:10 +00:00
Davanum Srinivas
550cc8645b Move dump package from apimachinery to k8s.io/utils
Replace all imports of k8s.io/apimachinery/pkg/util/dump with
k8s.io/utils/dump across the repo. The apimachinery dump package
now contains deprecated wrapper functions that delegate to
k8s.io/utils/dump for backwards compatibility.

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2026-02-12 07:34:19 -05:00
Patrick Ohly
bff684d951 DRA ResourceClaim controller: update logging
This provides a bit more information when the controller touches a
ResourceClaim.
2026-02-12 12:33:22 +01:00
Kubernetes Prow Robot
1956f4e90d Merge pull request #136701 from Jefftree/fix-tombstone
Add tombstone handling for serviceaccount and attachdetach controllers
2026-02-12 08:24:09 +05:30
Jefftree
334fa1cef8 Add tombstone handling for serviceaccount and attachdetach controllers 2026-02-11 16:06:29 -05:00
Kubernetes Prow Robot
fce5bc2854 Merge pull request #134316 from xigang/node_controller_pod
node_lifecycle_controller: fix processing deleted pod events, which are currently missed
2026-02-11 09:26:00 +05:30
Kubernetes Prow Robot
f693c45c4e Merge pull request #136775 from atombrella/feature/activate_modernize_slicessort
Enable modernize/slicessort rule
2026-02-10 05:43:57 +05:30
Ryan Brewster
efe3667b6b Add 404 handling for the statefulset controller pod deletion codepath
The daemonset controller already has handling for NotFound errors.

Right now if the statefulset controller is attempting to scale down a
statefulset and its informer cache is stale, it can get hard-blocked on a
missing pod.

This issue will eventually self-resolve once the informer cache "catches
up", but in the process of exploring this issue I realized that
404s during pod deletions don't strictly need to abort the entire sync;
we can continue.

This is especially impactful for large statefulsets with
podManagementStrategy: Parallel, where a single "phantom" pod (actually
missing, but still present in the informer cache) can block thousands of
other pods from being cleaned up.
2026-02-06 22:45:57 +00:00
Mads Jensen
95616cecda Use slices.Sort instead of sort.Slice.
There were only two instances of this in the entire code-base. Hence,
I have enabled the modernize rule/linter in golangci-lint.
2026-02-06 22:46:08 +01:00
carlory
4bc5464553 Remove feature gate HonorPVReclaimPolicy
Signed-off-by: carlory <baofa.fan@daocloud.io>
2026-02-06 13:31:16 +08:00
Kubernetes Prow Robot
eba75de156 Merge pull request #136341 from Karthik-K-N/remove-deprecated-methods
Remove usage of deprecated functions from ktesting package
2026-02-02 19:28:31 +05:30
xigang
0fe227edfa nodelifecycle: fix processing deleted pod events, which are currently missed
Signed-off-by: xigang <wangxigang2014@gmail.com>
2026-01-31 10:49:15 +08:00
Jefftree
063caad801 Fix unit tests 2026-01-29 17:55:08 -05:00
Jefftree
1e67dbfefb Add ctx to endpointslicemirroring controller 2026-01-29 17:07:14 -05:00
Kubernetes Prow Robot
250e18904e Merge pull request #136050 from ShaanveerS/fix-selinuxwarning-verbosity
fix(controller/volume): convert V().Error() to V().Info()
2026-01-29 21:11:58 +05:30
Karthik Bhat
e44e06c53f Remove usage of deprecated functions from ktesting package 2026-01-29 14:51:59 +05:30
Kubernetes Prow Robot
8ccb55ffef Merge pull request #136040 from petern48/error-level-logs
fix(controller/resourcequota, controller/garbagecollector): Change V().Error() to V().Info()
2026-01-28 03:27:48 +05:30
MohammedSaalif
4925c6bea4 DRA: support non-pod references in ReservedFor (#136450)
* DRA: support non-pod references in ReservedFor

Signed-off-by: MohammedSaalif <salifud2004@gmail.com>

* Expand reservation validation comment in syncClaim as suggested by mortent

* Address feedback: rename valid to remaining and remove obsolete TODO

---------

Signed-off-by: MohammedSaalif <salifud2004@gmail.com>
2026-01-25 00:28:13 +05:30
Karthik Bhat
85aceb54fd Remove fmt.Println() added for debug 2026-01-22 18:34:15 +05:30
carlory
be0e68ba84 remove featureGate from PluginManager
Signed-off-by: carlory <baofa.fan@daocloud.io>
2026-01-19 11:35:30 +08:00
carlory
6d1afce678 remove GetHostName func from the VolumeHost interface
Signed-off-by: carlory <baofa.fan@daocloud.io>
2026-01-19 11:35:30 +08:00
Kubernetes Prow Robot
8392659d3c Merge pull request #136143 from pohly/client-go-fake-list-and-watch-fix
client-go testing: fix List+Watch support
2026-01-15 21:35:36 +05:30
Patrick Ohly
6bfa727bee client-go testing: fix List+Watch support
5644850607 added support for List+Watch to a fake client-go instance.
However, that support was not quite working yet as seen when analyzing a test
flake:

- List returned early when there were no objects, without adding the
  ResourceVersion. The ResourceVersion should have been "0" instead.
- When encountering "" as ResourceVersion, Watch didn't deliver
  any objects. That was meant to preserve compatibility with clients
  which don't expect objects from a Watch, but the right semantic of
  "" is "Start at most recent", which includes delivering existing
  objects.

Tests which meddle with the List implementation via a reactor (like
clustertrustbundlepublisher) have to be aware that Watch now may
return objects when given an empty ResourceVersion.
2026-01-15 16:08:23 +01:00
Maciej Szulik
5f21c6c709 Eliminate duplicate scale methods deployment controller in favor of a parameter
This initially was attempted in 5f083e3b9f
but it caused e2e failing heavily (see
https://github.com/kubernetes/kubernetes/issues/135222 for more details).
The changes proposed in e6641cd290
clarified the naming of the two existing scale methods but they still
leave both of them as is.

This change goes a step further by combining both into a single method
with a parameter `forceUpdate` which is responsible for driving the mode
of execution between lazy update and a forced update.

Signed-off-by: Maciej Szulik <soltysh@gmail.com>
2026-01-15 13:50:39 +01:00
Jefftree
2522628780 Add index for controller revision 2026-01-13 19:46:34 +00:00
Kubernetes Prow Robot
d68d48073f Merge pull request #136112 from danwinship/network-1.36-cleanup
Drop TopologyAwareHints and ServiceTraficDistribution feature gates
2026-01-13 07:43:36 +05:30