Skip to content

Commit

Permalink
Fix suspend ASG processes
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbeaumont committed Feb 5, 2021
1 parent b7e9643 commit a6a35c1
Show file tree
Hide file tree
Showing 9 changed files with 4,939 additions and 3 deletions.
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

0 comments on commit a6a35c1

Please sign in to comment.