@@ -13,6 +13,7 @@ import (
13
13
"github.com/hashicorp/go-version"
14
14
15
15
"github.com/aws/aws-sdk-go-v2/service/eks/types"
16
+ "github.com/aws/aws-sdk-go/aws"
16
17
. "github.com/onsi/ginkgo/v2"
17
18
. "github.com/onsi/gomega"
18
19
"github.com/onsi/gomega/gexec"
60
61
61
62
const (
62
63
initNG = "kp-ng-0"
64
+ botNG = "bot-ng-0"
63
65
)
64
66
65
67
var _ = BeforeSuite (func () {
@@ -91,23 +93,55 @@ var _ = BeforeSuite(func() {
91
93
92
94
eksVersion , nextEKSVersion = clusterutils .GetCurrentAndNextVersionsForUpgrade (params .Version )
93
95
96
+ clusterConfig := api .NewClusterConfig ()
97
+ clusterConfig .Metadata .Name = defaultCluster
98
+ clusterConfig .Metadata .Region = params .Region
99
+ clusterConfig .Metadata .Version = eksVersion
100
+ clusterConfig .Metadata .Tags = map [string ]string {
101
+ "alpha.eksctl.io/description" : "eksctl integration test" ,
102
+ }
103
+ clusterConfig .ManagedNodeGroups = []* api.ManagedNodeGroup {
104
+ {
105
+ NodeGroupBase : & api.NodeGroupBase {
106
+ Name : initNG ,
107
+ InstanceType : "t3.large" ,
108
+ ScalingConfig : & api.ScalingConfig {
109
+ DesiredCapacity : aws .Int (1 ),
110
+ },
111
+ Labels : map [string ]string {
112
+ "ng-name" : initNG ,
113
+ },
114
+ },
115
+ },
116
+ {
117
+ NodeGroupBase : & api.NodeGroupBase {
118
+ Name : botNG ,
119
+ AMIFamily : api .NodeImageFamilyBottlerocket ,
120
+ InstanceType : "t3.small" ,
121
+ ScalingConfig : & api.ScalingConfig {
122
+ DesiredCapacity : aws .Int (1 ),
123
+ },
124
+ Labels : map [string ]string {
125
+ "ng-name" : botNG ,
126
+ },
127
+ },
128
+ },
129
+ }
130
+
94
131
cmd := params .EksctlCreateCmd .WithArgs (
95
132
"cluster" ,
96
- "--verbose" , "4" ,
97
- "--name" , defaultCluster ,
98
- "--tags" , "alpha.eksctl.io/description=eksctl integration test" ,
99
- "--nodegroup-name" , initNG ,
100
- "--node-labels" , "ng-name=" + initNG ,
101
- "--nodes" , "1" ,
102
- "--node-type" , "t3.large" ,
103
- "--version" , eksVersion ,
133
+ "--config-file" , "-" ,
104
134
"--kubeconfig" , params .KubeconfigPath ,
105
- )
135
+ "--verbose" , "4" ,
136
+ ).
137
+ WithoutArg ("--region" , params .Region ).
138
+ WithStdin (clusterutils .Reader (clusterConfig ))
106
139
Expect (cmd ).To (RunSuccessfully ())
107
140
})
108
- var _ = Describe ("(Integration) Update addons" , func () {
109
141
110
- Context ("update cluster and addons" , func () {
142
+ var _ = Describe ("(Integration) Upgrading cluster" , func () {
143
+
144
+ Context ("control plane" , func () {
111
145
It ("should have created an EKS cluster and two CloudFormation stacks" , func () {
112
146
config := NewConfig (params .Region )
113
147
@@ -139,7 +173,9 @@ var _ = Describe("(Integration) Update addons", func() {
139
173
return fmt .Sprintf ("%s.%s" , serverVersion .Major , strings .TrimSuffix (serverVersion .Minor , "+" ))
140
174
}, k8sUpdatePollTimeout , k8sUpdatePollInterval ).Should (Equal (nextEKSVersion ))
141
175
})
176
+ })
142
177
178
+ Context ("addons" , func () {
143
179
It ("should upgrade kube-proxy" , func () {
144
180
cmd := params .EksctlUtilsCmd .WithArgs (
145
181
"update-kube-proxy" ,
@@ -195,7 +231,10 @@ var _ = Describe("(Integration) Update addons", func() {
195
231
Expect (cmd ).To (RunSuccessfully ())
196
232
})
197
233
198
- It ("should upgrade the nodegroup to the next version" , func () {
234
+ })
235
+
236
+ Context ("nodegroup" , func () {
237
+ It ("should upgrade the initial nodegroup to the next version" , func () {
199
238
cmd := params .EksctlUpgradeCmd .WithArgs (
200
239
"nodegroup" ,
201
240
"--verbose" , "4" ,
@@ -205,6 +244,34 @@ var _ = Describe("(Integration) Update addons", func() {
205
244
"--timeout=60m" , // wait for CF stacks to finish update
206
245
)
207
246
ExpectWithOffset (1 , cmd ).To (RunSuccessfullyWithOutputString (ContainSubstring ("nodegroup successfully upgraded" )))
247
+
248
+ cmd = params .EksctlGetCmd .WithArgs (
249
+ "nodegroup" ,
250
+ "--cluster" , params .ClusterName ,
251
+ "--name" , initNG ,
252
+ "--output" , "yaml" ,
253
+ )
254
+ ExpectWithOffset (1 , cmd ).To (RunSuccessfullyWithOutputString (ContainSubstring (fmt .Sprintf ("Version: \" %s\" " , nextEKSVersion ))))
255
+ })
256
+
257
+ It ("should upgrade the Bottlerocket nodegroup to the next version" , func () {
258
+ cmd := params .EksctlUpgradeCmd .WithArgs (
259
+ "nodegroup" ,
260
+ "--verbose" , "4" ,
261
+ "--cluster" , params .ClusterName ,
262
+ "--name" , botNG ,
263
+ "--kubernetes-version" , nextEKSVersion ,
264
+ "--timeout=60m" , // wait for CF stacks to finish update
265
+ )
266
+ ExpectWithOffset (1 , cmd ).To (RunSuccessfullyWithOutputString (ContainSubstring ("nodegroup successfully upgraded" )))
267
+
268
+ cmd = params .EksctlGetCmd .WithArgs (
269
+ "nodegroup" ,
270
+ "--cluster" , params .ClusterName ,
271
+ "--name" , botNG ,
272
+ "--output" , "yaml" ,
273
+ )
274
+ ExpectWithOffset (1 , cmd ).To (RunSuccessfullyWithOutputString (ContainSubstring (fmt .Sprintf ("Version: \" %s\" " , nextEKSVersion ))))
208
275
})
209
276
})
210
277
})
0 commit comments