Skip to content

Commit

Permalink
add clustername for filters
Browse files Browse the repository at this point in the history
  • Loading branch information
zetaab committed Sep 17, 2020
1 parent 1ecb9ab commit 5e07c83
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions upup/pkg/fi/cloudup/awsup/aws_cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -847,9 +847,11 @@ func addCloudInstanceData(cm *cloudinstances.CloudInstance, instance *ec2.Instan
}

func findInstances(c AWSCloud, ig *kops.InstanceGroup) (map[string]*ec2.Instance, error) {
clusterName, _ := c.Tags()[TagClusterName]
req := &ec2.DescribeInstancesInput{
Filters: []*ec2.Filter{
NewEC2Filter("tag:"+identity_aws.CloudTagInstanceGroupName, ig.ObjectMeta.Name),
NewEC2Filter("tag:"+TagClusterName, clusterName),
NewEC2Filter("instance-state-name", "pending", "running", "stopping", "stopped"),
},
}
Expand All @@ -871,9 +873,11 @@ func findInstances(c AWSCloud, ig *kops.InstanceGroup) (map[string]*ec2.Instance
}

func findDetachedInstances(c AWSCloud, g *autoscaling.Group) ([]*string, error) {
clusterName, _ := c.Tags()[TagClusterName]
req := &ec2.DescribeInstancesInput{
Filters: []*ec2.Filter{
NewEC2Filter("tag:"+tagNameDetachedInstance, aws.StringValue(g.AutoScalingGroupName)),
NewEC2Filter("tag:"+TagClusterName, clusterName),
NewEC2Filter("instance-state-name", "pending", "running", "stopping", "stopped"),
},
}
Expand Down

0 comments on commit 5e07c83

Please sign in to comment.