Skip to content

Commit

Permalink
Merge pull request #9906 from johngmyers/automated-cherry-pick-of-#98…
Browse files Browse the repository at this point in the history
…97-upstream-release-1.18

Automated cherry pick of #9897: Add missing spot support to launch template direct render
  • Loading branch information
k8s-ci-robot authored Sep 9, 2020
2 parents 453d7d9 + 1b573c0 commit 6fc029f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions upup/pkg/fi/cloudup/awstasks/launchtemplate_target_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (t *LaunchTemplate) RenderAWS(c *awsup.AWSAPITarget, a, ep, changes *Launch
for _, sg := range t.SecurityGroups {
lc.NetworkInterfaces[0].Groups = append(lc.NetworkInterfaces[0].Groups, sg.ID)
}
// @step: add any tenacy details
// @step: add any tenancy details
if t.Tenancy != nil {
lc.Placement = &ec2.LaunchTemplatePlacementRequest{Tenancy: t.Tenancy}
}
Expand Down Expand Up @@ -128,12 +128,15 @@ func (t *LaunchTemplate) RenderAWS(c *awsup.AWSAPITarget, a, ep, changes *Launch
}
lc.UserData = aws.String(base64.StdEncoding.EncodeToString(d))
}
// @step: add instanceInterruptionBehavior
if t.InstanceInterruptionBehavior != nil {
// @step: add market options
if t.SpotPrice != "" {
s := &ec2.LaunchTemplateSpotMarketOptionsRequest{
BlockDurationMinutes: t.SpotDurationInMinutes,
InstanceInterruptionBehavior: t.InstanceInterruptionBehavior,
MaxPrice: fi.String(t.SpotPrice),
}
lc.InstanceMarketOptions = &ec2.LaunchTemplateInstanceMarketOptionsRequest{
MarketType: fi.String("spot"),
SpotOptions: s,
}
}
Expand Down

0 comments on commit 6fc029f

Please sign in to comment.