Skip to content

Commit

Permalink
fix: disable AMI lookup for fully private clusters (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaroniscode authored Nov 2, 2023
1 parent 7ba827a commit c703756
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
2 changes: 2 additions & 0 deletions pkg/resource/cluster/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 15 additions & 14 deletions pkg/resource/nodegroup/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit c703756

Please sign in to comment.