Skip to content

Commit 77d2d45

Browse files
committed
use DescribeClusterVersions API instead of hardcoding EKS version data in eksctl
1 parent 5f1438b commit 77d2d45

36 files changed

+1288
-511
lines changed

go.mod

+9-9
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ require (
1414
github.com/aws/aws-sdk-go-v2 v1.32.8
1515
github.com/aws/aws-sdk-go-v2/config v1.28.9
1616
github.com/aws/aws-sdk-go-v2/credentials v1.17.50
17-
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.51.3
18-
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.56.4
19-
github.com/aws/aws-sdk-go-v2/service/cloudtrail v1.46.5
20-
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.45.2
17+
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.51.5
18+
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.56.5
19+
github.com/aws/aws-sdk-go-v2/service/cloudtrail v1.46.7
20+
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.45.4
2121
github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider v1.48.4
2222
github.com/aws/aws-sdk-go-v2/service/ec2 v1.166.0
23-
github.com/aws/aws-sdk-go-v2/service/eks v1.56.1
24-
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.28.9
25-
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.43.4
26-
github.com/aws/aws-sdk-go-v2/service/iam v1.38.3
23+
github.com/aws/aws-sdk-go-v2/service/eks v1.56.3
24+
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.28.10
25+
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.43.5
26+
github.com/aws/aws-sdk-go-v2/service/iam v1.38.5
2727
github.com/aws/aws-sdk-go-v2/service/kms v1.27.5
2828
github.com/aws/aws-sdk-go-v2/service/outposts v1.48.1
29-
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.3
29+
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.5
3030
github.com/aws/aws-sdk-go-v2/service/sts v1.33.5
3131
github.com/aws/smithy-go v1.22.1
3232
github.com/awslabs/amazon-eks-ami/nodeadm v0.0.0-20240508073157-fbfa1bc129f5

go.sum

+30
Original file line numberDiff line numberDiff line change
@@ -736,24 +736,50 @@ github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvK
736736
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc=
737737
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.51.3 h1:1QljimH+yYwrCPgmF2S/vnIE/sBEBS0IdZIvE5+bRJY=
738738
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.51.3/go.mod h1:t5bdAowh8MWq51TuDmltU+wtxMl/VaegNwSBaznkUYc=
739+
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.51.4 h1:w4Tdy9sQlJdcF5dZ9H5uRxradA9Mi2Hp4eOHQmxUJhA=
740+
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.51.4/go.mod h1:6klY3glv/b/phmA0CUj38SWNBior8rKtVvAJrAXljis=
741+
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.51.5 h1:cLKnOycNGGGV75XIk2dv5kjYLnxV4XIWVPtQfSa2qd8=
742+
github.com/aws/aws-sdk-go-v2/service/autoscaling v1.51.5/go.mod h1:6klY3glv/b/phmA0CUj38SWNBior8rKtVvAJrAXljis=
739743
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.56.4 h1:uH6So7Ee+2JQf+TKbfifXKUDNN0JfaJ6CgJ6Bh/u1sc=
740744
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.56.4/go.mod h1:GdDLBO8SzD4wvQ6fhqU1QCmvG1waj1MPHL4cBtuSgdQ=
745+
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.56.5 h1:B9a36cMvleRcLb38hgtb7q39LlKEJFcKsA0qBy+4Xgs=
746+
github.com/aws/aws-sdk-go-v2/service/cloudformation v1.56.5/go.mod h1:GdDLBO8SzD4wvQ6fhqU1QCmvG1waj1MPHL4cBtuSgdQ=
741747
github.com/aws/aws-sdk-go-v2/service/cloudtrail v1.46.5 h1:+fSJTvw91AyBSgS7iaPlSe0NVwa1DJqb6F6GClah+0s=
742748
github.com/aws/aws-sdk-go-v2/service/cloudtrail v1.46.5/go.mod h1:2lQF0aEQAXkUf/Td7RqGIuylJlJO6wSv/onvNdShVyA=
749+
github.com/aws/aws-sdk-go-v2/service/cloudtrail v1.46.6 h1:fMIPTKNUEtU0JCBtKEDH0mvhyDBYZ6dEgqpBOYB5hOU=
750+
github.com/aws/aws-sdk-go-v2/service/cloudtrail v1.46.6/go.mod h1:a2KI7mJ3kF1AdkW4Cyu0fl/6G9H+x7J7KD7BZdvLwYg=
751+
github.com/aws/aws-sdk-go-v2/service/cloudtrail v1.46.7 h1:DBhLX1P+nwIXO6xyDqLpdHoGRKAHSM1b5BECVCSNO5s=
752+
github.com/aws/aws-sdk-go-v2/service/cloudtrail v1.46.7/go.mod h1:a2KI7mJ3kF1AdkW4Cyu0fl/6G9H+x7J7KD7BZdvLwYg=
743753
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.45.2 h1:9zwK03mlPPGzTaiLh1AJS6IhOAWDYnVXfZTwdyBhQtg=
744754
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.45.2/go.mod h1:u8Bi6DG9tLOVIS9MNqtE3vh9T6I/U/8RBpYvy/VyMjc=
755+
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.45.3 h1:va7zt8/kkg5zR0TX2r7wCXssdZ4+blRxbsA6IS9XXYI=
756+
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.45.3/go.mod h1:CijDCaRp5sH8QM0LqImyzy5roG8cOtgp2Abj0V/4luk=
757+
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.45.4 h1:20qw4O1b41McWMulR1q2ZPtUjZTE78iiR54PmlmD8DE=
758+
github.com/aws/aws-sdk-go-v2/service/cloudwatchlogs v1.45.4/go.mod h1:CijDCaRp5sH8QM0LqImyzy5roG8cOtgp2Abj0V/4luk=
745759
github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider v1.48.4 h1:78+PSLTY1QcbesyoPKAnYRG+jFhcuZr17pGAQVxDTWw=
746760
github.com/aws/aws-sdk-go-v2/service/cognitoidentityprovider v1.48.4/go.mod h1:vPpQlrSaeqEX2s/iM5eqaSFUxVtBrpZFP9SOd25AZuY=
747761
github.com/aws/aws-sdk-go-v2/service/ec2 v1.166.0 h1:FDZVMxzXB13cRmHs3t3tH9gme8GhvmjsQXeXFI37OHU=
748762
github.com/aws/aws-sdk-go-v2/service/ec2 v1.166.0/go.mod h1:Wv7N3iFOKVsZNIaw9MOBUmwCkX6VMmQQRFhMrHtNGno=
749763
github.com/aws/aws-sdk-go-v2/service/eks v1.56.1 h1:TbZoGON9WoQSDC86lTA+eDCXTCqJElgM4TTiqdVcSG4=
750764
github.com/aws/aws-sdk-go-v2/service/eks v1.56.1/go.mod h1:kNUWaiotRWCnfQlprrxSMg8ALqbZyA9xLCwKXuLumSk=
765+
github.com/aws/aws-sdk-go-v2/service/eks v1.56.2 h1:NXxglcZhHubtK2SgqavDGkbArM4NYI7QvLr+FpOL3Oo=
766+
github.com/aws/aws-sdk-go-v2/service/eks v1.56.2/go.mod h1:KkH+D6VJmtIVGD9KTxB9yZu4hQP7s9kxWn8lLb7tmVg=
767+
github.com/aws/aws-sdk-go-v2/service/eks v1.56.3 h1:FqupDsZsAzlLzjZwAUJ24PA1H/P0r/O0G7u5O0Iq4T0=
768+
github.com/aws/aws-sdk-go-v2/service/eks v1.56.3/go.mod h1:KkH+D6VJmtIVGD9KTxB9yZu4hQP7s9kxWn8lLb7tmVg=
751769
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.28.9 h1:phUmuRbBmJKpPBbGx34uZJuV1PPg4u0/RMzIecVVR0E=
752770
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.28.9/go.mod h1:EH2+vt500M2IewoiYVo4rP0gfRhIXzh6BDFZ5KbidUI=
771+
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.28.10 h1:/0EH8MuNQp2bDORevPdEgQkipyCzYGh1uSKkl9Aw1Wo=
772+
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.28.10/go.mod h1:EH2+vt500M2IewoiYVo4rP0gfRhIXzh6BDFZ5KbidUI=
753773
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.43.4 h1:tC9S2BkqlMWP3N2t4UasxIhIJSNY5g7EINjz94VK+3U=
754774
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.43.4/go.mod h1:OhWF5Dd6Ge4VW/RcFQKOO0eEv1JInQJoo6/tkCjlvrM=
775+
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.43.5 h1:oEpZAvjZqy4CkpC5WApi1JBVXxxCdPWbOSB2sOaDHD4=
776+
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.43.5/go.mod h1:OhWF5Dd6Ge4VW/RcFQKOO0eEv1JInQJoo6/tkCjlvrM=
755777
github.com/aws/aws-sdk-go-v2/service/iam v1.38.3 h1:2sFIoFzU1IEL9epJWubJm9Dhrn45aTNEJuwsesaCGnk=
756778
github.com/aws/aws-sdk-go-v2/service/iam v1.38.3/go.mod h1:KzlNINwfr/47tKkEhgk0r10/OZq3rjtyWy0txL3lM+I=
779+
github.com/aws/aws-sdk-go-v2/service/iam v1.38.4 h1:440YtmP8Cn6Qp7WHYfvz2/Xzmu1v1Vox/FJnzUDDQGM=
780+
github.com/aws/aws-sdk-go-v2/service/iam v1.38.4/go.mod h1:oXqc4hmGhZpj06Zu8z+ahXhdbjq4Uw8pjN9flty0Ync=
781+
github.com/aws/aws-sdk-go-v2/service/iam v1.38.5 h1:DzMv18mXANjE3nwkTHvXW7TIBIqhKJbKu/pHR6HQfAo=
782+
github.com/aws/aws-sdk-go-v2/service/iam v1.38.5/go.mod h1:oXqc4hmGhZpj06Zu8z+ahXhdbjq4Uw8pjN9flty0Ync=
757783
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 h1:iXtILhvDxB6kPvEXgsDhGaZCSC6LQET5ZHSdJozeI0Y=
758784
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1/go.mod h1:9nu0fVANtYiAePIBh2/pFUSwtJ402hLnp854CNoDOeE=
759785
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.8 h1:cWno7lefSH6Pp+mSznagKCgfDGeZRin66UvYUqAkyeA=
@@ -766,6 +792,10 @@ github.com/aws/aws-sdk-go-v2/service/pricing v1.17.0 h1:RQOMvPwte2H4ZqsiZmrla1cr
766792
github.com/aws/aws-sdk-go-v2/service/pricing v1.17.0/go.mod h1:LJyh9figH3ZpSiVjR5umzbl6V3EpQdZR4Se1ayoUtfI=
767793
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.3 h1:QMx9lj524IOWjI1IpmcXSkHaazGBzTPgBmECzbppF5s=
768794
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.3/go.mod h1:RKWoqC9FlgMCkrfVOtgfqfwdaUIaq8H93UAt4xNaR0A=
795+
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.4 h1:oXh/PjaKtStu7RkaUtuKX6+h/OxXriMa9WyQQhylKG0=
796+
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.4/go.mod h1:IiHGbiFg4wVdEKrvFi/zxVZbjfEpgSe21N9RwyQFXCU=
797+
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.5 h1:ZQorDO4+5xcNiQKvkg5cGVDPgtwnjglmDBCPRoEM6oU=
798+
github.com/aws/aws-sdk-go-v2/service/ssm v1.56.5/go.mod h1:IiHGbiFg4wVdEKrvFi/zxVZbjfEpgSe21N9RwyQFXCU=
769799
github.com/aws/aws-sdk-go-v2/service/sso v1.24.9 h1:YqtxripbjWb2QLyzRK9pByfEDvgg95gpC2AyDq4hFE8=
770800
github.com/aws/aws-sdk-go-v2/service/sso v1.24.9/go.mod h1:lV8iQpg6OLOfBnqbGMBKYjilBlf633qwHnBEiMSPoHY=
771801
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.8 h1:6dBT1Lz8fK11m22R+AqfRsFn8320K0T5DTGxxOQBSMw=

integration/tests/addons/addons_test.go

+6-6
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ var _ = BeforeSuite(func() {
7272
rawClient = getRawClient(context.Background(), params.ClusterName)
7373
serverVersion, err := rawClient.ServerVersion()
7474
Expect(err).NotTo(HaveOccurred())
75-
Expect(serverVersion).To(HavePrefix(api.LatestVersion))
75+
Expect(serverVersion).To(HavePrefix(api.DefaultVersion))
7676

7777
})
7878

@@ -445,7 +445,7 @@ var _ = Describe("(Integration) [EKS Addons test]", func() {
445445
cmd := params.EksctlUtilsCmd.
446446
WithArgs(
447447
"describe-addon-versions",
448-
"--kubernetes-version", api.LatestVersion,
448+
"--kubernetes-version", api.DefaultVersion,
449449
)
450450
Expect(cmd).To(RunSuccessfullyWithOutputStringLines(
451451
ContainElement(ContainSubstring("vpc-cni")),
@@ -459,7 +459,7 @@ var _ = Describe("(Integration) [EKS Addons test]", func() {
459459
By(fmt.Sprintf("listing available addon versions for %s", addonWithSchema))
460460
output, err := eksAPI.DescribeAddonVersions(context.Background(), &awseks.DescribeAddonVersionsInput{
461461
AddonName: aws.String(addonWithSchema),
462-
KubernetesVersion: aws.String(api.LatestVersion),
462+
KubernetesVersion: aws.String(api.DefaultVersion),
463463
})
464464
Expect(err).NotTo(HaveOccurred(), "error describing addon versions")
465465
By(fmt.Sprintf("fetching the configuration schema for %s", addonWithSchema))
@@ -482,7 +482,7 @@ var _ = Describe("(Integration) [EKS Addons test]", func() {
482482
cmd := params.EksctlUtilsCmd.
483483
WithArgs(
484484
"describe-addon-versions",
485-
"--kubernetes-version", api.LatestVersion,
485+
"--kubernetes-version", api.DefaultVersion,
486486
"--types", "networking",
487487
"--owners", "aws",
488488
"--publishers", "eks",
@@ -498,7 +498,7 @@ var _ = Describe("(Integration) [EKS Addons test]", func() {
498498
cmd := params.EksctlUtilsCmd.
499499
WithArgs(
500500
"describe-addon-versions",
501-
"--kubernetes-version", api.LatestVersion,
501+
"--kubernetes-version", api.DefaultVersion,
502502
"--types", "networking, storage",
503503
)
504504
Expect(cmd).To(RunSuccessfullyWithOutputStringLines(
@@ -860,7 +860,7 @@ func getRawClient(ctx context.Context, clusterName string) *kubewrapper.RawClien
860860
func getInitialClusterConfig() *api.ClusterConfig {
861861
clusterConfig := api.NewClusterConfig()
862862
clusterConfig.Metadata.Name = params.ClusterName
863-
clusterConfig.Metadata.Version = api.LatestVersion
863+
clusterConfig.Metadata.Version = api.DefaultVersion
864864
clusterConfig.Metadata.Region = params.Region
865865
clusterConfig.IAM.WithOIDC = api.Enabled()
866866
clusterConfig.Addons = []*api.Addon{

integration/tests/dry_run/dry_run_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func TestDryRun(t *testing.T) {
4747
testutils.RegisterAndRun(t)
4848
}
4949

50-
const eksVersion = api.LatestVersion
50+
const eksVersion = api.DefaultVersion
5151

5252
const defaultClusterConfig = `
5353
apiVersion: eksctl.io/v1alpha5

integration/tests/ipv6/ipv6_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ var _ = BeforeSuite(func() {
5656

5757
clusterConfig = api.NewClusterConfig()
5858
clusterConfig.Metadata.Name = params.ClusterName
59-
clusterConfig.Metadata.Version = api.LatestVersion
59+
clusterConfig.Metadata.Version = api.DefaultVersion
6060
clusterConfig.Metadata.Region = params.Region
6161
clusterConfig.KubernetesNetworkConfig.IPFamily = "iPv6"
6262
clusterConfig.VPC.NAT = nil

integration/tests/unowned_cluster/unowned_cluster_test.go

+7-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ var _ = BeforeSuite(func() {
5959
mng2 = "mng-2"
6060
stackName = fmt.Sprintf("eksctl-%s", params.ClusterName)
6161

62-
version, upgradeVersion = clusterutils.GetCurrentAndNextVersionsForUpgrade(params.Version)
62+
clusterProvider, err := eks.New(context.Background(), &api.ProviderConfig{Region: params.Region}, cfg)
63+
Expect(err).NotTo(HaveOccurred())
64+
65+
cvm, err := eks.NewClusterVersionsManager(clusterProvider.AWSProvider.EKS())
66+
Expect(err).NotTo(HaveOccurred())
67+
68+
version, upgradeVersion = clusterutils.GetCurrentAndNextVersionsForUpgrade(cvm, params.Version)
6369

6470
cfg = &api.ClusterConfig{
6571
TypeMeta: api.ClusterConfigTypeMeta(),
@@ -71,8 +77,6 @@ var _ = BeforeSuite(func() {
7177
}
7278

7379
if !params.SkipCreate {
74-
clusterProvider, err := eks.New(context.Background(), &api.ProviderConfig{Region: params.Region}, cfg)
75-
Expect(err).NotTo(HaveOccurred())
7680
ctl = clusterProvider.AWSProvider
7781
ctx := context.Background()
7882
cfg.VPC = createClusterWithNodeGroup(ctx, params.ClusterName, stackName, mng1, version, ctl)

integration/tests/update/update_cluster_test.go

+15-20
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,20 @@ var _ = BeforeSuite(func() {
9494

9595
fmt.Fprintf(GinkgoWriter, "Using kubeconfig: %s\n", params.KubeconfigPath)
9696

97-
eksVersion, nextEKSVersion = clusterutils.GetCurrentAndNextVersionsForUpgrade(params.Version)
97+
cfg := &api.ClusterConfig{
98+
Metadata: &api.ClusterMeta{
99+
Name: params.ClusterName,
100+
Region: params.Region,
101+
},
102+
}
103+
var err error
104+
clusterProvider, err = eks.New(context.Background(), &api.ProviderConfig{Region: params.Region}, cfg)
105+
Expect(err).NotTo(HaveOccurred())
106+
107+
cvm, err := eks.NewClusterVersionsManager(clusterProvider.AWSProvider.EKS())
108+
Expect(err).NotTo(HaveOccurred())
109+
110+
eksVersion, nextEKSVersion = clusterutils.GetCurrentAndNextVersionsForUpgrade(cvm, params.Version)
98111

99112
clusterConfig := api.NewClusterConfig()
100113
clusterConfig.Metadata.Name = defaultCluster
@@ -141,8 +154,7 @@ var _ = BeforeSuite(func() {
141154
WithStdin(clusterutils.Reader(clusterConfig))
142155
Expect(cmd).To(RunSuccessfully())
143156

144-
var err error
145-
clusterProvider, err = newClusterProvider(context.Background())
157+
err = clusterProvider.RefreshClusterStatus(context.Background(), cfg)
146158
Expect(err).NotTo(HaveOccurred())
147159
})
148160

@@ -327,23 +339,6 @@ var _ = AfterSuite(func() {
327339
os.RemoveAll(params.TestDirectory)
328340
})
329341

330-
func newClusterProvider(ctx context.Context) (*eks.ClusterProvider, error) {
331-
cfg := &api.ClusterConfig{
332-
Metadata: &api.ClusterMeta{
333-
Name: params.ClusterName,
334-
Region: params.Region,
335-
},
336-
}
337-
ctl, err := eks.New(ctx, &api.ProviderConfig{Region: params.Region}, cfg)
338-
if err != nil {
339-
return nil, err
340-
}
341-
if err := ctl.RefreshClusterStatus(ctx, cfg); err != nil {
342-
return nil, err
343-
}
344-
return ctl, nil
345-
}
346-
347342
func defaultClusterConfig() *api.ClusterConfig {
348343
return &api.ClusterConfig{
349344
Metadata: &api.ClusterMeta{

integration/tests/windows/windows_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var _ = Describe("(Integration) [Windows Nodegroups]", func() {
4242
By("creating a new cluster with Windows nodegroups")
4343
clusterConfig := api.NewClusterConfig()
4444
clusterConfig.Metadata.Name = clusterName
45-
clusterConfig.Metadata.Version = api.LatestVersion
45+
clusterConfig.Metadata.Version = api.DefaultVersion
4646
clusterConfig.Metadata.Region = api.DefaultRegion
4747
clusterConfig.IAM.WithOIDC = &withOIDC
4848

integration/utilities/cluster/cluster.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ func ParseClusterConfig(clusterName, region, filename string) *api.ClusterConfig
3535
return clusterConfig
3636
}
3737

38-
func GetCurrentAndNextVersionsForUpgrade(testVersion string) (currentVersion, nextVersion string) {
39-
supportedVersions := api.SupportedVersions()
38+
func GetCurrentAndNextVersionsForUpgrade(cvm eks.ClusterVersionsManagerInterface, testVersion string) (currentVersion, nextVersion string) {
39+
supportedVersions := cvm.SupportedVersions()
4040
if len(supportedVersions) < 2 {
4141
Fail("Upgrade test requires at least two supported EKS versions")
4242
}
4343

4444
// if latest version is used, fetch previous version to upgrade from
45-
if testVersion == api.LatestVersion {
45+
if testVersion == cvm.LatestVersion() {
4646
previousVersionIndex := slices.Index(supportedVersions, testVersion) - 1
4747
currentVersion = supportedVersions[previousVersionIndex]
4848
nextVersion = testVersion

pkg/actions/addon/update_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ var _ = Describe("Update", func() {
562562
}, nil).Once()
563563
mockProvider.MockEKS().On("DescribeAddonVersions", mock.Anything, &awseks.DescribeAddonVersionsInput{
564564
AddonName: aws.String("vpc-cni"),
565-
KubernetesVersion: aws.String(api.LatestVersion),
565+
KubernetesVersion: aws.String(api.DefaultVersion),
566566
}).Return(&awseks.DescribeAddonVersionsOutput{
567567
Addons: []ekstypes.AddonInfo{
568568
{
@@ -636,7 +636,7 @@ var _ = Describe("Update", func() {
636636

637637
addonManager, err := addon.New(&api.ClusterConfig{
638638
Metadata: &api.ClusterMeta{
639-
Version: api.LatestVersion,
639+
Version: api.Version1_30,
640640
Name: clusterName,
641641
},
642642
AddonsConfig: e.addonsConfig,

0 commit comments

Comments
 (0)