mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Remove support for previously deprecated nodeExpand call
between staging and publish
This commit is contained in:
parent
c571ebed14
commit
e24219d27b
@ -114,10 +114,6 @@ type csiDriverClient struct {
|
|||||||
|
|
||||||
type csiResizeOptions struct {
|
type csiResizeOptions struct {
|
||||||
volumeID string
|
volumeID string
|
||||||
// volumePath is path where volume is available. It could be:
|
|
||||||
// - path where node is staged if NodeExpandVolume is called after NodeStageVolume
|
|
||||||
// - path where volume is published if NodeExpandVolume is called after NodePublishVolume
|
|
||||||
// DEPRECATION NOTICE: in future NodeExpandVolume will be always called after NodePublish
|
|
||||||
volumePath string
|
volumePath string
|
||||||
stagingTargetPath string
|
stagingTargetPath string
|
||||||
fsType string
|
fsType string
|
||||||
|
@ -82,20 +82,6 @@ func (c *csiPlugin) nodeExpandWithClient(
|
|||||||
return false, fmt.Errorf("Expander.NodeExpand found CSI plugin %s/%s to not support node expansion", c.GetPluginName(), driverName)
|
return false, fmt.Errorf("Expander.NodeExpand found CSI plugin %s/%s to not support node expansion", c.GetPluginName(), driverName)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether "STAGE_UNSTAGE_VOLUME" is set
|
|
||||||
stageUnstageSet, err := csClient.NodeSupportsStageUnstage(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return false, fmt.Errorf("Expander.NodeExpand failed to check if plugins supports stage_unstage %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// if plugin does not support STAGE_UNSTAGE but CSI volume path is staged
|
|
||||||
// it must mean this was placeholder staging performed by k8s and not CSI staging
|
|
||||||
// in which case we should return from here so as volume can be node published
|
|
||||||
// before we can resize
|
|
||||||
if !stageUnstageSet && resizeOptions.CSIVolumePhase == volume.CSIVolumeStaged {
|
|
||||||
return false, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
pv := resizeOptions.VolumeSpec.PersistentVolume
|
pv := resizeOptions.VolumeSpec.PersistentVolume
|
||||||
if pv == nil {
|
if pv == nil {
|
||||||
return false, fmt.Errorf("Expander.NodeExpand failed to find associated PersistentVolume for plugin %s", c.GetPluginName())
|
return false, fmt.Errorf("Expander.NodeExpand failed to find associated PersistentVolume for plugin %s", c.GetPluginName())
|
||||||
|
@ -634,7 +634,6 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
|
|||||||
klog.InfoS(volumeToMount.GenerateMsgDetailed("MountVolume.WaitForAttach succeeded", fmt.Sprintf("DevicePath %q", devicePath)), "pod", klog.KObj(volumeToMount.Pod))
|
klog.InfoS(volumeToMount.GenerateMsgDetailed("MountVolume.WaitForAttach succeeded", fmt.Sprintf("DevicePath %q", devicePath)), "pod", klog.KObj(volumeToMount.Pod))
|
||||||
}
|
}
|
||||||
|
|
||||||
var resizeDone bool
|
|
||||||
var resizeError error
|
var resizeError error
|
||||||
resizeOptions := volume.NodeResizeOptions{
|
resizeOptions := volume.NodeResizeOptions{
|
||||||
DevicePath: devicePath,
|
DevicePath: devicePath,
|
||||||
@ -674,35 +673,8 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
|
|||||||
eventErr, detailedErr := volumeToMount.GenerateError("MountVolume.MarkDeviceAsMounted failed", markDeviceMountedErr)
|
eventErr, detailedErr := volumeToMount.GenerateError("MountVolume.MarkDeviceAsMounted failed", markDeviceMountedErr)
|
||||||
return volumetypes.NewOperationContext(eventErr, detailedErr, migrated)
|
return volumetypes.NewOperationContext(eventErr, detailedErr, migrated)
|
||||||
}
|
}
|
||||||
|
// set staging path for volume expansion
|
||||||
// If volume expansion is performed after MountDevice but before SetUp then
|
|
||||||
// deviceMountPath and deviceStagePath is going to be the same.
|
|
||||||
// Deprecation: Calling NodeExpandVolume after NodeStage/MountDevice will be deprecated
|
|
||||||
// in a future version of k8s.
|
|
||||||
resizeOptions.DeviceMountPath = deviceMountPath
|
|
||||||
resizeOptions.DeviceStagePath = deviceMountPath
|
resizeOptions.DeviceStagePath = deviceMountPath
|
||||||
resizeOptions.CSIVolumePhase = volume.CSIVolumeStaged
|
|
||||||
|
|
||||||
// NodeExpandVolume will resize the file system if user has requested a resize of
|
|
||||||
// underlying persistent volume and is allowed to do so.
|
|
||||||
resizeDone, resizeError = og.nodeExpandVolume(volumeToMount, actualStateOfWorld, resizeOptions)
|
|
||||||
|
|
||||||
if resizeError != nil {
|
|
||||||
klog.Errorf("MountVolume.NodeExpandVolume failed with %v", resizeError)
|
|
||||||
|
|
||||||
// Resize failed. To make sure NodeExpand is re-tried again on the next attempt
|
|
||||||
// *before* SetUp(), mark the mounted device as uncertain.
|
|
||||||
markDeviceUncertainErr := actualStateOfWorld.MarkDeviceAsUncertain(
|
|
||||||
volumeToMount.VolumeName, devicePath, deviceMountPath)
|
|
||||||
if markDeviceUncertainErr != nil {
|
|
||||||
// just log, return the resizeError error instead
|
|
||||||
klog.InfoS(volumeToMount.GenerateMsgDetailed(
|
|
||||||
"MountVolume.MountDevice failed to mark volume as uncertain",
|
|
||||||
markDeviceUncertainErr.Error()), "pod", klog.KObj(volumeToMount.Pod))
|
|
||||||
}
|
|
||||||
eventErr, detailedErr := volumeToMount.GenerateError("MountVolume.MountDevice failed while expanding volume", resizeError)
|
|
||||||
return volumetypes.NewOperationContext(eventErr, detailedErr, migrated)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Execute mount
|
// Execute mount
|
||||||
@ -740,11 +712,6 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
|
|||||||
resizeOptions.DeviceMountPath = volumeMounter.GetPath()
|
resizeOptions.DeviceMountPath = volumeMounter.GetPath()
|
||||||
resizeOptions.CSIVolumePhase = volume.CSIVolumePublished
|
resizeOptions.CSIVolumePhase = volume.CSIVolumePublished
|
||||||
|
|
||||||
// We need to call resizing here again in case resizing was not done during device mount. There could be
|
|
||||||
// two reasons of that:
|
|
||||||
// - Volume does not support DeviceMounter interface.
|
|
||||||
// - In case of CSI the volume does not have node stage_unstage capability.
|
|
||||||
if !resizeDone {
|
|
||||||
_, resizeError = og.nodeExpandVolume(volumeToMount, actualStateOfWorld, resizeOptions)
|
_, resizeError = og.nodeExpandVolume(volumeToMount, actualStateOfWorld, resizeOptions)
|
||||||
if resizeError != nil {
|
if resizeError != nil {
|
||||||
klog.Errorf("MountVolume.NodeExpandVolume failed with %v", resizeError)
|
klog.Errorf("MountVolume.NodeExpandVolume failed with %v", resizeError)
|
||||||
@ -759,7 +726,6 @@ func (og *operationGenerator) GenerateMountVolumeFunc(
|
|||||||
}
|
}
|
||||||
return volumetypes.NewOperationContext(eventErr, detailedErr, migrated)
|
return volumetypes.NewOperationContext(eventErr, detailedErr, migrated)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// record total time it takes to mount a volume. This is end to end time that includes waiting for volume to attach, node to be update
|
// record total time it takes to mount a volume. This is end to end time that includes waiting for volume to attach, node to be update
|
||||||
// plugin call to succeed
|
// plugin call to succeed
|
||||||
|
Loading…
Reference in New Issue
Block a user