Merge pull request #14461 from johngmyers/ipv6-fix

ipv6: Tolerate multiple routes to the same NAT Gateway
This commit is contained in:
Kubernetes Prow Robot 2022-10-27 14:48:30 -07:00 committed by GitHub
commit 85036d24e6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 4 deletions

View File

@ -125,6 +125,7 @@ func RunDeleteCluster(ctx context.Context, f *util.Factory, out io.Writer, optio
} }
} }
klog.Info("Looking for cloud resources to delete")
allResources, err := resourceops.ListResources(cloud, cluster, options.Region) allResources, err := resourceops.ListResources(cloud, cluster, options.Region)
if err != nil { if err != nil {
return err return err

View File

@ -2009,7 +2009,7 @@ func ListIAMRoles(cloud fi.Cloud, clusterName string) ([]*resources.Resource, er
continue continue
} else if awsup.AWSErrorCode(err) == iam.ErrCodeNoSuchEntityException { } else if awsup.AWSErrorCode(err) == iam.ErrCodeNoSuchEntityException {
klog.Warningf("could not find instance profile %q. Resource may already have been deleted: %v", name, awserror) klog.Warningf("could not find role %q. Resource may already have been deleted: %v", name, awserror)
continue continue
} }
} }

View File

@ -211,9 +211,11 @@ func findNatGatewayFromRouteTable(cloud awsup.AWSCloud, routeTable *RouteTable)
if rt != nil { if rt != nil {
var natGatewayIDs []*string var natGatewayIDs []*string
natGatewayIDsSeen := map[string]bool{}
for _, route := range rt.Routes { for _, route := range rt.Routes {
if route.NatGatewayId != nil { if route.NatGatewayId != nil && !natGatewayIDsSeen[*route.NatGatewayId] {
natGatewayIDs = append(natGatewayIDs, route.NatGatewayId) natGatewayIDs = append(natGatewayIDs, route.NatGatewayId)
natGatewayIDsSeen[*route.NatGatewayId] = true
} }
} }

View File

@ -2271,15 +2271,20 @@ func (c *awsCloudImplementation) DefaultInstanceType(cluster *kops.Cluster, ig *
case kops.InstanceGroupRoleMaster, kops.InstanceGroupRoleNode, kops.InstanceGroupRoleAPIServer: case kops.InstanceGroupRoleMaster, kops.InstanceGroupRoleNode, kops.InstanceGroupRoleAPIServer:
// t3.medium is the cheapest instance with 4GB of mem, unlimited by default, fast and has decent network // t3.medium is the cheapest instance with 4GB of mem, unlimited by default, fast and has decent network
// c5.large and c4.large are a good second option in case t3.medium is not available in the AZ // c5.large and c4.large are a good second option in case t3.medium is not available in the AZ
candidates = []string{"t3.medium", "c5.large", "c4.large"} candidates = []string{"t3.medium", "c5.large", "c4.large", "t4g.medium"}
case kops.InstanceGroupRoleBastion: case kops.InstanceGroupRoleBastion:
candidates = []string{"t3.micro", "t2.micro"} candidates = []string{"t3.micro", "t2.micro", "t4g.micro"}
default: default:
return "", fmt.Errorf("unhandled role %q", ig.Spec.Role) return "", fmt.Errorf("unhandled role %q", ig.Spec.Role)
} }
imageArch := "x86_64"
if imageInfo, err := c.ResolveImage(ig.Spec.Image); err == nil {
imageArch = fi.StringValue(imageInfo.Architecture)
}
// Find the AZs the InstanceGroup targets // Find the AZs the InstanceGroup targets
igZones, err := model.FindZonesForInstanceGroup(cluster, ig) igZones, err := model.FindZonesForInstanceGroup(cluster, ig)
if err != nil { if err != nil {
@ -2289,6 +2294,16 @@ func (c *awsCloudImplementation) DefaultInstanceType(cluster *kops.Cluster, ig *
// TODO: Validate that instance type exists in all AZs, but skip AZs that don't support any VPC stuff // TODO: Validate that instance type exists in all AZs, but skip AZs that don't support any VPC stuff
for _, instanceType := range candidates { for _, instanceType := range candidates {
if strings.HasPrefix(instanceType, "t4g") {
if imageArch != "arm64" {
continue
}
} else {
if imageArch == "arm64" {
continue
}
}
zones, err := c.zonesWithInstanceType(instanceType) zones, err := c.zonesWithInstanceType(instanceType)
if err != nil { if err != nil {
return "", err return "", err