Skip to content

Commit 2395f48

Browse files
committed
Test Bottlerocket node upgrade and verify version
1 parent 09523fb commit 2395f48

File tree

1 file changed

+79
-12
lines changed

1 file changed

+79
-12
lines changed

integration/tests/update/update_cluster_test.go

+79-12
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/hashicorp/go-version"
1414

1515
"github.com/aws/aws-sdk-go-v2/service/eks/types"
16+
"github.com/aws/aws-sdk-go/aws"
1617
. "github.com/onsi/ginkgo/v2"
1718
. "github.com/onsi/gomega"
1819
"github.com/onsi/gomega/gexec"
@@ -60,6 +61,7 @@ var (
6061

6162
const (
6263
initNG = "kp-ng-0"
64+
botNG = "bot-ng-0"
6365
)
6466

6567
var _ = BeforeSuite(func() {
@@ -91,23 +93,55 @@ var _ = BeforeSuite(func() {
9193

9294
eksVersion, nextEKSVersion = clusterutils.GetCurrentAndNextVersionsForUpgrade(params.Version)
9395

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+
94131
cmd := params.EksctlCreateCmd.WithArgs(
95132
"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", "-",
104134
"--kubeconfig", params.KubeconfigPath,
105-
)
135+
"--verbose", "4",
136+
).
137+
WithoutArg("--region", params.Region).
138+
WithStdin(clusterutils.Reader(clusterConfig))
106139
Expect(cmd).To(RunSuccessfully())
107140
})
108-
var _ = Describe("(Integration) Update addons", func() {
109141

110-
Context("update cluster and addons", func() {
142+
var _ = Describe("(Integration) Upgrading cluster", func() {
143+
144+
Context("control plane", func() {
111145
It("should have created an EKS cluster and two CloudFormation stacks", func() {
112146
config := NewConfig(params.Region)
113147

@@ -139,7 +173,9 @@ var _ = Describe("(Integration) Update addons", func() {
139173
return fmt.Sprintf("%s.%s", serverVersion.Major, strings.TrimSuffix(serverVersion.Minor, "+"))
140174
}, k8sUpdatePollTimeout, k8sUpdatePollInterval).Should(Equal(nextEKSVersion))
141175
})
176+
})
142177

178+
Context("addons", func() {
143179
It("should upgrade kube-proxy", func() {
144180
cmd := params.EksctlUtilsCmd.WithArgs(
145181
"update-kube-proxy",
@@ -195,7 +231,10 @@ var _ = Describe("(Integration) Update addons", func() {
195231
Expect(cmd).To(RunSuccessfully())
196232
})
197233

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() {
199238
cmd := params.EksctlUpgradeCmd.WithArgs(
200239
"nodegroup",
201240
"--verbose", "4",
@@ -205,6 +244,34 @@ var _ = Describe("(Integration) Update addons", func() {
205244
"--timeout=60m", // wait for CF stacks to finish update
206245
)
207246
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))))
208275
})
209276
})
210277
})

0 commit comments

Comments
 (0)