Skip to content

Commit

Permalink
fix: drop neuron variant for bottlerocket AMIs (#7304)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdeal authored Oct 31, 2024
1 parent 348df5e commit 939f23b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/crds/karpenter.k8s.aws_ec2nodeclasses.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
33 changes: 1 addition & 32 deletions pkg/controllers/nodeclass/status/ami_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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())
})
Expand Down
4 changes: 2 additions & 2 deletions pkg/providers/amifamily/bottlerocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions pkg/providers/amifamily/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}}
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit 939f23b

Please sign in to comment.