-
Notifications
You must be signed in to change notification settings - Fork 39.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enables resizing of block volumes. #81429
Enables resizing of block volumes. #81429
Conversation
Hi @huffmanca. Thanks for your PR. I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/ok-to-test |
if !fsVolume { | ||
klog.V(5).Infof("Block mode volume needn't to check file system resize request") | ||
return | ||
} | ||
if processedVolumesForFSResize.Has(string(uniqueVolumeName)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to be on safe side, for in-tree drivers I think we should still skip calling fs resize on the node if volume is of type raw block.
The other thing is - we are going to need some e2e tests for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if migration is enabled?
in-tree: no Pending condition on PVC if mode Block
CSI: always Pending condition on PVC
migrated CSI: ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our e2e test expects that Block volumes don't get the condition
https://github.com/kubernetes/kubernetes/blob/master/test/e2e/storage/testsuites/volume_expand.go#L190
I'm running the tests for aws migration.
So the test needs to know if the plugin is CSI or in-tree or migrated CSI which will be ugly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That e2e is broken for CSI raw block volumes, no matter what we do here right? Plugin already knows if it is CSI or in-tree. I guess in-tree migrated CSI is tricky. But I think this ugliness will go away once we merge - container-storage-interface/spec#381
So our options are:
- Keep in-tree drivers behaviour same as CSI, but since in CSI too we are moving towards skipping
NodeExpandVolume
for raw block devices, this seems like a step backward and will cause unnecessary churn. - Live with ugliness in e2e until we Add volume capability to volume expansion calls container-storage-interface/spec#381 is merged and fix the in-tree <-> csi drivers.
I am leaning towards #2. And yeah - I think we should not skip calling fs resize if driver is in-tree but migration is enabled for it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have opened #81611 to fix this problem. I think the condition checking there added very little value.
/sig storage |
/assign |
694a0b7
to
31f65fb
Compare
} | ||
|
||
e1, e2 := expandVolumeFunc.OperationFunc() | ||
if e1 != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be written as one line:
if e1 != nil || e2 != nil {
t.Fatalf("unable to call volume expansion: %v, %v", e1, e2)
}
31f65fb
to
3c41a07
Compare
@@ -1649,7 +1596,7 @@ func (og *operationGenerator) GenerateExpandInUseVolumeFunc( | |||
resizeOptions.DevicePath = volumeToMount.DevicePath | |||
dmp, err := volumeAttacher.GetDeviceMountPath(volumeToMount.VolumeSpec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is definitely the wrong path for a raw block volume. It doesn't even exist.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be fixed now.
/assign |
5c6a793
to
9a42cb9
Compare
Perform a no-op when volume is of type raw block Fix bug with checking volume mounts for readonly
9a42cb9
to
55be1b3
Compare
/retest |
03ac9fd
to
d62d8e8
Compare
/assign @msau42 |
if processedVolumesForFSResize.Has(string(uniqueVolumeName)) { | ||
// File system resize operation is a global operation for volume, | ||
// so we only need to check it once if more than one pod use it. | ||
return | ||
} | ||
if mountedReadOnlyByPod(podVolume, pod) { | ||
// We need to be consistent with what we check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this a todo? I don't understand the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a todo. I was just saying - the check we were doing here was overly complex. We should use same value that we use for deciding whether to format the disk and when calling resize during mount process. There is no need for online resizing to check containers etc. I will reword this though.
if processedVolumesForFSResize.Has(string(uniqueVolumeName)) { | ||
// File system resize operation is a global operation for volume, | ||
// so we only need to check it once if more than one pod use it. | ||
return | ||
} | ||
if mountedReadOnlyByPod(podVolume, pod) { | ||
// We need to be consistent with what we check. | ||
if volumeSpec.ReadOnly { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we pass readonly down to the plugin and let the plugin decide if resize should be skipped? Or actually let it fail? What does it mean to resize a read only volume?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah that is a good idea and ties into discussion we had this yesterday in CSI spec meeting. Currently NodeExpandVolumeRequest
can't carry over that information and @bswartz wanted readonly volumes to be expandable on nodes too. In his case - all the plugin would do is, rescan iscsi lun.
I think, we should not be making that change right now in this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if volumeSpec.ReadOnly is sufficient enough, or do we also need to be checking container readonly too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The other question I have is more philosophical. If a user requests expansion on a read-only volume, should we actually ignore it and return success? We didn't actually expand the filesystem to what they requested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For CSI - in the long run we want the decision to be taken by the plugin(SP) and not the CO. For in-tree implementations we currently support, doing resizing of readonly volumes with filesystem on it - could result in filesystem corruption.
I'm wondering if volumeSpec.ReadOnly is sufficient enough, or do we also need to be checking container readonly too?
The container readonly is handled by CRI and is an option for bind mount. I think checking volumeSpec.Readonly
should be sufficient for our use case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the resizing attempt fail if the volume is attached/mounted as read only?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In many cases - expanding the filesystem does not care how volume is mounted. Expanding(resize2fs/xfsgrow) the volume sometimes just takes device path (not the mount path).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the PV.readOnly field is only used for determining if volumes should be attached readonly: #70505
Is that the only readOnly setting you want to skip here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes - so attached as ReadOnly
and mounted(NodePublished) as ReadOnly
are two different things. Reading the linked issue, it seems like we are not setting PersistentVolume.spec.CSIPersistentVolumeSource.readOnly
anywhere but once we do - this code should be updated to respect that and not resize a readonly attached volume.
Again this is with the caveat that - once we have option to pass ReadOnly
to NodeExpandRequest
- we will have to update the call to pass it as a flag and let SP decide, how best to handle it.
/retest |
d62d8e8
to
9dbe0b3
Compare
Okay this patch works for me. All flavors of resize are successful. I haven't tried multi attached resize yet, I expect that to fail still, but this is good to merge IMO. |
/retest |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: huffmanca, msau42 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest |
Enables resizing of block volumes.
What type of PR is this?
/kind bug
What this PR does / why we need it:
Fixes #79990
Special notes for your reviewer:
Does this PR introduce a user-facing change?: