-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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 ec2.DescribeInstanceTypes for machine type info #8856
Conversation
6982c99
to
470c6c0
Compare
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.
Looks good so far!
@@ -49,3 +49,8 @@ func (m *MockEC2) DescribeInstancesPages(request *ec2.DescribeInstancesInput, ca | |||
func (m *MockEC2) DescribeInstancesPagesWithContext(aws.Context, *ec2.DescribeInstancesInput, func(*ec2.DescribeInstancesOutput, bool) bool, ...request.Option) error { | |||
panic("Not implemented") | |||
} | |||
|
|||
func (m *MockEC2) DescribeInstanceTypes(*ec2.DescribeInstanceTypesInput) (*ec2.DescribeInstanceTypesOutput, error) { | |||
klog.Warningf("MockEc2::DescribeInstanceTypes is stub-implemented") |
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.
If it helps, we can try to narrow the instance types we support in testing, or just support fake instance types.
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.
This function isn't actually used, it just needs to be defined in order to satisfy the mock interface. The actual stub we use in integration testing is in upup/pkg/fi/cloudup/awsup/mock_aws_cloud.go
where I defined a reasonable mock behavior.
InstanceIPsPerENI: intValue(info.NetworkInfo.Ipv4AddressesPerInterface), | ||
} | ||
memoryGB := float64(intValue(info.MemoryInfo.SizeInMiB)) / 1024 | ||
machine.MemoryGB = float32(math.Round(memoryGB*100) / 100) |
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.
Nit: Should we remove the rounding logic once we're happy we get matching values? Maybe just add a todo?
This is great, thanks for your work on this @rifelpet! |
Deferring the field validation until How bad would it be for api validation to try getting a |
I agree it would be unfortunate. I believe that validation is called by PopulateClusterSpec (which is called by Thoughts? |
470c6c0
to
8e20580
Compare
e699475
to
066b296
Compare
f4867a9
to
7d0c704
Compare
As discussed during office hours, I added a release note mentioning the behavior change. Since there isn't much of a remedy we have available other than contacting AWS support for a rate limit increase, I opted to instruct the user to open a GH issue. If anyone has any better ideas please let me know. /assign @mikesplain |
/retest |
This requires passing a cloud object in additional places throughout the validation package and originating mostly from cmd/kops This means that some kops commands now require valid cloud provider credentials, but I don't think this is an issue because the vast majority of use-cases already require the same cloud provider credentials in order to interact with the state store.
I just tried to test this out twice but both times I think there was a networking issue... kubedns/coredns failed both times. I'm going to dig in and make sure it's not related. Ratelimiting didn't appear to hamper things too much in one of our busiest accounts so I think we're probably safe there. |
This works great now with the rebase/fixes. Thanks @rifelpet! Testing didn't show alot on my side, things worked as expected and the impact of the additional api calls was less than I had expected (very minimal actually), even on a busy api. I think we should get this rolling and get more people using this asap so I'm going to approve and hold. Feel free to remove the hold as you see fit! /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: mikesplain, rifelpet 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 |
sounds good, thanks for the review! thoughts on cherry-picking to 1.18? or should we let this sit for a few extra months in 1.19 pre-releases for additional testing? |
I think it makes sense to get into 1.18, less to deal with in terms of machine updates... We could also let it bake for a few days in master if you'd like. Thanks again! |
I would prefer we not put larger features into 1.18 at this point. It is in beta and we should be working on getting it out the door. |
Second what John said. |
The AWS client is not initialized by the time API validation is performed, so I had to move the
machineType
instance group field validation toapply_cluster.go
.Marking WIP because I still need to update
nodeup/pkg/model/kubelet.go
's use ofGetMachineTypeInfo
(only relevant with the AmazonVPC CNI), as well as some tests and mocks. I also realize the validation is no longer returning multiple validation errors, I'll get that fixed.Feedback is welcome on a better approach to support every use of GetMachineTypeInfo.