-
Notifications
You must be signed in to change notification settings - Fork 40.1k
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
Use zone from node for topology aware aws-ebs volume creation #78276
Conversation
Hi @zhan849. 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 |
pkg/volume/awsebs/aws_util.go
Outdated
@@ -125,6 +128,39 @@ func (util *AWSDiskUtil) CreateVolume(c *awsElasticBlockStoreProvisioner, node * | |||
return name, volumeOptions.CapacityGB, labels, fstype, nil | |||
} | |||
|
|||
// getCandidateZones finds possible zones that a volume can be created in | |||
func getCandidateZones(cloud *aws.Cloud, selectedNode *v1.Node, pvcName string) (sets.String, 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.
Lets add some unit tests if we can...
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 couldn't find a good way to mock aws.Cloud
outside its package, so only added test cases for delayed binding test case. It's probably cloud provider's responsibility to provide reasonable mocks so I left a TODO here. please 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.
I think that is fine. GetCandidateZonesForDynamicVolume
should already be considered "tested".
110f089
to
5a70ddf
Compare
/retest |
5a70ddf
to
7a4784e
Compare
/retest |
1 similar comment
/retest |
Looks good to me. This code change should be fairly innocuous to land in. But I would wait for @jsafrane and @leakingtapan too. Will remove the hold once it has been reviewed by either of these folks. /lgtm |
}, | ||
}, | ||
}, | ||
expectedZones: sets.NewString(), |
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 tests don't seem to be useful to me if they check the zones to be empty.
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 reasoning here for the function is - if we have a selected node, there should not be a "candidate zone" returned, and if not (bind immediately), we should compute candidate zone. once we have better way to mock aws cloud provider, we need to add other test cases.
Or since the logic is rather simple, I can remove the added helper and combine the logic in CreateVolume
so we can remove the test. What do you think?
7a4784e
to
90eb408
Compare
/retest |
2 similar comments
/retest |
/retest |
/lgtm |
/hold cancel |
/assign @jsafrane @leakingtapan |
@jsafrane I think this should be good to go. Can you approve? |
I think the PR is OK, just the unit test does not seem to be really useful. On the other hand, it fits well the rest of the AWS provider :-) /approve This is a bug fix, trying to squeeze into 1.15. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jsafrane, zhan849 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 |
Thanks @jsafrane for milestone 1.15, do I need to send out PR for cherry-pick or there will be an automatic process for this? |
It has been merged to master, AFAIK it should get promoted to 1.15 branch automatically (if it is not there yet). |
What type of PR is this?
/kind bug
What this PR does / why we need it:
For topology aware (
WaitForFirstConsumer
) volume provisioning, node is already selected when we call cloud provider to create the volume. In aws-ebs volume provisioner, we currently still list ec2 instances for getting candidate zones, which is inefficient and redundant.This PR keeps same behavior for volumes that need to bind immediately, but use zone info from bound node for topology aware volumes. If node for some reason does not have zone info recorded (which is unexpected), we double check with cloud provider.
With some 50pvc batch provisioning banchmark, this optimization can reduce 75% DescribeInstances calls, and reduce 50% peak QPS.
Which issue(s) this PR fixes:
Fixes #76975
Special notes for your reviewer:
This issue is also being discussed in #78199 and #76976 , as reducing cloud provider calls is anyway necessary for optimizing topo aware volume provisioning code path, and whether and how to optimize finding zone for bind immediately volumes can be an orthogonal problem.
Does this PR introduce a user-facing change?:
No
Release Note:
/sig storage aws scalability
/priority important-soon
/cc @msau42 @gnufied @liggitt @smarterclayton @mcrute