Skip to content

Commit

Permalink
test: update old static AMI for k8s 1.29+ for drift
Browse files Browse the repository at this point in the history
  • Loading branch information
jmdeal committed Jan 31, 2024
1 parent 4a9f2d0 commit 0b7d131
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions test/suites/drift/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ package drift_test
import (
"fmt"
"sort"
"strconv"
"strings"
"testing"
"time"

Expand Down Expand Up @@ -311,10 +313,12 @@ var _ = Describe("Drift", func() {
})
})
It("should disrupt nodes that have drifted due to AMIs", func() {
// choose an old static image
parameter, err := env.SSMAPI.GetParameter(&ssm.GetParameterInput{
Name: awssdk.String("/aws/service/eks/optimized-ami/1.23/amazon-linux-2/amazon-eks-node-1.23-v20230322/image_id"),
})
// Choose and old, static image. The 1.23 image is incompatible with EKS 1.29 so fallback to a newer image.
parameterName := lo.Ternary(lo.Must(strconv.Atoi(strings.Split(env.GetK8sVersion(0), ".")[1])) >= 29,
"/aws/service/eks/optimized-ami/1.27/amazon-linux-2/amazon-eks-node-1.27-v20240129/image_id",
"/aws/service/eks/optimized-ami/1.23/amazon-linux-2/amazon-eks-node-1.23-v20230322/image_id",
)
parameter, err := env.SSMAPI.GetParameter(&ssm.GetParameterInput{Name: awssdk.String(parameterName)})
Expect(err).To(BeNil())
oldCustomAMI := *parameter.Parameter.Value
nodeClass.Spec.AMIFamily = &v1beta1.AMIFamilyCustom
Expand Down

0 comments on commit 0b7d131

Please sign in to comment.