Skip to content

Commit

Permalink
cloud/awscloud: fix retrying to create secure instances
Browse files Browse the repository at this point in the history
Set the correct target capacity specification type, just setting the
spot options to nil doesn't result in an on demand instance.
  • Loading branch information
croissanne committed Oct 24, 2024
1 parent 6ccfc7f commit 4f90a75
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions internal/cloud/awscloud/secure-instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,7 @@ func (a *AWS) createFleet(input *ec2.CreateFleetInput) (*ec2.CreateFleetOutput,
if len(fleetErrs) > 0 && retry {
logrus.Warnf("Received errors (%s) from CreateFleet, retrying CreateFleet with OnDemand instance", strings.Join(fleetErrs, "; "))
input.SpotOptions = nil
input.TargetCapacitySpecification.DefaultTargetCapacityType = ec2types.DefaultTargetCapacityTypeOnDemand
createFleetOutput, err = a.ec2.CreateFleet(context.Background(), input)
if err != nil {
return nil, fmt.Errorf("Unable to create on demand fleet: %w", err)
Expand Down

0 comments on commit 4f90a75

Please sign in to comment.