Skip to content

Commit

Permalink
aws: log when multiple subnets found in the same AZ
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Yastrebov <[email protected]>
  • Loading branch information
AlexanderYastrebov committed Nov 20, 2023
1 parent f2f28dc commit a986c77
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions aws/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -946,11 +946,14 @@ func (a *Adapter) FindLBSubnets(scheme string) []string {
continue
}

// If we have two subnets for the same AZ we arbitrarily choose
// If we have two subnets in the same AZ we arbitrarily choose
// the one that is first lexicographically.
if strings.Compare(existing.id, subnet.id) > 0 {
if subnet.id < existing.id {
subnetsByAZ[subnet.availabilityZone] = subnet
}

log.Warnf("Found subnets %s and %s with tag %s in availability zone %s, using %s",
existing.id, subnet.id, tagName, subnet.availabilityZone, subnetsByAZ[subnet.availabilityZone])
}

subnetIDs := make([]string, 0, len(subnetsByAZ))
Expand Down

0 comments on commit a986c77

Please sign in to comment.