Skip to content

Commit c95dd85

Browse files
authored
Merge pull request kubernetes#127396 from olyazavr/no-dupe-mount-unmount
check if volume already has mount op in progress before mount/unmount
2 parents 6df3b28 + 4e91a80 commit c95dd85

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/kubelet/volumemanager/reconciler/reconciler_common.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ type reconciler struct {
147147
func (rc *reconciler) unmountVolumes() {
148148
// Ensure volumes that should be unmounted are unmounted.
149149
for _, mountedVolume := range rc.actualStateOfWorld.GetAllMountedVolumes() {
150+
if rc.operationExecutor.IsOperationPending(mountedVolume.VolumeName, mountedVolume.PodName, nestedpendingoperations.EmptyNodeName) {
151+
continue
152+
}
150153
if !rc.desiredStateOfWorld.PodExistsInVolume(mountedVolume.PodName, mountedVolume.VolumeName, mountedVolume.SELinuxMountContext) {
151154
// Volume is mounted, unmount it
152155
klog.V(5).InfoS(mountedVolume.GenerateMsgDetailed("Starting operationExecutor.UnmountVolume", ""))
@@ -165,6 +168,9 @@ func (rc *reconciler) unmountVolumes() {
165168
func (rc *reconciler) mountOrAttachVolumes() {
166169
// Ensure volumes that should be attached/mounted are attached/mounted.
167170
for _, volumeToMount := range rc.desiredStateOfWorld.GetVolumesToMount() {
171+
if rc.operationExecutor.IsOperationPending(volumeToMount.VolumeName, nestedpendingoperations.EmptyUniquePodName, nestedpendingoperations.EmptyNodeName) {
172+
continue
173+
}
168174
volMounted, devicePath, err := rc.actualStateOfWorld.PodExistsInVolume(volumeToMount.PodName, volumeToMount.VolumeName, volumeToMount.DesiredPersistentVolumeSize, volumeToMount.SELinuxLabel)
169175
volumeToMount.DevicePath = devicePath
170176
if cache.IsSELinuxMountMismatchError(err) {

0 commit comments

Comments
 (0)