From 5896ea18c09eb043f321c3b053b678b91b05545a Mon Sep 17 00:00:00 2001 From: Sanne Raymaekers Date: Thu, 24 Oct 2024 18:31:00 +0200 Subject: [PATCH] cloud/awscloud: fix retrying to create secure instances Set the correct target capacity specification type, just setting the spot options to nil doesn't result in an on demand instance. --- internal/cloud/awscloud/secure-instance.go | 1 + 1 file changed, 1 insertion(+) diff --git a/internal/cloud/awscloud/secure-instance.go b/internal/cloud/awscloud/secure-instance.go index 3c88050983..53c6132e9e 100644 --- a/internal/cloud/awscloud/secure-instance.go +++ b/internal/cloud/awscloud/secure-instance.go @@ -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)