Skip to content

Commit

Permalink
configure retryMaxAttempt in the case of non-spot
Browse files Browse the repository at this point in the history
  • Loading branch information
pbalogh-sa authored and akpsgit committed Mar 21, 2023
1 parent 46ff7e3 commit c7a7e4a
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions runtime_scan/pkg/provider/aws/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,14 +289,16 @@ func (c *Client) RunScanningJob(ctx context.Context, region, id string, config p

var retryMaxAttempts int
// Use spot instances if there is a configuration for it.
if config.ScannerInstanceCreationConfig != nil && config.ScannerInstanceCreationConfig.UseSpotInstances {
runInstancesInput.InstanceMarketOptions = &ec2types.InstanceMarketOptionsRequest{
MarketType: ec2types.MarketTypeSpot,
SpotOptions: &ec2types.SpotMarketOptions{
InstanceInterruptionBehavior: ec2types.InstanceInterruptionBehaviorTerminate,
SpotInstanceType: ec2types.SpotInstanceTypeOneTime,
MaxPrice: config.ScannerInstanceCreationConfig.MaxPrice,
},
if config.ScannerInstanceCreationConfig != nil {
if config.ScannerInstanceCreationConfig.UseSpotInstances {
runInstancesInput.InstanceMarketOptions = &ec2types.InstanceMarketOptionsRequest{
MarketType: ec2types.MarketTypeSpot,
SpotOptions: &ec2types.SpotMarketOptions{
InstanceInterruptionBehavior: ec2types.InstanceInterruptionBehaviorTerminate,
SpotInstanceType: ec2types.SpotInstanceTypeOneTime,
MaxPrice: config.ScannerInstanceCreationConfig.MaxPrice,
},
}
}
// In the case of spot instances, we have higher probability to start an instance
// by increasing RetryMaxAttempts
Expand Down

0 comments on commit c7a7e4a

Please sign in to comment.