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

Use zone from node for topology aware aws-ebs volume creation #78276

Merged
merged 1 commit into from
Jun 1, 2019

Conversation

zhan849
Copy link
Contributor

@zhan849 zhan849 commented May 24, 2019

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:

Use zone from node for topology aware aws-ebs volume creation to reduce unnecessary cloud provider calls

/sig storage aws scalability
/priority important-soon
/cc @msau42 @gnufied @liggitt @smarterclayton @mcrute

@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label May 24, 2019
@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label May 24, 2019
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. sig/storage Categorizes an issue or PR as relevant to SIG Storage. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 24, 2019
@k8s-ci-robot
Copy link
Contributor

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 /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 24, 2019
@zhan849 zhan849 changed the title Use zone from node for topology aware volume creation Use zone from node for topology aware aws-ebs volume creation May 24, 2019
@gnufied
Copy link
Member

gnufied commented May 24, 2019

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. sig/aws sig/scalability Categorizes an issue or PR as relevant to SIG Scalability. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 24, 2019
@@ -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) {
Copy link
Member

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...

Copy link
Contributor Author

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

Copy link
Member

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".

@zhan849 zhan849 force-pushed the ebs-get-zone-opt1 branch 2 times, most recently from 110f089 to 5a70ddf Compare May 24, 2019 21:25
@zhan849
Copy link
Contributor Author

zhan849 commented May 24, 2019

/retest

@zhan849 zhan849 force-pushed the ebs-get-zone-opt1 branch from 5a70ddf to 7a4784e Compare May 24, 2019 22:47
@zhan849
Copy link
Contributor Author

zhan849 commented May 24, 2019

/retest

1 similar comment
@zhan849
Copy link
Contributor Author

zhan849 commented May 25, 2019

/retest

@gnufied
Copy link
Member

gnufied commented May 26, 2019

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
/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 26, 2019
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 26, 2019
pkg/volume/awsebs/aws_util.go Outdated Show resolved Hide resolved
},
},
},
expectedZones: sets.NewString(),
Copy link
Member

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.

Copy link
Contributor Author

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?

@zhan849 zhan849 force-pushed the ebs-get-zone-opt1 branch from 7a4784e to 90eb408 Compare May 28, 2019 00:14
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 28, 2019
@zhan849
Copy link
Contributor Author

zhan849 commented May 28, 2019

/retest

2 similar comments
@zhan849
Copy link
Contributor Author

zhan849 commented May 28, 2019

/retest

@zhan849
Copy link
Contributor Author

zhan849 commented May 28, 2019

/retest

@gnufied
Copy link
Member

gnufied commented May 30, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 30, 2019
@gnufied
Copy link
Member

gnufied commented May 30, 2019

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 30, 2019
@gnufied
Copy link
Member

gnufied commented May 30, 2019

/assign @jsafrane @leakingtapan

@gnufied
Copy link
Member

gnufied commented May 30, 2019

@jsafrane I think this should be good to go. Can you approve?

@jsafrane
Copy link
Member

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.

@jsafrane jsafrane added this to the v1.15 milestone May 31, 2019
@k8s-ci-robot
Copy link
Contributor

[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 /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 May 31, 2019
@k8s-ci-robot k8s-ci-robot merged commit f14b128 into kubernetes:master Jun 1, 2019
@zhan849
Copy link
Contributor Author

zhan849 commented Jun 3, 2019

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.

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?

@jsafrane
Copy link
Member

jsafrane commented Jun 4, 2019

It has been merged to master, AFAIK it should get promoted to 1.15 branch automatically (if it is not there yet).

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. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/scalability Categorizes an issue or PR as relevant to SIG Scalability. sig/storage Categorizes an issue or PR as relevant to SIG Storage. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Inefficient GetCandidateZonesForDynamicVolume impl caused aws api call throttling
5 participants