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

dynamically retrieve instance types #287

Merged
merged 11 commits into from
Mar 16, 2021
Merged

Conversation

bwagner5
Copy link
Contributor

Issue #, if available:
#286

Description of changes:

  • Fetch instance types dynamically w/ ec2.DescribeInstanceTypes and transforms to nodeCapacity information.
  • Ran go mod tidy which updated some go.sum stuff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

pkg/cloudprovider/aws/packing/nodecapacity.go Outdated Show resolved Hide resolved
pkg/cloudprovider/aws/packing/nodecapacity.go Outdated Show resolved Hide resolved
pkg/cloudprovider/aws/packing/packing.go Outdated Show resolved Hide resolved
pkg/cloudprovider/aws/packing/packing.go Show resolved Hide resolved
pkg/cloudprovider/aws/packing/packing.go Outdated Show resolved Hide resolved
@bwagner5 bwagner5 force-pushed the dynamic-instance-types branch 5 times, most recently from 7e62b95 to ebd26a2 Compare March 15, 2021 22:06
pkg/cloudprovider/aws/packing/packing.go Show resolved Hide resolved
pkg/cloudprovider/aws/packing/nodecapacity.go Outdated Show resolved Hide resolved
pkg/cloudprovider/aws/packing/packing.go Outdated Show resolved Hide resolved
pkg/cloudprovider/aws/packing/packing.go Outdated Show resolved Hide resolved
pkg/cloudprovider/aws/packing/packing.go Outdated Show resolved Hide resolved
pkg/cloudprovider/aws/packing/packing.go Show resolved Hide resolved
nc := instanceTypeInfoToNodeCapacity(*instanceTypeInfo)
kubeletOverhead := binpacking.CalculateKubeletOverhead(nc.total)
if ok := nc.reserve(resources.Merge(constraints.Overhead, kubeletOverhead)); !ok {
zap.S().Errorf("Failed to reserve kubelet overhead for node capacity type %v", nc.instanceType)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to error here? Is debug better? IIUC, this only errors if the theoretical node is full, which might happen multiple times in simulation.

Copy link
Contributor

@JacobGabrielson JacobGabrielson Mar 16, 2021

Choose a reason for hiding this comment

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

I'd probably not consider it an error even - although it should never even happen, if there were some really extreme instance type in the future where perhaps it did trigger, it means the instance type cannot handle kubelet overhead at all, so we shouldn't consider using it anyway - maybe make this a log info ("excluding ...")?

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 think that makes sense for info level. I just brought this in from a rebase, so not sure if there was a reason for it being error.

Copy link
Contributor

Choose a reason for hiding this comment

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

We're really judicious about Info level -- we can talk about the ideology here, maybe debug?

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 don't have a super strong opinion, so I can go either way. I think Jacob is right that it shouldn't ever happen the way the kubelet overhead is being calculated right now since it's a scaled a percentage. But I suppose if there was a weird instance type that was released, it could spam everyone using karpenter if it's at info level, so I'm fine with debug.

@bwagner5 bwagner5 mentioned this pull request Mar 16, 2021
@bwagner5 bwagner5 force-pushed the dynamic-instance-types branch from ebd26a2 to f147d6b Compare March 16, 2021 03:13
Copy link
Contributor

@ellistarn ellistarn left a comment

Choose a reason for hiding this comment

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

Nice work. More or less LGTM, a couple nits.

@JacobGabrielson JacobGabrielson self-requested a review March 16, 2021 17:50
Copy link
Contributor

@JacobGabrielson JacobGabrielson left a comment

Choose a reason for hiding this comment

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

              |    |    |                 
             )_)  )_)  )_)              
            )___))___))___)\            
           )____)____)_____)\\
         _____|____|____|____\\\__
---------\                   /---------
  ^^^^^ ^^^^^^^^^^^^^^^^^^^^^
    ^^^^      ^^^^     ^^^    ^^
         ^^^^      ^^^

@bwagner5 bwagner5 merged commit 5d55935 into aws:main Mar 16, 2021
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.

4 participants