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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix suspend ASG processes for nodegroups #3218

Merged
merged 3 commits into from Feb 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions pkg/apis/eksctl.io/v1alpha5/types.go
Expand Up @@ -5,6 +5,7 @@ import (
"strings"
"time"

"github.com/aws/aws-sdk-go/service/autoscaling/autoscalingiface"
"github.com/aws/aws-sdk-go/service/cloudformation/cloudformationiface"
"github.com/aws/aws-sdk-go/service/cloudtrail/cloudtrailiface"
"github.com/aws/aws-sdk-go/service/ec2/ec2iface"
Expand Down Expand Up @@ -527,6 +528,7 @@ type ClusterProvider interface {
CloudFormation() cloudformationiface.CloudFormationAPI
CloudFormationRoleARN() string
CloudFormationDisableRollback() bool
ASG() autoscalingiface.AutoScalingAPI
EKS() eksiface.EKSAPI
EC2() ec2iface.EC2API
ELB() elbiface.ELBAPI
Expand Down
4 changes: 2 additions & 2 deletions pkg/cfn/manager/nodegroup.go
Expand Up @@ -268,7 +268,7 @@ func (c *StackCollection) GetNodeGroupSummaries(name string) ([]*NodeGroupSummar
return nil, errors.Wrap(err, "mapping stack to nodegroup summary")
}

asgName, err := c.getAutoScalingGroupName(s)
asgName, err := c.GetAutoScalingGroupName(s)
if err != nil {
return nil, errors.Wrap(err, "getting autoscalinggroupname")
}
Expand All @@ -285,7 +285,7 @@ func (c *StackCollection) GetNodeGroupSummaries(name string) ([]*NodeGroupSummar
return summaries, nil
}

func (c *StackCollection) getAutoScalingGroupName(s *Stack) (string, error) {
func (c *StackCollection) GetAutoScalingGroupName(s *Stack) (string, error) {

nodeGroupType, err := GetNodeGroupType(s.Tags)
if err != nil {
Expand Down
7 changes: 7 additions & 0 deletions pkg/eks/api.go
Expand Up @@ -13,6 +13,8 @@ import (
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/aws/aws-sdk-go/service/autoscaling/autoscalingiface"
"github.com/aws/aws-sdk-go/service/cloudformation"
"github.com/aws/aws-sdk-go/service/cloudformation/cloudformationiface"
"github.com/aws/aws-sdk-go/service/cloudtrail"
Expand Down Expand Up @@ -57,6 +59,7 @@ type ClusterProvider struct {
type ProviderServices struct {
spec *api.ProviderConfig
cfn cloudformationiface.CloudFormationAPI
asg autoscalingiface.AutoScalingAPI
eks eksiface.EKSAPI
ec2 ec2iface.EC2API
elb elbiface.ELBAPI
Expand All @@ -79,6 +82,9 @@ func (p ProviderServices) CloudFormationDisableRollback() bool {
return p.spec.CloudFormationDisableRollback
}

// ASG returns a representation of the AutoScaling API
func (p ProviderServices) ASG() autoscalingiface.AutoScalingAPI { return p.asg }

// EKS returns a representation of the EKS API
func (p ProviderServices) EKS() eksiface.EKSAPI { return p.eks }

Expand Down Expand Up @@ -131,6 +137,7 @@ func New(spec *api.ProviderConfig, clusterSpec *api.ClusterConfig) *ClusterProvi
// later re-use if overriding sessions due to custom URL
s := c.newSession(spec)

provider.asg = autoscaling.New(s)
provider.cfn = cloudformation.New(s)
provider.eks = awseks.New(s)
provider.ec2 = ec2.New(s)
Expand Down