Skip to content

Commit d531664

Browse files
committed
fix comment
1 parent c3737ca commit d531664

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

pkg/controllers/nodeclass/validation.go

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,15 @@ 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+
412+
// If there weren't any matching instance types, we should fallback to some defaults. There's an instance type included
413+
// for both x86_64 and arm64 architectures, ensuring that there will be a matching AMI. We also fallback to the default
414+
// instance types if the AMI family is Windows. Karpenter currently incorrectly marks certain instance types as Windows
415+
// compatible, and dynamic instance type resolution may choose those instance types for the dry-run, even if they
413416
// wouldn't be chosen due to cost in practice. This ensures the behavior matches that on Karpenter v1.3, preventing a
414417
// potential regression for Windows users.
415418
// Tracking issue: https://github.com/aws/karpenter-provider-aws/issues/7985
416-
if lo.ContainsBy([]string{
419+
if len(instanceTypes) == 0 || lo.ContainsBy([]string{
417420
v1.AMIFamilyWindows2019,
418421
v1.AMIFamilyWindows2022,
419422
v1.AMIFamilyWindows2025,
@@ -430,14 +433,19 @@ func (v *Validation) getPrioritizedInstanceTypes(ctx context.Context, nodeClass
430433
scheduling.NewRequirement(corev1.LabelWindowsBuild, corev1.NodeSelectorOpExists),
431434
)...),
432435
},
436+
{
437+
Name: string(ec2types.InstanceTypeM6gLarge),
438+
Requirements: scheduling.NewRequirements(append(
439+
lo.Values(amifamily.VariantStandard.Requirements()),
440+
scheduling.NewRequirement(corev1.LabelArchStable, corev1.NodeSelectorOpIn, karpv1.ArchitectureArm64),
441+
scheduling.NewRequirement(corev1.LabelOSStable, corev1.NodeSelectorOpExists),
442+
scheduling.NewRequirement(corev1.LabelWindowsBuild, corev1.NodeSelectorOpExists),
443+
)...),
444+
},
433445
}
434446
instanceTypes = getAMICompatibleInstanceTypes(instanceTypes, nodeClass)
435447
}
436448

437-
if len(instanceTypes) == 0 {
438-
panic("Could not select on any instance type during NodeClass validation")
439-
}
440-
441449
return instanceTypes, nil
442450
}
443451

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)