Fix resizing of ephemeral volumes

This commit is contained in:
Hemant Kumar 2022-05-11 15:06:42 -04:00
parent c0f48d2a2e
commit a5c961f4a8

View File

@ -343,10 +343,14 @@ func (dswp *desiredStateOfWorldPopulator) checkVolumeFSResize(
volumeSpec *volume.Spec,
uniquePodName volumetypes.UniquePodName,
mountedVolumesForPod map[volumetypes.UniquePodName]map[string]cache.MountedVolume) {
if podVolume.PersistentVolumeClaim == nil || pvc == nil {
// if a volumeSpec does not have PV or has InlineVolumeSpecForCSIMigration set or pvc is nil
// we can't resize the volume and hence resizing should be skipped.
if volumeSpec.PersistentVolume == nil || volumeSpec.InlineVolumeSpecForCSIMigration || pvc == nil {
// Only PVC supports resize operation.
return
}
uniqueVolumeName, exist := getUniqueVolumeName(uniquePodName, podVolume.Name, mountedVolumesForPod)
if !exist {
// Volume not exist in ASW, we assume it hasn't been mounted yet. If it needs resize,