From de74c5bafe288a30d090d9fc22672a195b0b4b70 Mon Sep 17 00:00:00 2001 From: Tibi <110664232+TiberiuGC@users.noreply.github.com> Date: Thu, 28 Mar 2024 19:38:39 +0200 Subject: [PATCH] add validation error for maxpods limitation --- pkg/apis/eksctl.io/v1alpha5/validation.go | 4 ++++ pkg/apis/eksctl.io/v1alpha5/validation_test.go | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/pkg/apis/eksctl.io/v1alpha5/validation.go b/pkg/apis/eksctl.io/v1alpha5/validation.go index a296abcb10..b49144ba7a 100644 --- a/pkg/apis/eksctl.io/v1alpha5/validation.go +++ b/pkg/apis/eksctl.io/v1alpha5/validation.go @@ -1187,6 +1187,10 @@ func ValidateManagedNodeGroup(index int, ng *ManagedNodeGroup) error { } } + if ng.AMIFamily == NodeImageFamilyAmazonLinux2023 && ng.MaxPodsPerNode > 0 { + return errors.Errorf("eksctl does not support configuring maxPodsPerNode EKS-managed nodes based on %s", NodeImageFamilyAmazonLinux2023) + } + if ng.AMIFamily == NodeImageFamilyBottlerocket { fieldNotSupported := func(field string) error { return &unsupportedFieldError{ diff --git a/pkg/apis/eksctl.io/v1alpha5/validation_test.go b/pkg/apis/eksctl.io/v1alpha5/validation_test.go index 45eea4fa7f..cecec152d1 100644 --- a/pkg/apis/eksctl.io/v1alpha5/validation_test.go +++ b/pkg/apis/eksctl.io/v1alpha5/validation_test.go @@ -2092,6 +2092,16 @@ var _ = Describe("ClusterConfig validation", func() { }) }) + Describe("AmazonLinux2023 node groups", func() { + It("returns an error when setting maxPodsPerNode for managed nodegroups", func() { + ng := api.NewManagedNodeGroup() + ng.AMIFamily = api.NodeImageFamilyAmazonLinux2023 + ng.MaxPodsPerNode = 5 + err := api.ValidateManagedNodeGroup(0, ng) + Expect(err).To(MatchError(ContainSubstring("eksctl does not support configuring maxPodsPerNode EKS-managed nodes"))) + }) + }) + Describe("Windows node groups", func() { It("returns an error with unsupported fields", func() { doc := api.InlineDocument{