From c7037565432c062f75f608b14bf08ca1a1f42293 Mon Sep 17 00:00:00 2001 From: Aaron Miller <1521726+aaroniscode@users.noreply.github.com> Date: Thu, 2 Nov 2023 16:30:57 -0700 Subject: [PATCH] fix: disable AMI lookup for fully private clusters (#130) --- pkg/resource/cluster/options.go | 2 ++ pkg/resource/nodegroup/options.go | 29 +++++++++++++++-------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/pkg/resource/cluster/options.go b/pkg/resource/cluster/options.go index 4b553e4..b0d6f23 100644 --- a/pkg/resource/cluster/options.go +++ b/pkg/resource/cluster/options.go @@ -179,6 +179,8 @@ func (o *ClusterOptions) PreCreate() error { o.Account = aws.AccountId() o.Partition = aws.Partition() o.Region = aws.Region() + + o.NodegroupOptions.IsClusterPrivate = o.Private o.NodegroupOptions.KubernetesVersion = o.KubernetesVersion // For apps we want to pre-create IRSA for, find the IRSA dependency diff --git a/pkg/resource/nodegroup/options.go b/pkg/resource/nodegroup/options.go index 35acec5..d26f207 100644 --- a/pkg/resource/nodegroup/options.go +++ b/pkg/resource/nodegroup/options.go @@ -24,18 +24,19 @@ const eksOptmizedGpuAmiPath = "/aws/service/eks/optimized-ami/%s/amazon-linux-2- type NodegroupOptions struct { *resource.CommonOptions - AMI string - InstanceType string - DesiredCapacity int - MinSize int - MaxSize int - NodegroupName string - NoTaints bool - OperatingSystem string - Spot bool - SpotvCPUs int - SpotMemory int - Taints []Taint + AMI string + InstanceType string + IsClusterPrivate bool + DesiredCapacity int + MinSize int + MaxSize int + NodegroupName string + NoTaints bool + OperatingSystem string + Spot bool + SpotvCPUs int + SpotMemory int + Taints []Taint UpdateDesired int UpdateMin int @@ -212,8 +213,8 @@ func (o *NodegroupOptions) PreCreate() error { o.Taints = append(o.Taints, Taint{Key: "nvidia.com/gpu", Effect: "NoSchedule"}) } - // AMI Lookup is currently only for Amazon Linux 2 EKS Optimized AMI - if o.OperatingSystem != "AmazonLinux2" { + // AMI Lookup is currently only for Amazon Linux 2 EKS Optimized AMI and clusters that aren't fully private + if o.OperatingSystem != "AmazonLinux2" || o.IsClusterPrivate { return nil }