Skip to content

Commit

Permalink
Merge pull request #28 from wking/tag-20-load-balancers-per-request
Browse files Browse the repository at this point in the history
awstagdeprovision: Tag 20 load balancers (max) per request
  • Loading branch information
openshift-merge-robot authored Sep 29, 2018
2 parents 41846e8 + e49201c commit a050d77
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions contrib/pkg/awstagdeprovision/awstagdeprovision.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,9 +307,18 @@ func deleteLBs(awsSession *session.Session, filters awsFilter, clusterName strin
return false, nil
}

lbObjects, err := lbToAWSObjects(results.LoadBalancerDescriptions, elbClient)
if err != nil {
return false, nil
lbObjects := []awsObjectWithTags{}
for i := 0; i < len(results.LoadBalancerDescriptions); i += 20 {
j := i + 20
if j > len(results.LoadBalancerDescriptions) {
j = len(results.LoadBalancerDescriptions)
}
new, err := lbToAWSObjects(results.LoadBalancerDescriptions[i:j], elbClient)
if err != nil {
logger.Errorf("error converting load balancers to internal AWS objects: %v", err)
return false, nil
}
lbObjects = append(lbObjects, new...)
}

filteredResults := filterObjects(lbObjects, filters)
Expand Down

0 comments on commit a050d77

Please sign in to comment.