From 260a6153b1479cdac31f1dd33fd3728bd95e78dc Mon Sep 17 00:00:00 2001 From: Tibi <110664232+TiberiuGC@users.noreply.github.com> Date: Thu, 11 Jul 2024 16:50:33 +0300 Subject: [PATCH] Restrict VPC.SecurityGroup egress rules validations to self-managed nodes --- pkg/actions/nodegroup/create.go | 8 +++++--- pkg/actions/nodegroup/create_test.go | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pkg/actions/nodegroup/create.go b/pkg/actions/nodegroup/create.go index 1b386791fb..0f7aa169a9 100644 --- a/pkg/actions/nodegroup/create.go +++ b/pkg/actions/nodegroup/create.go @@ -80,9 +80,11 @@ func (m *Manager) Create(ctx context.Context, options CreateOpts, nodegroupFilte return errors.Wrapf(err, "loading VPC spec for cluster %q", meta.Name) } isOwnedCluster = false - skipEgressRules, err = validateSecurityGroup(ctx, ctl.AWSProvider.EC2(), cfg.VPC.SecurityGroup) - if err != nil { - return err + if len(cfg.NodeGroups) > 0 { + skipEgressRules, err = validateSecurityGroup(ctx, ctl.AWSProvider.EC2(), cfg.VPC.SecurityGroup) + if err != nil { + return err + } } default: diff --git a/pkg/actions/nodegroup/create_test.go b/pkg/actions/nodegroup/create_test.go index 63452fa477..23a2aafce4 100644 --- a/pkg/actions/nodegroup/create_test.go +++ b/pkg/actions/nodegroup/create_test.go @@ -1135,4 +1135,9 @@ func makeUnownedClusterConfig(clusterConfig *api.ClusterConfig) { }, }, } + clusterConfig.NodeGroups = append(clusterConfig.NodeGroups, &api.NodeGroup{ + NodeGroupBase: &api.NodeGroupBase{ + Name: "ng", + }, + }) }