Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions controllers/provisioners/eks/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ func (ctx *EksInstanceGroupContext) CloudDiscovery() error {
if spec.IsLaunchConfiguration() {

state.ScalingConfiguration, err = scaling.NewLaunchConfiguration(instanceGroup.NamespacedName(), ctx.AwsWorker, &scaling.DiscoverConfigurationInput{
ScalingGroup: targetScalingGroup,
ScalingGroup: targetScalingGroup,
TargetConfigName: state.ScalingConfiguration.Name(),
})
if err != nil {
return errors.Wrap(err, "failed to discover launch configurations")
Expand All @@ -238,7 +239,8 @@ func (ctx *EksInstanceGroupContext) CloudDiscovery() error {

if spec.IsLaunchTemplate() {
state.ScalingConfiguration, err = scaling.NewLaunchTemplate(instanceGroup.NamespacedName(), ctx.AwsWorker, &scaling.DiscoverConfigurationInput{
ScalingGroup: targetScalingGroup,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the current implementation discovers the active launch template by the scaling group name, can you look inside NewLaunchTemplate and see if there is a reason this is not happening?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we are not setting TargetConfigName inside Discover:
https://github.com/sahilbadla/instance-manager/blob/58ad1a253a80900c2a1047c5809ca1d94e300d00/controllers/provisioners/eks/scaling/launchtemplate.go#L58

Can you try that instead?
That way we don't rely on status field, but rather discover the active Launch Template name each time from the scaling group name.

ScalingGroup: targetScalingGroup,
TargetConfigName: state.ScalingConfiguration.Name(),
})
if err != nil {
return errors.Wrap(err, "failed to discover launch templates")
Expand Down