From 49115bcc110eb1b5019bb23fe9be9fe3bc52593c Mon Sep 17 00:00:00 2001 From: John Gardiner Myers Date: Wed, 26 Oct 2022 20:05:44 -0700 Subject: [PATCH] ipv6: Tolerate multiple routes to the same NAT Gateway --- upup/pkg/fi/cloudup/awstasks/natgateway.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/upup/pkg/fi/cloudup/awstasks/natgateway.go b/upup/pkg/fi/cloudup/awstasks/natgateway.go index 2adbdd9ce7..827c4fc789 100644 --- a/upup/pkg/fi/cloudup/awstasks/natgateway.go +++ b/upup/pkg/fi/cloudup/awstasks/natgateway.go @@ -211,9 +211,11 @@ func findNatGatewayFromRouteTable(cloud awsup.AWSCloud, routeTable *RouteTable) if rt != nil { var natGatewayIDs []*string + natGatewayIDsSeen := map[string]bool{} for _, route := range rt.Routes { - if route.NatGatewayId != nil { + if route.NatGatewayId != nil && !natGatewayIDsSeen[*route.NatGatewayId] { natGatewayIDs = append(natGatewayIDs, route.NatGatewayId) + natGatewayIDsSeen[*route.NatGatewayId] = true } }