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

Add max number of volumes that can be attached to an instance #289

Merged
merged 2 commits into from
May 11, 2019

Conversation

bertinatto
Copy link
Member

@bertinatto bertinatto commented May 3, 2019

Is this a bug fix or adding new feature?

/king feature

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

Without having this field set, k8s will interpret that the node can handle any amount of volumes. I'll create an issue to customize this number per instance type.

Closes #39

/assign @leakingtapan

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 3, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bertinatto

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 3, 2019
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label May 3, 2019
@coveralls
Copy link

coveralls commented May 3, 2019

Pull Request Test Coverage Report for Build 617

  • 13 of 15 (86.67%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 69.531%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/cloud/metadata.go 5 7 71.43%
Totals Coverage Status
Change from base Build 614: 0.2%
Covered Lines: 979
Relevant Lines: 1408

💛 - Coveralls


// maxVolumesPerNode is the maximum number of volumes that an AWS instance can have attached.
// More info at https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/volume_limits.html
maxVolumesPerNode = 39
Copy link
Contributor

Choose a reason for hiding this comment

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

Since NVME volume only allow 28 attachment, and some instance type has EBS as default volume. Feels its safer to set the value to 27 to begin with to accommodate worse case.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added some logic to return the volumes limit based on the instance type.

Copy link
Member Author

Choose a reason for hiding this comment

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

PTAL and let me know if it makes sense.

@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 5, 2019
func (d *nodeService) getVolumesLimit() int64 {
ebsNitroInstanceTypeRegex := "^[cmr]5.*|t3|z1d"
instanceType := d.metadata.GetInstanceType()
if ok, _ := regexp.MatchString(ebsNitroInstanceTypeRegex, instanceType); ok {
Copy link
Contributor

Choose a reason for hiding this comment

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

Feels its less error prune if we just maintain a hard coded list of nitro instance instead of regex. And define a function that checks if it is nitro based:

func isNitroInstance(instanceType string) boolean 

How do you think?

See https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#ec2-nitro-instances for a full list of Nitro instances.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm OK with that, but I'm not sure if I understand that page well enough to come up with a reliable list. If nothing, the regex above comes from the in-tree implementation, so it seems to be a reasonable good start.

@leakingtapan
Copy link
Contributor

Since the implementation aligns with in-tree implementation, let's merged it in. And we could refactor both later.

/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 11, 2019
@k8s-ci-robot k8s-ci-robot merged commit 6a79b78 into kubernetes-sigs:master May 11, 2019
@ayberk ayberk mentioned this pull request Feb 5, 2021
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.

Populate MaxVolumesPerNode in NodeGetInfoResponse
4 participants