Skip to content

Commit 1f20a04

Browse files
committed
fix comment
1 parent c3737ca commit 1f20a04

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

pkg/controllers/nodeclass/validation.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,14 @@ func (v *Validation) getPrioritizedInstanceTypes(ctx context.Context, nodeClass
408408
if err != nil {
409409
return nil, err
410410
}
411-
// We fallback to the default instance type if the AMI family is Windows. Karpenter currently incorrectly marks certain instance
412-
// types as Windows compatible, and dynamic instance type resolution may choose those instance types for the dry-run, even if they
411+
// If there weren't any matching instance types, we should fallback to some defaults. There's an instance type included
412+
// for both x86_64 and arm64 architectures, ensuring that there will be a matching AMI. We also fallback to the default
413+
// instance types if the AMI family is Windows. Karpenter currently incorrectly marks certain instance types as Windows
414+
// compatible, and dynamic instance type resolution may choose those instance types for the dry-run, even if they
413415
// wouldn't be chosen due to cost in practice. This ensures the behavior matches that on Karpenter v1.3, preventing a
414416
// potential regression for Windows users.
415417
// Tracking issue: https://github.com/aws/karpenter-provider-aws/issues/7985
416-
if lo.ContainsBy([]string{
418+
if len(instanceTypes) == 0 || lo.ContainsBy([]string{
417419
v1.AMIFamilyWindows2019,
418420
v1.AMIFamilyWindows2022,
419421
v1.AMIFamilyWindows2025,
@@ -430,14 +432,18 @@ func (v *Validation) getPrioritizedInstanceTypes(ctx context.Context, nodeClass
430432
scheduling.NewRequirement(corev1.LabelWindowsBuild, corev1.NodeSelectorOpExists),
431433
)...),
432434
},
435+
{
436+
Name: string(ec2types.InstanceTypeM6gLarge),
437+
Requirements: scheduling.NewRequirements(append(
438+
lo.Values(amifamily.VariantStandard.Requirements()),
439+
scheduling.NewRequirement(corev1.LabelArchStable, corev1.NodeSelectorOpIn, karpv1.ArchitectureArm64),
440+
scheduling.NewRequirement(corev1.LabelOSStable, corev1.NodeSelectorOpExists),
441+
scheduling.NewRequirement(corev1.LabelWindowsBuild, corev1.NodeSelectorOpExists),
442+
)...),
443+
},
433444
}
434445
instanceTypes = getAMICompatibleInstanceTypes(instanceTypes, nodeClass)
435446
}
436-
437-
if len(instanceTypes) == 0 {
438-
panic("Could not select on any instance type during NodeClass validation")
439-
}
440-
441447
return instanceTypes, nil
442448
}
443449

pkg/providers/instancetype/compatibility/compatibility.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func amiFamilyCompatibility(amiFamily string) CompatibleCheck {
5252
}
5353

5454
func (c amiFamilyCheck) compatibleCheck(info ec2types.InstanceTypeInfo) bool {
55-
// a1 instance types are not support with al2023s (https://docs.aws.amazon.com/linux/al2023/ug/system-requirements.html)
55+
// a1 instance types are not supported with al2023s (https://docs.aws.amazon.com/linux/al2023/ug/system-requirements.html)
5656
if c.amiFamily == v1.AMIFamilyAL2023 && strings.HasPrefix(string(info.InstanceType), "a1.") {
5757
return false
5858
}

0 commit comments

Comments
 (0)