Skip to content
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

Do not call ModifyVolume if the volume is already in the desired state #1741

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

ConnorJC3
Copy link
Contributor

Is this a bug fix or adding new feature?

Bug fix

What is this PR about? / Why do we need it?

Today, the EBS CSI Driver will call ModifyVolume in cases when the volume is already in the desired state (which will trigger a modification in EBS). This PR changes the behavior so that the driver instantly reports a success in the case that the volume already matches the desired state.

What testing is done?

Added unit tests, Manual

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 13, 2023
}

// Perform one final check on the volume
return c.checkDesiredState(ctx, volumeID, newSizeGiB, options)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dumb Q: Is the extra trip to EC2 API worth it? What is being checked here that wasn't checked earlier?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you look at the checkDesiredState function, there is a comment above it explaining the potential eventual consistency concerns the previous maintainers implemented it for.

Even if it really isn't necessary, I don't think this PR is the appropriate place to be tearing out such a check.

@ConnorJC3 ConnorJC3 force-pushed the modifyvolume-fix branch 2 times, most recently from 2ad0f0c to 515b4e6 Compare September 13, 2023 19:09
pkg/cloud/cloud.go Show resolved Hide resolved
return oldSizeGiB, nil
realSizeGiB := aws.Int64Value(volume.Size)

if realSizeGiB < desiredSizeGiB {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: This chunk was a bit hard to read on first glance, could you add a comment or refactor this into a helper function?

Something Like "modifyVolumeIdempotencyCheck"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that already what this function is? I don't think making a function that will never be reused is a good idea, I'll go with your second suggestion and add a comment unless there are other objections.

@AndrewSirenko
Copy link
Contributor

Great extra unit tests cases, thank you @ConnorJC3!

@ConnorJC3 ConnorJC3 force-pushed the modifyvolume-fix branch 2 times, most recently from 95b4241 to b2f8d53 Compare September 13, 2023 19:28
Copy link
Member

@torredil torredil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some questions and a few minor things but otherwise lgtm, thanks.

pkg/cloud/cloud.go Outdated Show resolved Hide resolved
pkg/cloud/cloud.go Show resolved Hide resolved
pkg/cloud/cloud.go Outdated Show resolved Hide resolved
pkg/cloud/cloud.go Show resolved Hide resolved
@torredil
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 14, 2023
@AndrewSirenko
Copy link
Contributor

/lgtm

@AndrewSirenko
Copy link
Contributor

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AndrewSirenko

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 14, 2023
@k8s-ci-robot
Copy link
Contributor

@ConnorJC3: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-aws-ebs-csi-driver-test-e2e-external-eks-windows 0a1b70c link unknown /test pull-aws-ebs-csi-driver-test-e2e-external-eks-windows

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@ConnorJC3
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot merged commit f79b606 into kubernetes-sigs:master Sep 14, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants