From 49115bcc110eb1b5019bb23fe9be9fe3bc52593c Mon Sep 17 00:00:00 2001 From: John Gardiner Myers Date: Wed, 26 Oct 2022 20:05:44 -0700 Subject: [PATCH 1/4] 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 } } From 423a04900f6633228b594cf424a0aae64c10005a Mon Sep 17 00:00:00 2001 From: John Gardiner Myers Date: Wed, 26 Oct 2022 20:44:45 -0700 Subject: [PATCH 2/4] Fix typo --- pkg/resources/aws/aws.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/resources/aws/aws.go b/pkg/resources/aws/aws.go index fababc0f7a..de9c44265a 100644 --- a/pkg/resources/aws/aws.go +++ b/pkg/resources/aws/aws.go @@ -2009,7 +2009,7 @@ func ListIAMRoles(cloud fi.Cloud, clusterName string) ([]*resources.Resource, er continue } 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 } } From 6d467ba8ffb5189fa78fb0bdbdd81fe526dea7f0 Mon Sep 17 00:00:00 2001 From: John Gardiner Myers Date: Wed, 26 Oct 2022 20:51:47 -0700 Subject: [PATCH 3/4] Inform user about progress of cluster deletion --- cmd/kops/delete_cluster.go | 1 + 1 file changed, 1 insertion(+) diff --git a/cmd/kops/delete_cluster.go b/cmd/kops/delete_cluster.go index c71a6ab3c0..e385e402f1 100644 --- a/cmd/kops/delete_cluster.go +++ b/cmd/kops/delete_cluster.go @@ -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) if err != nil { return err From 71246dbd9c6c751dbb6d71971de5c12c46691ef7 Mon Sep 17 00:00:00 2001 From: John Gardiner Myers Date: Wed, 26 Oct 2022 21:20:22 -0700 Subject: [PATCH 4/4] Pick appropriate default image types for ARM images --- upup/pkg/fi/cloudup/awsup/aws_cloud.go | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/upup/pkg/fi/cloudup/awsup/aws_cloud.go b/upup/pkg/fi/cloudup/awsup/aws_cloud.go index 5c514e5da8..fc6691c179 100644 --- a/upup/pkg/fi/cloudup/awsup/aws_cloud.go +++ b/upup/pkg/fi/cloudup/awsup/aws_cloud.go @@ -2271,15 +2271,20 @@ func (c *awsCloudImplementation) DefaultInstanceType(cluster *kops.Cluster, ig * 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 // 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: - candidates = []string{"t3.micro", "t2.micro"} + candidates = []string{"t3.micro", "t2.micro", "t4g.micro"} default: 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 igZones, err := model.FindZonesForInstanceGroup(cluster, ig) 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 for _, instanceType := range candidates { + if strings.HasPrefix(instanceType, "t4g") { + if imageArch != "arm64" { + continue + } + } else { + if imageArch == "arm64" { + continue + } + } + zones, err := c.zonesWithInstanceType(instanceType) if err != nil { return "", err