Skip to content

Commit 9dbe0b3

Browse files
committed
Fix devicePath for raw block expansion
Fix tests
1 parent 7a4cdf5 commit 9dbe0b3

File tree

6 files changed

+319
-214
lines changed

6 files changed

+319
-214
lines changed

pkg/kubelet/volumemanager/populator/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ go_library(
1111
srcs = ["desired_state_of_world_populator.go"],
1212
importpath = "k8s.io/kubernetes/pkg/kubelet/volumemanager/populator",
1313
deps = [
14-
"//pkg/api/v1/pod:go_default_library",
1514
"//pkg/features:go_default_library",
1615
"//pkg/kubelet/config:go_default_library",
1716
"//pkg/kubelet/container:go_default_library",

pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,10 @@ func (dswp *desiredStateOfWorldPopulator) checkVolumeFSResize(
388388
// so we only need to check it once if more than one pod use it.
389389
return
390390
}
391-
if mountedReadOnlyByPod(podVolume, pod) {
391+
// volumeSpec.ReadOnly is the value that determines if volume could be formatted when being mounted.
392+
// This is the same flag that determines filesystem resizing behaviour for offline resizing and hence
393+
// we should use it here. This value comes from Pod.spec.volumes.persistentVolumeClaim.readOnly.
394+
if volumeSpec.ReadOnly {
392395
// This volume is used as read only by this pod, we don't perform resize for read only volumes.
393396
klog.V(5).Infof("Skip file system resize check for volume %s in pod %s/%s "+
394397
"as the volume is mounted as readonly", podVolume.Name, pod.Namespace, pod.Name)
@@ -400,13 +403,6 @@ func (dswp *desiredStateOfWorldPopulator) checkVolumeFSResize(
400403
processedVolumesForFSResize.Insert(string(uniqueVolumeName))
401404
}
402405

403-
func mountedReadOnlyByPod(podVolume v1.Volume, pod *v1.Pod) bool {
404-
if podVolume.PersistentVolumeClaim.ReadOnly {
405-
return true
406-
}
407-
return false
408-
}
409-
410406
func getUniqueVolumeName(
411407
podName volumetypes.UniquePodName,
412408
outerVolumeSpecName string,

0 commit comments

Comments
 (0)