Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return an error when container runtime and overrideBootstrapCommand are defined together #5365

Merged
merged 7 commits into from
Jun 8, 2022
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

Next Next commit
Return an error in case container runtime and overrideBootstrapComman…
…d is defined
Rate limit · GitHub

Access has been restricted

You have triggered a rate limit.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

Skarlso committed Jun 1, 2022
commit 1a6d49c4230789fb30482945862705678f6a1c3e
3 changes: 3 additions & 0 deletions pkg/apis/eksctl.io/v1alpha5/validation.go
Original file line number Diff line number Diff line change
@@ -725,6 +725,9 @@ func ValidateNodeGroup(i int, ng *NodeGroup) error {
if *ng.ContainerRuntime != ContainerRuntimeDockerD && *ng.ContainerRuntime != ContainerRuntimeContainerD && *ng.ContainerRuntime != ContainerRuntimeDockerForWindows {
return fmt.Errorf("only %s, %s and %s are supported for container runtime", ContainerRuntimeContainerD, ContainerRuntimeDockerD, ContainerRuntimeDockerForWindows)
}
if ng.OverrideBootstrapCommand != nil {
return fmt.Errorf("overrideBootstrapCommand overwrites container runtime setting; please use --container-runtime in the boostrap script instead")
}
}

if ng.MaxInstanceLifetime != nil {
11 changes: 11 additions & 0 deletions pkg/apis/eksctl.io/v1alpha5/validation_test.go
Original file line number Diff line number Diff line change
@@ -128,6 +128,17 @@ var _ = Describe("ClusterConfig validation", func() {
err = api.ValidateNodeGroup(0, ng0)
Expect(err).NotTo(HaveOccurred())
})

It("containerd cannot be set together with overrideBootstrapCommand", func() {
cfg := api.NewClusterConfig()
ng0 := cfg.NewNodeGroup()
ng0.Name = "node-group"
ng0.AMIFamily = api.NodeImageFamilyAmazonLinux2
ng0.ContainerRuntime = aws.String(api.ContainerRuntimeContainerD)
ng0.OverrideBootstrapCommand = aws.String("bootstrap command")
err := api.ValidateNodeGroup(0, ng0)
Expect(err).To(MatchError(ContainSubstring("overrideBootstrapCommand overwrites container runtime setting; please use --container-runtime in the boostrap script instead")))
})
})

Describe("nodeGroups[*].ami validation", func() {