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 Network interfaces per Region limit #379

Merged
merged 4 commits into from
Jan 30, 2019

Conversation

nadlerjessie
Copy link
Contributor

@nadlerjessie nadlerjessie commented Jan 29, 2019

Summary

This PR adds the Network interfaces per Region limit. This limit is described here is a bit unusual because the default is:

This limit is the greater of either the default limit (350) or your On-Demand Instance limit multiplied by 5.

I used 350 because that is the initial limit a new account will have, given that the default limit for On-Demand Instances is 20.

I had some trouble getting the docs to build so I did not complete that step (it is the only failure in travis). Sorry about that!

Pull Request Checklist

  • All pull requests should be against the develop branch, not master.
  • All pull requests must include the Contributor License Agreement (see below).
  • Whether or not your PR includes unit tests:
    • Please make sure you have run the exact code contained in the PR locally, and it functions as desired.
    • Please make sure the TravisCI build passes or, if not, you've corrected any obvious problems identified by the tests.
  • Code should conform to the Development Guidelines:
    • pep8 compliant with some exceptions (see pytest.ini)
    • 100% test coverage with pytest (with valid tests). If you have difficulty
      writing tests for the code, that's fine, just mention that in the summary and either
      ask for assistance, or clarify that you'd like someone else to handle the tests. PRs that
      include complete test coverage will usually be merged faster.
    • Complete, correctly-formatted documentation for all classes, functions and methods.
    • documentation has been rebuilt with tox -e docs
    • Connections to the AWS services should only be made by the class's
      connect() and connect_resource() methods, inherited from
      awslimitchecker.connectable.Connectable
    • All modules should have (and use) module-level loggers.
    • Commit messages should be meaningful, and reference the Issue number
      if you're working on a GitHub issue (i.e. "issue #x - "). Please
      refrain from using the "fixes #x" notation unless you are sure that the
      the issue is fixed in that commit.
    • Git history is fully intact; please do not squash or rewrite history.

Contributor License Agreement

By submitting this work for inclusion in awslimitchecker, I agree to the following terms:

  • The contribution included in this request (and any subsequent revisions or versions of it)
    is being made under the same license as the awslimitchecker project (the Affero GPL v3,
    or any subsequent version of that license if adopted by awslimitchecker).
  • My contribution may perpetually be included in and distributed with awslimitchecker; submitting
    this pull request grants a perpetual, global, unlimited license for it to be used and distributed
    under the terms of awslimitchecker's license.
  • I have the legal power and rights to agree to these terms.

@jantman
Copy link
Owner

jantman commented Jan 29, 2019

Thanks so much! And thanks for adding the tests as well!

No worries about the docs build, they're rebuilt as part of the release process anyway.

I have a pretty busy week this week, so I might not be able to get this reviewed, merged, and released until the weekend, but I'll do my best.

@nadlerjessie Just a thought regarding the weird "greater of either the default limit (350) or your On-Demand Instance limit multiplied by 5." calculation for this limit... the DescribeAccountAttributes EC2 API call returns, among other things, the account's current Running On-Demand EC2 Instances limit in the current region. awslimitchecker is already using that to dynamically update the Running On-Demand EC2 limit in _Ec2Service._update_limits_from_api().

Would you have anything wrong with me (or you, if you want) adding some logic to that _update_limits_from_api() method to update this new Network Interfaces limit, based on the formula and the On-Demand Instance limit data?

@nadlerjessie
Copy link
Contributor Author

I like that idea, I didn't know about _update_limits_from_api! I'll take care of it. And no rush on the release, thanks for letting me know.

@jantman
Copy link
Owner

jantman commented Jan 29, 2019

Ok, thanks so much!

Yeah, unfortunately EC2 exposes very few of the limits via DescribeAccountAttributes...

@codecov-io
Copy link

Codecov Report

Merging #379 into develop will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           develop   #379   +/-   ##
======================================
  Coverage      100%   100%           
======================================
  Files           30     30           
  Lines         2256   2261    +5     
  Branches       335    335           
======================================
+ Hits          2256   2261    +5
Impacted Files Coverage Δ
awslimitchecker/services/vpc.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d8eccf1...19eb663. Read the comment docs.

Copy link
Owner

@jantman jantman left a comment

Choose a reason for hiding this comment

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

This looks great, thanks so much again!

@jantman
Copy link
Owner

jantman commented Jan 30, 2019

The only build failure was a broken link found by the docs build. Merging now; I'll clean that up before release

@jantman jantman merged commit 7a0fad2 into jantman:develop Jan 30, 2019
@jantman
Copy link
Owner

jantman commented Jan 30, 2019

@nadlerjessie By the way, I just wanted to say thank you for submitting such a well-done PR. It's rare on small projects like this that people take the time to go through the PR template, provide a good summary, tests, etc. It's greatly appreciated.

@nadlerjessie
Copy link
Contributor Author

You're welcome @jantman! Thanks for maintaining such a great library and for the quick review

jantman added a commit that referenced this pull request Jan 30, 2019
@jantman
Copy link
Owner

jantman commented Jan 30, 2019

This has been released as 6.1.0 and is live on PyPI. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants