From 939f23b3e7dc25c772c02b67485ad62a6df480e2 Mon Sep 17 00:00:00 2001 From: Jason Deal Date: Thu, 31 Oct 2024 14:19:45 -0700 Subject: [PATCH] fix: drop neuron variant for bottlerocket AMIs (#7304) --- .../karpenter.k8s.aws_ec2nodeclasses.yaml | 2 +- .../karpenter.k8s.aws_ec2nodeclasses.yaml | 2 +- pkg/controllers/nodeclass/status/ami_test.go | 33 +------------------ pkg/providers/amifamily/bottlerocket.go | 4 +-- pkg/providers/amifamily/suite_test.go | 4 +-- 5 files changed, 7 insertions(+), 38 deletions(-) diff --git a/charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml b/charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml index 47901f77f660..ff1bc9da2b40 100644 --- a/charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml +++ b/charts/karpenter-crd/templates/karpenter.k8s.aws_ec2nodeclasses.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.3 + controller-gen.kubebuilder.io/version: v0.16.5 name: ec2nodeclasses.karpenter.k8s.aws spec: group: karpenter.k8s.aws diff --git a/pkg/apis/crds/karpenter.k8s.aws_ec2nodeclasses.yaml b/pkg/apis/crds/karpenter.k8s.aws_ec2nodeclasses.yaml index 47901f77f660..ff1bc9da2b40 100644 --- a/pkg/apis/crds/karpenter.k8s.aws_ec2nodeclasses.yaml +++ b/pkg/apis/crds/karpenter.k8s.aws_ec2nodeclasses.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.16.3 + controller-gen.kubebuilder.io/version: v0.16.5 name: ec2nodeclasses.karpenter.k8s.aws spec: group: karpenter.k8s.aws diff --git a/pkg/controllers/nodeclass/status/ami_test.go b/pkg/controllers/nodeclass/status/ami_test.go index 16cfaf6682de..7d1eef409ff5 100644 --- a/pkg/controllers/nodeclass/status/ami_test.go +++ b/pkg/controllers/nodeclass/status/ami_test.go @@ -304,7 +304,7 @@ var _ = Describe("NodeClass AMI Status Controller", func() { ExpectObjectReconciled(ctx, env.Client, statusController, nodeClass) nodeClass = ExpectExists(ctx, env.Client, nodeClass) - Expect(len(nodeClass.Status.AMIs)).To(Equal(6)) + Expect(len(nodeClass.Status.AMIs)).To(Equal(4)) Expect(nodeClass.Status.AMIs).To(ContainElements([]v1.AMI{ { Name: "amd64-standard", @@ -374,37 +374,6 @@ var _ = Describe("NodeClass AMI Status Controller", func() { }, }, }, - // Note: Bottlerocket uses the same AMI for nvidia and neuron, we use the nvidia AMI here - { - Name: "amd64-nvidia", - ID: "ami-amd64-nvidia", - Requirements: []corev1.NodeSelectorRequirement{ - { - Key: corev1.LabelArchStable, - Operator: corev1.NodeSelectorOpIn, - Values: []string{karpv1.ArchitectureAmd64}, - }, - { - Key: v1.LabelInstanceAcceleratorCount, - Operator: corev1.NodeSelectorOpExists, - }, - }, - }, - { - Name: "arm64-nvidia", - ID: "ami-arm64-nvidia", - Requirements: []corev1.NodeSelectorRequirement{ - { - Key: corev1.LabelArchStable, - Operator: corev1.NodeSelectorOpIn, - Values: []string{karpv1.ArchitectureArm64}, - }, - { - Key: v1.LabelInstanceAcceleratorCount, - Operator: corev1.NodeSelectorOpExists, - }, - }, - }, })) Expect(nodeClass.StatusConditions().IsTrue(v1.ConditionTypeAMIsReady)).To(BeTrue()) }) diff --git a/pkg/providers/amifamily/bottlerocket.go b/pkg/providers/amifamily/bottlerocket.go index 886616ce6c63..a9daad3660f1 100644 --- a/pkg/providers/amifamily/bottlerocket.go +++ b/pkg/providers/amifamily/bottlerocket.go @@ -46,8 +46,8 @@ func (b Bottlerocket) DescribeImageQuery(ctx context.Context, ssmProvider ssm.Pr for path, variants := range map[string][]Variant{ fmt.Sprintf("/aws/service/bottlerocket/aws-k8s-%s/x86_64/%s/image_id", k8sVersion, trimmedAMIVersion): {VariantStandard}, fmt.Sprintf("/aws/service/bottlerocket/aws-k8s-%s/arm64/%s/image_id", k8sVersion, trimmedAMIVersion): {VariantStandard}, - fmt.Sprintf("/aws/service/bottlerocket/aws-k8s-%s-nvidia/x86_64/%s/image_id", k8sVersion, trimmedAMIVersion): {VariantNeuron, VariantNvidia}, - fmt.Sprintf("/aws/service/bottlerocket/aws-k8s-%s-nvidia/arm64/%s/image_id", k8sVersion, trimmedAMIVersion): {VariantNeuron, VariantNvidia}, + fmt.Sprintf("/aws/service/bottlerocket/aws-k8s-%s-nvidia/x86_64/%s/image_id", k8sVersion, trimmedAMIVersion): {VariantNvidia}, + fmt.Sprintf("/aws/service/bottlerocket/aws-k8s-%s-nvidia/arm64/%s/image_id", k8sVersion, trimmedAMIVersion): {VariantNvidia}, } { imageID, err := ssmProvider.Get(ctx, path) if err != nil { diff --git a/pkg/providers/amifamily/suite_test.go b/pkg/providers/amifamily/suite_test.go index 1fa7a270af07..d6f29dd39346 100644 --- a/pkg/providers/amifamily/suite_test.go +++ b/pkg/providers/amifamily/suite_test.go @@ -164,7 +164,7 @@ var _ = Describe("AMIProvider", func() { } amis, err := awsEnv.AMIProvider.List(ctx, nodeClass) Expect(err).ToNot(HaveOccurred()) - Expect(amis).To(HaveLen(6)) + Expect(amis).To(HaveLen(4)) }) It("should succeed to resolve AMIs (Windows2019)", func() { nodeClass.Spec.AMISelectorTerms = []v1.AMISelectorTerm{{Alias: "windows2019@latest"}} @@ -260,7 +260,7 @@ var _ = Describe("AMIProvider", func() { // Only 4 of the requirements sets for the SSM aliases will resolve amis, err := awsEnv.AMIProvider.List(ctx, nodeClass) Expect(err).ToNot(HaveOccurred()) - Expect(amis).To(HaveLen(4)) + Expect(amis).To(HaveLen(3)) }) }) Context("AMI Tag Requirements", func() {