Merge pull request #1176 from DualSpark/bastion-lc-delete-fix

Fixing abandoned launch configurations in kops
This commit is contained in:
Chris Love 2016-12-17 12:47:54 -07:00 committed by GitHub
commit 362e2cb33e
1 changed files with 7 additions and 2 deletions

View File

@ -119,6 +119,8 @@ func (c *DeleteCluster) ListResources() (map[string]*ResourceTracker, error) {
// ASG // ASG
ListAutoScalingGroups, ListAutoScalingGroups,
ListAutoScalingLaunchConfigurations, ListAutoScalingLaunchConfigurations,
// LC
// Route 53 // Route 53
ListRoute53Records, ListRoute53Records,
// IAM // IAM
@ -1336,9 +1338,12 @@ func ListAutoScalingLaunchConfigurations(cloud fi.Cloud, clusterName string) ([]
continue continue
} }
glog.V(8).Infof("UserData: %s", string(userData)) //I finally found what was polluting logs with the bash scripts.
//glog.V(8).Infof("UserData: %s", string(userData))
if extractClusterName(userData) == clusterName { // Adding in strings.Contains() here on cluster name, making the grand assumption that if our clustername string is present
// in the name of the LC, it's safe to delete. This solves the bastion LC problem.
if extractClusterName(userData) == clusterName || strings.Contains(*t.LaunchConfigurationName, clusterName) {
tracker := &ResourceTracker{ tracker := &ResourceTracker{
Name: aws.StringValue(t.LaunchConfigurationName), Name: aws.StringValue(t.LaunchConfigurationName),
ID: aws.StringValue(t.LaunchConfigurationName), ID: aws.StringValue(t.LaunchConfigurationName),