-
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
Add validation for instanceType and ami architecture #10747
Add validation for instanceType and ami architecture #10747
Conversation
Hi @bharath-123. 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 Once the patch is verified, the new status will be reflected by the 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. |
96e8b26
to
7a5df27
Compare
/ok-to-test |
Quick thought @bharath-123, when we debated validation of instance types, we decided to do it at config validation time: kops/pkg/apis/kops/validation/aws.go Lines 121 to 132 in a140168
Probably we should do the same for images and reduce the number of API calls later, when applying changes. I think the instance types are even cached to reduce the number of calls. /cc @rifelpet |
I was not aware of this validation code. I ll work with this code. I think it makes sense to include during the deep validation phase. Plus I think the instanceType caching is feature flagged as per https://github.com/kubernetes/kops/blob/master/pkg/featureflag/featureflag.go#L52 ? |
Yes, this is the PR #9908. I think can be ignored for the initial implementation. |
@hakman I ll work on moving the validation logic to config validation time. I see the GetMachineTypeInfo
|
7a5df27
to
c3accc3
Compare
1f3c1e9
to
7fa96b1
Compare
7fa96b1
to
9a2910d
Compare
@olemarkus @rifelpet @hakman Do have a look at this. |
pkg/apis/kops/validation/aws.go
Outdated
@@ -67,6 +67,8 @@ func awsValidateInstanceGroup(ig *kops.InstanceGroup, cloud awsup.AWSCloud) fiel | |||
|
|||
allErrs = append(allErrs, awsValidateInstanceType(field.NewPath(ig.GetName(), "spec", "machineType"), ig.Spec.MachineType, cloud)...) |
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.
Does this make sense anymore? No reason to check the instance type in 2 places.
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.
Agreed we can push it to the arch instance type validation function. Will update this
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.
We should also check against all instance types in a mixed instance policy in addition to spec.machineType
EDIT: This is already being done
9a2910d
to
94ca969
Compare
I'm trying to find any validation that ensures |
94ca969
to
a038f05
Compare
a038f05
to
e2bf86a
Compare
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bharath-123, 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 |
When an ami and instanceType of different architectures are specified,
kops update cluster
does not fail even though its an invalid combination.This can cause side effects like creation of unwanted versions of a launch template, failed cluster creations and so on.
This PR adds checks to validate the chosen instance type architecture against the ami architecture. This PR adds the validation for launch configuration, launch templates and mixed instance policies.
Open question: We are making a
DescribeInstanceType
call for each instance when validating for mixed instance policies. This can be expensive as more instances are added. Should we feature flag this validation?UPDATE: I think the number of calls to DescribeInstanceType should be fine as this done only during spec validation and not during cluster creation.
Fixes: #10726