-
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 support for Spot block in launch template #8802
Conversation
thejasbabu
commented
Mar 26, 2020
- Launch configuration does not support the field SpotDurationInMinutes which is used to reserve the spot instances, but however Launch Template does
Welcome @thejasbabu! |
Hi @thejasbabu. 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. |
/ok-to-test |
/assign @chrislovecnm |
@thejasbabu Thanks for spending the time to add this. Could you address a few things:
Once you add these should be easier to see if this works correctly. |
@@ -131,6 +131,9 @@ func (b *AutoscalingGroupModelBuilder) buildLaunchTemplateTask(c *fi.ModelBuilde | |||
if ig.Spec.MixedInstancesPolicy == nil { | |||
lt.SpotPrice = lc.SpotPrice | |||
} | |||
if ig.Spec.SpotDurationInMinutes != nil { | |||
lt.SpotDurationInMinutes = ig.Spec.SpotDurationInMinutes |
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.
Should we do some validation of the value provided by the user given that these values have to be a multiple of 60?
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.
Added validation for this. Thanks!
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.
Added the integration test to test spotblock
@hakman Thanks for the feedback.
|
7805166
to
657d1dd
Compare
/retest |
looks like the test is failing due to whitespace issues in the integration test expected output. You can run |
5eab43d
to
7be43b7
Compare
role: Node | ||
instanceProtection: true | ||
maxPrice: "0.1" | ||
spotDurationInMinutes: 120 |
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.
Apologies for the runaround but we're doing some significant refactoring in the integration tests (see #8737) and the timing of that and some other PRs is going to cause a merge conflict here.
I think it would be simpler to add this field to the existing launch_templates
test cluster rather than creating a new integration test cluster. You could delete tests/integration/update_cluster/spotblock
and revert your changes in cmd/kops/integration_test.go
, then add the new field to tests/integration/update_cluster/launch_templates/in-v1alpha2.yaml
and rerun ./hack/update-expected.sh
once more. It will produce a much smaller PR and wont conflict with the other changes we're making.
I hope this makes sense, let me know if you have any questions.
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.
I see that #8737 is not yet merged, will the above thing work if I rebase this branch with master?
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.
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.
Sorry for my late reply. I've been a bit busy over the last few days.
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.
There's few complication in adding the integration test as part of launch_templates
. The TestLaunchTemplatesASG
fails since the method runTestAWS
is made for one type of node, now when I add a new asg with spot-node, the actual is correct but the expected is mis formed because of runTestAWS
method.
Should I refactor the runTestAWS
to run for multiple nodes for single kube-cluster?
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.
Also there's an assumption that the instance group name is always nodes
https://github.com/kubernetes/kops/blob/master/cmd/kops/integration_test.go#L486
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.
In this case, could you just add these to the existing IG for launch_templates
?
maxPrice: "0.1"
spotDurationInMinutes: 120
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.
Seems like a quick fix, but will do.
Seems that tests are failing because of missing of the imports order in |
Considering that the list of accepted values is pretty small, maybe we should just list the accepted values instead of this logic? What do you think @gjtempleton @johngmyers ? kops/pkg/apis/kops/validation/aws.go Lines 115 to 126 in c511921
|
c511921
to
010124d
Compare
An explicit list checked with |
5f40853
to
03adc95
Compare
@hakman @johngmyers Updated the validation to be just a basic value check. Let me know if there's any other changes that needs to be done 👍 |
tests/integration/update_cluster/launch_templates/in-v1alpha2.yaml
Outdated
Show resolved
Hide resolved
03adc95
to
e89163e
Compare
Thanks @thejasbabu. At the moment looks good to me. Please also squash the commits and rebase. It is a pretty small change to separate into multiple commits. |
e89163e
to
7cbcad9
Compare
- Launch configuration does not support the field SpotDurationInMinutes which is used to reserve the spot instances, but however Launch Template does
7cbcad9
to
dda8dc3
Compare
/lgtm |
This looks great, thanks for sticking with it! /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: rifelpet, thejasbabu 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 |