Skip to content

Commit

Permalink
Merge pull request #1555 from OmerKahani/Change_Order_Delete_Before_C…
Browse files Browse the repository at this point in the history
…reate

AWS: change the order of the actions, DELETE before CREATE fixes #1411
  • Loading branch information
k8s-ci-robot authored Jun 10, 2020
2 parents ccab168 + 231fbea commit 102228c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions provider/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,8 @@ func (p *AWSProvider) tagsForZone(ctx context.Context, zoneID string) (map[strin

func batchChangeSet(cs []*route53.Change, batchSize int) [][]*route53.Change {
if len(cs) <= batchSize {
return [][]*route53.Change{cs}
res := sortChangesByActionNameType(cs)
return [][]*route53.Change{res}
}

batchChanges := make([][]*route53.Change, 0)
Expand Down Expand Up @@ -639,10 +640,10 @@ func batchChangeSet(cs []*route53.Change, batchSize int) [][]*route53.Change {

func sortChangesByActionNameType(cs []*route53.Change) []*route53.Change {
sort.SliceStable(cs, func(i, j int) bool {
if *cs[i].Action < *cs[j].Action {
if *cs[i].Action > *cs[j].Action {
return true
}
if *cs[i].Action > *cs[j].Action {
if *cs[i].Action < *cs[j].Action {
return false
}
if *cs[i].ResourceRecordSet.Name < *cs[j].ResourceRecordSet.Name {
Expand Down

0 comments on commit 102228c

Please sign in to comment.