-
Notifications
You must be signed in to change notification settings - Fork 813
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
delete leaked volume if driver don't know the volume status #771
delete leaked volume if driver don't know the volume status #771
Conversation
Hi @AndyXiangLi. Thanks for your PR. I'm waiting for a kubernetes-sigs 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. |
Pull Request Test Coverage Report for Build 1641
💛 - Coveralls |
5bd9df3
to
82a2c99
Compare
82a2c99
to
064215b
Compare
/ok-to-test |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: AndyXiangLi, wongma7 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 |
@@ -194,7 +195,8 @@ func TestCreateDisk(t *testing.T) { | |||
Tags: map[string]string{VolumeNameTagKey: "vol-test"}, | |||
AvailabilityZone: "", | |||
}, | |||
expErr: fmt.Errorf("failed to get an available volume in EC2: timed out waiting for the condition"), | |||
cleanUpFailedVolume: true, | |||
expErr: fmt.Errorf("failed to get an available volume in EC2: timed out waiting for the condition"), |
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 think the test case above (DescribeVolume error ) we should also expect to clean up.
(the test case names are a bit confusing since CreateVolume could mean ec2.createvolume or csi.createvolume. If it helps and you dont mind could you disambiguate them in the test names)
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.
+1
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.
updated
@@ -343,6 +343,13 @@ func (c *cloud) CreateDisk(ctx context.Context, volumeName string, diskOptions * | |||
} | |||
|
|||
if err := c.waitForVolume(ctx, volumeID); err != nil { | |||
// To avoid leaking volume, we should delete the volume just created | |||
// TODO: Need to figure out how to handle DeleteDisk failed scenario instead of just log the error | |||
if _, error := c.DeleteDisk(ctx, volumeID); error != 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.
So delete works if the volume is not available when we make the call?
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, I did a test on my account. One concern here is if the deleteVolume call failed as well then we can not prevent the volume get leaked anyway..
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.
Sure, that makes sense.
064215b
to
5b2faf9
Compare
/lgtm |
Cherry pick upstream fix back to v1.21 |
Is this a bug fix or adding new feature?
Fixes #754
What is this PR about? / Why do we need it?
Delete volume if the driver don't know about the volume status after creation
What testing is done?
Could see this log after denying DescribeVolume api call manually
volume is deleted because it is not in desired state within retry limit
Added unit test