Commit Graph

524 Commits

Author SHA1 Message Date
huweiwen
fd2dbe0d68 kubelet: don't check for mounted before update dsw PV size
We are still only calling NodeExpand after the volume is mounted.

avoid depending on ASW from dswp.findAndAddNewPods(). It is weird to determine desired state based on actual state.
2024-11-07 20:59:54 +08:00
Kubernetes Prow Robot
f3498df864 Merge pull request #128522 from huww98/multi-volume-part-0
Cleanups about kubelet/volumemanager
2024-11-07 03:53:28 +00:00
Jan Safranek
0d71dc677e Refactor CreateVolumeSpec
Rename old CreateVolumeSpec to CreateVolumeSpecWithNodeMigration that
extracts volume.Spec with node specific CSI migration.

Add CreateVolumeSpec that does the same, only without evaluating node CSI
migration.
2024-11-06 11:15:31 +01:00
huweiwen
b3fe7a6410 fix ExistingPodExistingVolume test case
the previous code is identical with NewPodNewVolume
2024-11-06 11:11:14 +08:00
huweiwen
b8777bc3b5 test: check for error returned by dsw.AddPodToVolume 2024-11-06 11:11:14 +08:00
huweiwen
f9a9b6f660 rename Gid => GID
according to stylecheck
2024-11-06 11:11:13 +08:00
Kubernetes Prow Robot
97c79df18f Merge pull request #127981 from jsafrane/selinux-changepolicy
1710: Implement SELinuxChangePolicy
2024-11-04 22:09:29 +00:00
Kubernetes Prow Robot
f8e64e1d6e Merge pull request #128219 from carlory/fix-127520-128126
kubelet: Fix the volume manager didn't check the device mount state in the actual state of the world before marking the volume as detached
2024-11-01 18:55:34 +00:00
Jan Safranek
d7daa688c9 Collect SELinux options only when needed
Remove feature gate check from GetPodVolumeNames and collect SELinux
options only when it's really needed.
2024-11-01 12:46:39 +01:00
Jan Safranek
97b03e29b9 Document getSELinuxLabel function 2024-11-01 12:46:39 +01:00
Jan Safranek
53e5335d3c Add SELinuxMount tests 2024-11-01 12:46:39 +01:00
Jan Safranek
89da53cdeb Add SELinuxChangePolicy tests 2024-11-01 12:46:38 +01:00
Jan Safranek
db353e0485 Refactor AddPodToVolume unit tests with multiple pods
Refactor existing tests that run AddPodToVolume with multiple pods
to a table.
2024-11-01 12:46:38 +01:00
Jan Safranek
db3d995c2a Refactor AddPodToVolume unit tests with a single pod
Refactor existing tests that run AddPodToVolume with a single pod / volume
to a table. And add few extra tests, covering existing ReadWriteOncePod
functionality.
2024-11-01 12:46:38 +01:00
Jan Safranek
e4eedfe105 Refactor getSELinuxLabel
Return early and reduce indentation
2024-11-01 12:46:38 +01:00
Jan Safranek
8a400124f9 Use SELinuxChangePolicy 2024-11-01 12:46:38 +01:00
carlory
1335f203fe kubelet: Fix the volume manager did't check the device mount state in the actual state of the world before marking the volume as detached. It may cause a pod to be stuck in the Terminating state due to the above issue when it was deleted. 2024-11-01 18:51:33 +08:00
AxeZhan
2ffb568540 rename functions 2024-10-25 12:53:24 +08:00
carlory
4c10212d7b Fix data race in kubelet/volumemanager 2024-10-08 16:39:02 +08:00
Kubernetes Prow Robot
3d6c99e1a7 Merge pull request #125139 from huww98/kubelet-vm-cleaup
kubelet/volumemanager: cleanup set and sort
2024-10-04 17:12:27 +01:00
Kubernetes Prow Robot
83a1310228 Merge pull request #126575 from Lucaber/volume-attach-memory-allocations
Reduce memory usage/allocations during wait for volume attachment
2024-10-04 16:08:27 +01:00
Kubernetes Prow Robot
c95dd85823 Merge pull request #127396 from olyazavr/no-dupe-mount-unmount
check if volume already has mount op in progress before mount/unmount
2024-10-04 11:30:26 +01:00
Kubernetes Prow Robot
e2c17c09a4 Merge pull request #125070 from torredil/kublet-vm-race
Ensure volumes are unmounted during graceful node shutdown
2024-10-02 00:33:48 +01:00
carlory
4c913a86ea Fix close of closed channel in Test_Run_Positive_VolumeMountControllerAttachEnabledRace 2024-09-29 18:34:35 +08:00
Kubernetes Prow Robot
e34f7f4d80 Merge pull request #127671 from mmorel-35/testify/error-contains
fix: use `ErrorContains(t, err` instead of `Contains(t, err.Error()`
2024-09-28 19:18:01 +01:00
Matthieu MOREL
f736cca0e5 fix: enable expected-actual rule from testifylint in module k8s.io/kubernetes
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-09-27 07:56:31 +02:00
Matthieu MOREL
f777addb05 fix: use ErrorContains(t, err instead of Contains(t, err.Error()
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2024-09-26 22:22:20 +02:00
torredil
b4a21a3e43 Wait for volume teardown during graceful node shutdown
Signed-off-by: torredil <torredil@amazon.com>
2024-09-19 20:39:33 +00:00
Olga Shestopalova
4e91a804f2 check if volume already has mount op in progress before mount/unmount
Signed-off-by: Olga Shestopalova <oshestopalova1@gmail.com>
2024-09-16 10:17:28 -04:00
carlory
8d32f22be4 cleanup after NewVolumeManagerReconstruction is GA 2024-09-05 10:10:07 +08:00
Kubernetes Prow Robot
113b12c6fb Merge pull request #124439 from bells17/csi-translation-lib-structured-and-contextual-logging
Migrate k8s.io/csi-translation-lib/.* to structured logging
2024-08-19 18:13:54 -07:00
Hemant Kumar
97eddc8f65 commiting uncommited changes on 2024-08-14 12:46:00 -0400 2024-08-14 12:46:00 -04:00
Hemant Kumar
99fc7cc7b1 Use new size returned by nodeExpander for recording in ASOW 2024-08-14 09:24:53 -04:00
Luca Berneking
90906ab1ea Reduce memory usage/allocations during wait for volume attachment
After a node restart kubelet tries to (re)attach all volumes to the
pods. We poll the `verifyVolumesMountedFunc` every 300ms to check whether
the mount has succeeded. This function called the
`GetMountedVolumesForPod` function that allocates memory for every
volumes on every pod (`len(asw.attachedVolumes)`). Because this function
is executed for every pod simultaneously, this results in exponential
memory usage and high cpu usage due to garbage collection.
We already know the exact volume names and pod name and are able to
completly remove the slice allocation.

Signed-off-by: Luca Berneking <l.berneking@mittwald.de>
2024-08-07 20:47:58 +02:00
carlory
c4851c64a0 remove volumeoptions from VolumePlugin and BlockVolumePlugin 2024-07-24 14:07:02 +08:00
Kubernetes Prow Robot
107f621462 Merge pull request #126108 from gnufied/changes-volume-recovery
Reduce state changes when expansion fails and mark certain failures as infeasible
2024-07-23 13:30:56 -07:00
Kubernetes Prow Robot
d7194eb370 Merge pull request #124884 from carlory/report-event-when-kubelet-attach-failed
report an event to pod if kubelet does attach operation failed
2024-07-23 09:20:43 -07:00
bells17
1298c8a5fe csi-translation-lib: Support structured and contextual logging 2024-07-18 14:01:27 +09:00
Hemant Kumar
c8d9863a3e Add new type for infeasible errors 2024-07-15 10:14:57 -04:00
Hemant Kumar
cbda088905 Add functions for storing volume as failed with final error 2024-07-12 15:14:46 -04:00
Matthieu MOREL
f014b754fb fix: enable empty and len rules from testifylint on pkg package
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>

Co-authored-by: Patrick Ohly <patrick.ohly@intel.com>
2024-07-06 23:15:43 +00:00
胡玮文
7f7d720a7d kubelet/volumemanager: simplify GetVolumesInUse
remove the map[v1.UniqueVolumeName]bool allocation
and also accelerate this func.
2024-06-15 11:37:06 +08:00
胡玮文
93cdd08dcd kubelet/volumemanager: cleanups sort
simplify some usage to sets.Set.
use slices.Sort instead of sort.Strings, as of Go 1.22, the former simply calls latter.
2024-06-15 11:36:02 +08:00
Kubernetes Prow Robot
a8d51f4f05 Use a generic Set instead of a specified Set in kubelet
Signed-off-by: bzsuni <bingzhe.sun@daocloud.io>
2024-06-04 14:25:43 +08:00
Kubernetes Prow Robot
6d0aab2e38 Merge pull request #125014 from carlory/fix-120287
Remove volumesNeedReportedInUse for reconstructed volumes
2024-05-31 05:32:24 -07:00
carlory
2491560ae5 Remove volumesNeedReportedInUse for reconstructed volumes 2024-05-21 18:23:12 +08:00
carlory
02b158055d report an event if kubelet does attach operation failed when kubelet is running with --enable-controller-attach-detach=false 2024-05-15 18:40:29 +08:00
bells17
8cf18d1b5c [pkg/volume] Changed to use sets.Set[string] instead of sets.String 2024-05-11 18:02:45 +09:00
Marek Siarkowicz
3ee8178768 Cleanup defer from SetFeatureGateDuringTest function call 2024-04-24 20:25:29 +02:00
Kubernetes Prow Robot
9c9a9b7c48 Merge pull request #124242 from carlory/cleanup-after-NewVolumeManagerReconstruction-ga
remove unneeded func SyncReconstructedVolume from ActualStateOfWorld
2024-04-18 03:24:50 -07:00