Skip to content

Commit

Permalink
aws: Skip WarmPool checks when it's not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
hakman authored and rifelpet committed Jan 4, 2024
1 parent 349de70 commit 771a3fb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions upup/pkg/fi/nodeup/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,12 @@ func (c *NodeUpCommand) Run(out io.Writer) error {
}
modelContext.InstanceID = string(instanceIDBytes)

modelContext.ConfigurationMode, err = getAWSConfigurationMode(ctx, modelContext)
if err != nil {
return err
// Check if WarmPool is enabled first, to avoid additional API calls
if len(modelContext.NodeupConfig.WarmPoolImages) > 0 {
modelContext.ConfigurationMode, err = getAWSConfigurationMode(ctx, modelContext)
if err != nil {
return err
}
}

modelContext.MachineType, err = getMachineType()
Expand Down Expand Up @@ -713,6 +716,11 @@ func getNodeConfigFromServers(ctx context.Context, bootConfig *nodeup.BootConfig
}

func getAWSConfigurationMode(ctx context.Context, c *model.NodeupModelContext) (string, error) {
// Check if WarmPool is enabled first, to avoid additional API calls
if len(c.NodeupConfig.WarmPoolImages) == 0 {
return "", nil
}

// Only worker nodes and apiservers can actually autoscale.
// We are not adding describe permissions to the other roles
role := c.BootConfig.InstanceGroupRole
Expand Down

0 comments on commit 771a3fb

Please sign in to comment.