Skip to content

Commit

Permalink
Fix AMISelectorTerms testing
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed Oct 22, 2023
1 parent d3ee048 commit 7b85921
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 13 deletions.
4 changes: 4 additions & 0 deletions test/pkg/environment/aws/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ import (

const WindowsDefaultImage = "mcr.microsoft.com/oss/kubernetes/pause:3.9"

// ExcludedInstanceFamilies denotes instance families that have issues during resource registration due to compatability
// issues with versions of the VPR Resource Controller
var ExcludedInstanceFamilies = []string{"m7a", "r7a", "c7a", "r7i"}

type Environment struct {
*common.Environment
Region string
Expand Down
6 changes: 3 additions & 3 deletions test/suites/alpha/drift/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ var _ = Describe("Drift", Label("AWS"), func() {

// Drift should fail and the original node should be uncordoned
// TODO: reduce timeouts when deprovisioning waits are factored out
env.EventuallyExpectNodesUncordonedLegacyWithTimeout(12*time.Minute, cordonedNodes...)
env.EventuallyExpectNodesUncordonedLegacyWithTimeout(11*time.Minute, cordonedNodes...)

Eventually(func(g Gomega) {
machines := &v1alpha5.MachineList{}
Expand Down Expand Up @@ -433,8 +433,8 @@ var _ = Describe("Drift", Label("AWS"), func() {
cordonedNodes := env.EventuallyExpectCordonedNodeCountLegacy("==", 1)

// Drift should fail and original node should be uncordoned
// TODO: reduce timeouts when deprovisioning waits are factored outr
env.EventuallyExpectNodesUncordonedLegacyWithTimeout(12*time.Minute, cordonedNodes...)
// TODO: reduce timeouts when deprovisioning waits are factored out
env.EventuallyExpectNodesUncordonedLegacyWithTimeout(11*time.Minute, cordonedNodes...)

// Expect that the new machine/node is kept around after the un-cordon
nodeList := &v1.NodeList{}
Expand Down
5 changes: 3 additions & 2 deletions test/suites/beta/drift/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ var _ = Describe("Beta/Drift", Label("AWS"), func() {
// TODO: reduce timeouts when disruption waits are factored out
env.EventuallyExpectNodesUncordonedWithTimeout(11*time.Minute, cordonedNodes...)

// We give another 6 minutes here to handle the deletion at the 15m registration timeout
Eventually(func(g Gomega) {
nodeClaims := &corev1beta1.NodeClaimList{}
g.Expect(env.Client.List(env, nodeClaims, client.HasLabels{test.DiscoveryLabel})).To(Succeed())
Expand Down Expand Up @@ -485,8 +486,8 @@ var _ = Describe("Beta/Drift", Label("AWS"), func() {
cordonedNodes := env.EventuallyExpectCordonedNodeCount("==", 1)

// Drift should fail and original node should be uncordoned
// TODO: reduce timeouts when disruption waits are factored outr
env.EventuallyExpectNodesUncordonedWithTimeout(12*time.Minute, cordonedNodes...)
// TODO: reduce timeouts when disruption waits are factored out
env.EventuallyExpectNodesUncordonedWithTimeout(11*time.Minute, cordonedNodes...)

// Expect that the new nodeClaim/node is kept around after the un-cordon
nodeList := &v1.NodeList{}
Expand Down
13 changes: 9 additions & 4 deletions test/suites/beta/integration/ami_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,13 @@ var _ = Describe("AMI", func() {
customAMI = env.GetCustomAMI("/aws/service/eks/optimized-ami/%s/amazon-linux-2/recommended/image_id", 1)
})

It("should use the AMI defined by the AMI Selector", func() {
It("should use the AMI defined by the AMI Selector Terms", func() {
pod := coretest.Pod()
nodeClass.Spec.AMISelectorTerms = []v1beta1.AMISelectorTerm{
{
ID: customAMI,
},
}
env.ExpectCreated(pod, nodeClass, nodePool)
env.EventuallyExpectHealthy(pod)
env.ExpectCreatedNodeCount("==", 1)
Expand Down Expand Up @@ -74,7 +79,7 @@ var _ = Describe("AMI", func() {

env.ExpectInstance(pod.Spec.NodeName).To(HaveField("ImageId", HaveValue(Equal(customAMI))))
})
It("should support ami selector Name but fail with incorrect owners", func() {
It("should support AMI Selector Terms for Name but fail with incorrect owners", func() {
output, err := env.EC2API.DescribeImages(&ec2.DescribeImagesInput{
ImageIds: []*string{aws.String(customAMI)},
})
Expand Down Expand Up @@ -155,7 +160,7 @@ var _ = Describe("AMI", func() {
{
Key: v1beta1.LabelInstanceFamily,
Operator: v1.NodeSelectorOpNotIn,
Values: []string{"m7a", "r7a", "c7a"},
Values: awsenv.ExcludedInstanceFamilies,
},
{
Key: v1beta1.LabelInstanceCategory,
Expand Down Expand Up @@ -290,7 +295,7 @@ var _ = Describe("AMI", func() {
{
Key: v1beta1.LabelInstanceFamily,
Operator: v1.NodeSelectorOpNotIn,
Values: []string{"m7a", "r7a", "c7a"},
Values: awsenv.ExcludedInstanceFamilies,
},
{
Key: v1beta1.LabelInstanceCategory,
Expand Down
3 changes: 2 additions & 1 deletion test/suites/beta/integration/extended_resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (

"github.com/aws/karpenter-core/pkg/test"
"github.com/aws/karpenter/pkg/apis/v1beta1"
awsenv "github.com/aws/karpenter/test/pkg/environment/aws"
)

var _ = Describe("Extended Resources", func() {
Expand Down Expand Up @@ -95,7 +96,7 @@ var _ = Describe("Extended Resources", func() {
{
Key: v1beta1.LabelInstanceFamily,
Operator: v1.NodeSelectorOpNotIn,
Values: []string{"m7a", "r7a", "c7a"},
Values: awsenv.ExcludedInstanceFamilies,
},
{
Key: v1beta1.LabelInstanceCategory,
Expand Down
4 changes: 2 additions & 2 deletions test/suites/beta/integration/kubelet_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var _ = Describe("KubeletConfiguration Overrides", func() {
{
Key: v1beta1.LabelInstanceFamily,
Operator: v1.NodeSelectorOpNotIn,
Values: []string{"m7a", "r7a", "c7a"},
Values: aws.ExcludedInstanceFamilies,
},
{
Key: v1beta1.LabelInstanceCategory,
Expand Down Expand Up @@ -133,7 +133,7 @@ var _ = Describe("KubeletConfiguration Overrides", func() {
{
Key: v1beta1.LabelInstanceFamily,
Operator: v1.NodeSelectorOpNotIn,
Values: []string{"m7a", "r7a", "c7a"},
Values: aws.ExcludedInstanceFamilies,
},
{
Key: v1beta1.LabelInstanceCategory,
Expand Down
2 changes: 1 addition & 1 deletion test/suites/beta/integration/scheduling_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ var _ = Describe("Scheduling", Ordered, ContinueOnFailure, func() {
{
Key: v1beta1.LabelInstanceFamily,
Operator: v1.NodeSelectorOpNotIn,
Values: []string{"m7a", "r7a", "c7a"},
Values: aws.ExcludedInstanceFamilies,
},
{
Key: v1beta1.LabelInstanceCategory,
Expand Down

0 comments on commit 7b85921

Please sign in to comment.