-
Notifications
You must be signed in to change notification settings - Fork 39.3k
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
CSI volume expansion #74863
CSI volume expansion #74863
Conversation
6f3b3cc
to
5c502ee
Compare
/kind feature |
5c502ee
to
159b6b9
Compare
) | ||
|
||
func (c *csiPlugin) RequiresFSResize() bool { | ||
// We could check plugin's node capability but we instead are going to rely on |
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 different from how we implement skip attach. Can we be consistent in how we check a plugin's capability?
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.
But CanAttach
check depends on CSIDriver field too right? Whereas this check is more static. I do not like changing the behaviour of FindByXXX
function fwiw depending on feature tags and other dynamic things.
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.
maybe we should consider changing skipAttach then (separately) cc @jsafrane
|
||
fsResizeFunc := func() (error, error) { | ||
_, resizeError := og.resizeFileSystem(volumeToMount, volumeToMount.DevicePath, deviceMountPath, volumePlugin.GetPluginName()) | ||
if attachableVolumePlugin != 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.
Are device mountable plugins supported here? (doesn't support attach but does support global device mount)
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.
could use some unit tests 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.
The only volume type that is not attachable but implements device mountable interface is local storage. So for in-tree volumes this check should be good.
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.
Also if CSI plugin is not attachable but supports node expansion, it should be resized after node publish and hence we should be covered there too.
name: external-resizer-cfg | ||
rules: | ||
- apiGroups: [""] | ||
resources: ["endpoints"] |
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.
we're trying to get all new components to use the Lease mechanism for leader election, not endpoints. cc @andrewsykim
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.
We don't use this rbac permission in e2e btw because our e2es run without leader election in external-resizer. The same applies to other sidecar containers too. I have kept it here just to have same version between here and external-resizer repo.
The vast majority of changes here are pkg/volume or test/e2e/storage - i think it's flyable. vendor change LGTM |
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.
There are few changes to common code. The majority of functional changes are adding functionality to the CSI package and that functionality flag gated and off by default since this is an alpha feature.
/lgtm
/approve
@@ -676,15 +700,15 @@ func (og *operationGenerator) GenerateMountVolumeFunc( | |||
} | |||
} | |||
|
|||
func (og *operationGenerator) resizeFileSystem(volumeToMount VolumeToMount, devicePath, deviceMountPath, pluginName string) (simpleErr, detailedErr error) { | |||
func (og *operationGenerator) resizeFileSystem(volumeToMount VolumeToMount, rsOpts volume.NodeResizeOptions, pluginName string) (bool, error) { |
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.
nit: put a comment explaining what the expected values are that are returned 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.
I will follow up this in a follow up.
/hold cancel |
/assign @smarterclayton |
approving vendor change as per sig and other leads /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gnufied, msau42, saad-ali, smarterclayton 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 |
Handle resize error in online resizing Use NodeExpandable plugin to mark volumes that require node expansion
Update CSI library version
This enables us to pass CSI volume phase
Add some tests for checking node expansion Add new tests for expander
4582623
to
1bd9ed0
Compare
/lgtm |
} | ||
|
||
if newSize.Value() < 0 { | ||
return newSize, errors.New("size can not be less than 0") |
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.
It would be helpful to include the negative value in the message
if err != nil { | ||
return newSize, err | ||
} | ||
updatedQuantity := resource.NewQuantity(resp.CapacityBytes, resource.BinarySI) |
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.
Do we need to check that updatedQuantity is not nil?
} | ||
for _, capability := range capabilities { | ||
if capability.GetRpc().GetType() == csipbv1.NodeServiceCapability_RPC_EXPAND_VOLUME { | ||
nodeExpandSet = true |
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.
We can break out of the loop here
Created #75203 for the last comment above. |
This cherry-picks the [74863](kubernetes#74863) and allows us to use CSI volume expansion This involves the following commits: ``` 63eb25e Introduce feature gate for volume expansion 89d1de9 Rename ExandFS to NodeExpand 529cd71 Move resize function parameters to a new ResizeOptions type a8f3187 Add CSI volume resizing tests 1bd9ed0 Update csi library version ```
Add support for CSI volume expansion.
Added tests for both online and offline expansion of CSI volumes.
Note to reviewers
Uses https://quay.io/repository/gnufied/external-resizer repo for pulling external-resizer./sig storage
cc @msau42 @jsafrane @mlmhl
xref kubernetes/enhancements#556