Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed "NeedsUpdate" status of nodes in mixedinstancegroups after rolling update #7445

Merged
Changes from 1 commit
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
18 changes: 15 additions & 3 deletions upup/pkg/fi/cloudup/awsup/aws_cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package awsup

import (
"fmt"
"strconv"
"strings"
"sync"
"time"
Expand Down Expand Up @@ -570,7 +571,7 @@ func matchesAsgTags(tags map[string]string, actual []*autoscaling.TagDescription
}

// findAutoscalingGroupLaunchConfiguration is responsible for finding the launch - which could be a launchconfiguration, a template or a mixed instance policy template
func findAutoscalingGroupLaunchConfiguration(g *autoscaling.Group) (string, error) {
func findAutoscalingGroupLaunchConfiguration(c AWSCloud, g *autoscaling.Group) (string, error) {
name := aws.StringValue(g.LaunchConfigurationName)
if name != "" {
return name, nil
Expand All @@ -592,7 +593,18 @@ func findAutoscalingGroupLaunchConfiguration(g *autoscaling.Group) (string, erro
if g.MixedInstancesPolicy.LaunchTemplate.LaunchTemplateSpecification != nil {
// honestly!!
name = aws.StringValue(g.MixedInstancesPolicy.LaunchTemplate.LaunchTemplateSpecification.LaunchTemplateName)
version := aws.StringValue(g.MixedInstancesPolicy.LaunchTemplate.LaunchTemplateSpecification.Version)
request := &ec2.DescribeLaunchTemplateVersionsInput{
LaunchTemplateName: &name,
}
versions, _ := c.EC2().DescribeLaunchTemplateVersions(request)
Copy link
Member

Choose a reason for hiding this comment

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

ignoring error is not good thing, maybe we should even print that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the reminder. I already add print error message. Could you review again, please?

var version string
for _, v := range versions.LaunchTemplateVersions {
if *v.DefaultVersion {
version = strconv.FormatInt(*v.VersionNumber, 10)
break
}
}

if name != "" {
launchTemplate := name + ":" + version
return launchTemplate, nil
Expand Down Expand Up @@ -625,7 +637,7 @@ func findInstanceLaunchConfiguration(i *autoscaling.Instance) string {
}

func awsBuildCloudInstanceGroup(c AWSCloud, ig *kops.InstanceGroup, g *autoscaling.Group, nodeMap map[string]*v1.Node) (*cloudinstances.CloudInstanceGroup, error) {
newConfigName, err := findAutoscalingGroupLaunchConfiguration(g)
newConfigName, err := findAutoscalingGroupLaunchConfiguration(c, g)
if err != nil {
return nil, err
}
Expand Down