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

bug: placement group should not be added for reservation #8220

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions pkg/cfn/builder/managed_launch_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"github.com/awslabs/goformation/v4/cloudformation/cloudformation"
gfnec2 "github.com/awslabs/goformation/v4/cloudformation/ec2"
gfnt "github.com/awslabs/goformation/v4/cloudformation/types"
"github.com/kris-nova/logger"

api "github.com/weaveworks/eksctl/pkg/apis/eksctl.io/v1alpha5"
)
Expand Down Expand Up @@ -82,11 +83,19 @@ func (m *ManagedNodeGroupResourceSet) makeLaunchTemplateData(ctx context.Context
return nil, fmt.Errorf("couldn't build network interfaces for launch template data: %w", err)
}
if mng.Placement == nil {
groupName := m.newResource("NodeGroupPlacementGroup", &gfnec2.PlacementGroup{
Strategy: gfnt.NewString("cluster"),
})
launchTemplateData.Placement = &gfnec2.LaunchTemplate_Placement{
GroupName: groupName,

// Reservations are often explicitly created with placement in mind, and adding
// a group can lead to an error if it cannot reach all reserved instances.
// For this niche case, we leave it up to the user to create the group.
if mng.CapacityReservation != nil {
logger.Warning("EFA requested without placement group. If your reservation warrants one, please add it")
} else {
groupName := m.newResource("NodeGroupPlacementGroup", &gfnec2.PlacementGroup{
Strategy: gfnt.NewString("cluster"),
})
launchTemplateData.Placement = &gfnec2.LaunchTemplate_Placement{
GroupName: groupName,
}
}
}
} else {
Expand Down
Loading