Skip to content

How to resize a volume with filesystem from cloning? #131

@stoneshi-yunify

Description

@stoneshi-yunify

When cloning a volume from an existing PVC, it's allowed to specify a bigger size for the new PVC, which means clone + resize in one step.

If they're both block volumes, it's possible to do the resize work at the end of CSI call CreateVolume. This is okay.

However, when they're filesystem volumes (volumeMode=Filesystem), I can still do the resize work at the end of CSI call CreateVolume, but I can only resize the volume, not the filesystem in it. The filesystem still has the old size. The filesystem expand work should be done by the kubelet calling the NodeExpandVolume, but how can I let kubelet to do that since I'm in the CSI driver code?

For just expanding volume, the external-resizer will add a status condition FileSystemResizePending for the PVC, so kubelet will call the NodeExpandVolume when the PVC is attached to a pod. Is there is way to add this when cloning volume?

I hope the CSI call ControllerExpandVolume can be invoked automatically in such case.

ps, my csi driver capability:

var DefaultControllerServiceCapability = []csi.ControllerServiceCapability_RPC_Type{
	csi.ControllerServiceCapability_RPC_CREATE_DELETE_VOLUME,
	csi.ControllerServiceCapability_RPC_CREATE_DELETE_SNAPSHOT,
	csi.ControllerServiceCapability_RPC_EXPAND_VOLUME,
	csi.ControllerServiceCapability_RPC_CLONE_VOLUME,
}

var DefaultNodeServiceCapability = []csi.NodeServiceCapability_RPC_Type{
	csi.NodeServiceCapability_RPC_STAGE_UNSTAGE_VOLUME,
	csi.NodeServiceCapability_RPC_EXPAND_VOLUME,
	csi.NodeServiceCapability_RPC_GET_VOLUME_STATS,
}

var DefaultPluginCapability = []*csi.PluginCapability{
	{
		Type: &csi.PluginCapability_Service_{
			Service: &csi.PluginCapability_Service{
				Type: csi.PluginCapability_Service_CONTROLLER_SERVICE,
			},
		},
	},
	{
		Type: &csi.PluginCapability_VolumeExpansion_{
			VolumeExpansion: &csi.PluginCapability_VolumeExpansion{
				Type: csi.PluginCapability_VolumeExpansion_OFFLINE,
			},
		},
	},
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions