Commit Graph

132321 Commits

Author SHA1 Message Date
胡玮文
ed19492dc2 scheduler/volumebinding: passive assume cache
Currently volume and dynamic-resource plugin shares an AssumeCache
implementation. However, they features significantly different use case.  DRA
call Assume() on objects returned by APIServer, but volume call Assume() on
objects yet to be sent to the APIServer.

VolumeBinding plugin only makes one update request, while DynamicResource makes
2 requests (add finalizer then update allocation status).  Taking advantage of
this, currently the volume cache is simpler:

1. Reserve: assume PV/PVC will be updated
2. PreBind: really send the update request
3. AssumeCache receives an update from informer and overwrite the assumed state.
   a. if Prebind succeeded, this will surely include the update from step 2.
   b. if PreBind is not finished yet, and this is an irrelevant update, it is safe to
      overwrite the assumed state, because our update in PreBind will surely fail with Conflict.

While for DynamicResource:

1. Reserve: add devices to inFlightAllocations
2. PreBind:
   a. send the 2 update requests
   b. add the returned object into AssumeCache
   c. AssumeCache dispatch events synchronously to update allocatedDevices
   d. remove devices from inFlightAllocations

DynamicResource needs some features from AssumeCache that is not necessary for VolumeBinding:
1. DynamicResource needs strictly ordered update events to update allocatedDevices,
   including those from Assume() and Restore()
2. DynamicResource needs to compare ResourceVersion to prevent the assumed state from being
   overwritten by older version from informer.  While this works, the doc[1] says:
   "you must not compare resource versions for greater-than or less-than relationships".

Given so much difference, it can be beneficial to fork another simpler
AssumeCache for VolumeBinding plugin. Because of no need to send events, the
lite AssumeCache is a passive component. It only record the assumed version
without copying all objects from informer into its local cache. When reading,
we read from both informer and local cache.  So it will always be up-to-date
with informer, no need to wait for event handler.

This resolves a race condition where AssumeCache and scheduler queue both
receive events from informer. When a pod is scheduling due to PV update event,
the PVCache may be not updated yet because it has not processed the relevant
event.

The passive version still listens events from informer, but only for cleaning up
its local cache to save memory.

[1]: https://kubernetes.io/docs/reference/using-api/api-concepts/#resource-versions
2025-09-13 00:26:45 +08:00
胡玮文
c385a229d4 scheduler/volumebinding: introduce testInformer 2025-09-12 15:11:52 +08:00
胡玮文
eaf87d5907 scheduler/volumebinding: pass testing.T to helper 2025-09-12 14:29:02 +08:00
胡玮文
dce23dac03 scheduler/volumebinding: use subtest 2025-09-12 14:23:06 +08:00
Kubernetes Prow Robot
f278302957 Merge pull request #133894 from lalitc375/k8s-name
Add k8s-long-name and k8s-short-name  format validation tags
2025-09-05 01:01:36 -07:00
Kubernetes Prow Robot
c4fdf5f027 Merge pull request #133239 from Peac36/fix/133184
add paths section to kubelet statusz endpoint
2025-09-05 01:01:29 -07:00
Kubernetes Prow Robot
56f6358c11 Merge pull request #133890 from huww98/fix-volume-metrics
kubelet/metrics: fix multiple Register call
2025-09-04 23:23:00 -07:00
Lalit Chauhan
c88f2f3142 Add k8s-long-name, k8s-short-name format validation tags 2025-09-05 04:50:40 +00:00
Kubernetes Prow Robot
ecf2c52f75 Merge pull request #133729 from HirazawaUi/add-HirazawaUi-to-reviewer
Self nominate HirazawaUi as sig-node reviewer
2025-09-04 19:21:27 -07:00
Kubernetes Prow Robot
ab220a42c8 Merge pull request #133575 from aerosouund/fix-nil-selectors
[BUG] [Selectors]: Return an error in case nil selectors are passed to the matcher functions
2025-09-04 19:21:16 -07:00
Kubernetes Prow Robot
8085d5c458 Merge pull request #133896 from yongruilin/fix-format-warning
fix: Only warn for unrecognized formats on type=string
2025-09-04 16:03:14 -07:00
yongruilin
4e200ca00e fix: Only warn for unrecognized formats on type=string 2025-09-04 22:04:10 +00:00
Keisuke Ishigami
ddb015f023 Resolve confusing use of TooManyRequests error for eviction (#133097)
modify test "the error includes the reason when the condition.Status is False"
2025-09-04 12:19:14 -07:00
Kubernetes Prow Robot
6f093ef292 Merge pull request #133792 from HirazawaUi/lock-AllowOverwriteTerminationGracePeriodSeconds
Lock down AllowOverwriteTerminationGracePeriodSeconds
2025-09-04 09:13:17 -07:00
胡玮文
21ff3c196c kubelet/metrics: fix multiple Register call
DRA also calls Register at pkg/kubelet/cm/container_manager_linux.go NewContainerManager(), causing volume stats collector being ignored.
Fix this by moving it out of `sync.Once()`, allowing multiple calls to `Register()` func.
2025-09-04 20:12:58 +08:00
胡玮文
98c6293623 kubelet/metrics: misc optimization 2025-09-04 19:29:16 +08:00
HirazawaUi
43c3b03685 Lock AllowOverwriteTerminationGracePeriodSeconds 2025-09-04 19:25:26 +08:00
Kubernetes Prow Robot
55e8cdeb95 Merge pull request #133868 from serathius/storage-resource-prefix
Enforce that all resources set resourcePrefix
2025-09-03 19:07:14 -07:00
Marek Siarkowicz
683a76dd15 Enforce that all resources set resourcePrefix 2025-09-04 00:11:15 +02:00
Kubernetes Prow Robot
9e0bc19fdf Merge pull request #133832 from cbandy/cel-validation-errors-132528
Omit value type from validation rule failures
2025-09-03 14:55:21 -07:00
Eddie
954ac21c6c Add Kubelet stress test for pod cleanup when rejection due to VolumeAttachmentLimitExceeded (#133357)
* Add stress test for pod cleanup when rejected due to VolumeAttachmentLimitExceeded

Signed-off-by: Eddie Torres <torredil@amazon.com>

* Move newTestPodsWithResources below TestVolumeAttachLimitExceededCleanup

Signed-off-by: Eddie Torres <torredil@amazon.com>

---------

Signed-off-by: Eddie Torres <torredil@amazon.com>
2025-09-03 14:55:14 -07:00
Kubernetes Prow Robot
76ab726b8e Merge pull request #133875 from pohly/apimachinery-apply-flake
apply integration test: fix ordering test flake
2025-09-03 14:03:23 -07:00
Kubernetes Prow Robot
4a79948217 Merge pull request #133473 from roycaihw/psi-cpu-pressure-test
PSI test: add a CPU limit of 500m to cpu-stress-pod
2025-09-03 14:03:15 -07:00
Kubernetes Prow Robot
b00aba714e Merge pull request #133873 from serathius/storage-disable-events-estimate
Disable estimating resource size for resources with watch cache disabled
2025-09-03 12:55:20 -07:00
Kubernetes Prow Robot
7a1e1b6fb1 Merge pull request #130376 from phuhung273/pluginmanager-context-logging
kubelet: Migrate pkg/kubelet/pluginmanager to contextual logging
2025-09-03 12:55:13 -07:00
Kubernetes Prow Robot
86d0607011 Merge pull request #133769 from thockin/kk_bump_gengo
Bump gengo
2025-09-03 10:57:14 -07:00
Marek Siarkowicz
3e84e16315 Disable estimating resource size for resources with watch cache disabled
Listing all keys from etcd turned out to be too expensive, negativly
impacting events POST latency. Events resource is the only resource that
by default has watch cache disabled and which includes very
large number of small objects making it very costly to list keys.

Expected impact:
* No apiserver_resource_size_estimate_bytes metric for events.
* APF overestimating LIST request cost to events. Fallback assumes
  object size of 1.5MB, meaning LIST events will always get maxSeats
2025-09-03 19:09:32 +02:00
Kubernetes Prow Robot
2ed79f9202 Merge pull request #133138 from linxiulei/fix_shutdown
kubelet: poll after reloading logind conf
2025-09-03 10:05:13 -07:00
Kubernetes Prow Robot
39b160f10c Merge pull request #133851 from andremarianiello/respect-dynamic-fake-options
client-go/dynamic/fake: Stop ignoring options
2025-09-03 08:45:23 -07:00
Kubernetes Prow Robot
529f147dfc Merge pull request #133740 from pacoxu/add-events-group-view
add events.events.k8s.io to clusterrole view/edit default
2025-09-03 08:45:15 -07:00
Tim Hockin
73cf278883 Mark some aliases as deprecated 2025-09-03 08:24:48 -07:00
Tim Hockin
5f4b4a6824 Bump gengo 2025-09-03 08:24:17 -07:00
Kubernetes Prow Robot
5dff07fdf9 Merge pull request #133837 from saschagrunert/cni-plugins
Update CNI plugins to v1.8.0
2025-09-03 07:53:15 -07:00
Patrick Ohly
7e9b228ff0 apply integration test: fix ordering test flake
Most of the time the managed fields were returned in the order as expected,
but not always. Semantically the order is irrelevant, so the comparison gets
relaxed to ignore it by normalizing first.
2025-09-03 16:50:42 +02:00
Kubernetes Prow Robot
a76d7e2338 Merge pull request #133867 from pohly/scheduler-perf-create-pods-data-race
scheduler-perf: fix data race in createPodsSteadily
2025-09-03 06:27:21 -07:00
Kubernetes Prow Robot
90a24cf81d Merge pull request #130551 from yylt/sbx
order sandbox by attempt or create time
2025-09-03 06:27:14 -07:00
Kubernetes Prow Robot
18c188467d Merge pull request #133438 from saschagrunert/timeout-pod-should-get-evicted
Increase termination timeout for `evicted pods should be terminal` test
2025-09-03 03:53:14 -07:00
Kubernetes Prow Robot
15b9222fa7 Merge pull request #133477 from chenggu88/e2e
Allow IfNotPresent to be used in node e2e tests
2025-09-03 02:11:16 -07:00
Patrick Ohly
07faaec2c4 scheduler-perf: fix data race in createPodsSteadily
A mutex lock around decrementing runningPods was missing, leading to a data
race report in ci-kubernetes-integration-race-master:

WARNING: DATA RACE
Read at 0x00c001bd20a8 by goroutine 95696:
  k8s.io/kubernetes/test/integration/scheduler_perf.createPodsSteadily.func7()
      /home/prow/go/src/k8s.io/kubernetes/test/integration/scheduler_perf/scheduler_perf.go:2133 +0x238
  ...

Previous write at 0x00c001bd20a8 by goroutine 101407:
  k8s.io/kubernetes/test/integration/scheduler_perf.createPodsSteadily.func5()
      /home/prow/go/src/k8s.io/kubernetes/test/integration/scheduler_perf/scheduler_perf.go:2064 +0x1a4
  ...
2025-09-03 10:34:38 +02:00
Kubernetes Prow Robot
d9df4ecff7 Merge pull request #133834 from pohly/build-data-race-detection
build: support -race in binaries
2025-09-03 00:11:13 -07:00
Sascha Grunert
c8f8f66e6d Increase termination timeout for evicted pods should be terminal test
This doubles the termination timeout for the eviction test from 5min to
10min. Reason for that is that the eviction manager relies on pod stats
metrics, which may not be acceessible during a period of time because of
the kubelet API unreachable. This could be reasoned in hardware or
network pressure when multiple tests run in parallel.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
2025-09-03 08:58:46 +02:00
Kubernetes Prow Robot
66ac078a20 Merge pull request #133799 from oyiz-michael/update-nfs-volume-baseimage-centos8
Update volume/nfs base image from centos:7 to centos:stream9
2025-09-02 23:03:13 -07:00
Kubernetes Prow Robot
41a8ace704 Merge pull request #133768 from jpbetz/dv-options
Add  +k8s:ifEnabled, +k8s:ifDisabled and +k8s:enumExclude tags
2025-09-02 21:41:13 -07:00
Paco Xu
ef7cee89bf add events.events.k8s.io to clusterrole view/edit/node default 2025-09-03 10:06:14 +08:00
Kubernetes Prow Robot
7284237ac4 Merge pull request #133229 from SergeyKanzhelev/fixupTypes
fix up types for 1.34 release - remove GA feature gates
2025-09-02 17:49:19 -07:00
Kubernetes Prow Robot
4cfdb209fb Merge pull request #133211 from saschagrunert/grpc-close
Add remote runtime/image `Close()` API
2025-09-02 17:49:12 -07:00
Kubernetes Prow Robot
53fecc7748 Merge pull request #133720 from carlory/cleanup-SizeMemoryBackedVolumes
Drop SizeMemoryBackedVolumes after the feature GA-ed in 1.32
2025-09-02 15:33:13 -07:00
Eric Lin
8d31237c33 kubelet: poll after reloading logind conf
fix: node shutdown manager not propoerly initialized (#133133)

Signed-off-by: Eric Lin <exlin@google.com>
2025-09-02 22:31:29 +00:00
Andre Marianiello
c7ddceb8cb client-go/dynamic/fake: Stop ignoring options 2025-09-02 17:45:31 -04:00
Joe Betz
5e59c658d6 Organize enum tests 2025-09-02 16:26:12 -04:00