Skip to content

Commit e87c42b

Browse files
committed
cleanup
1 parent 440728f commit e87c42b

File tree

2 files changed

+1
-22
lines changed

2 files changed

+1
-22
lines changed

pkg/controllers/nodeclass/validation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func (v *Validation) validateCreateFleetAuthorization(
176176
_ *karpv1.NodeClaim,
177177
tags map[string]string,
178178
) (reason string, requeue bool, err error) {
179-
createFleetInput := instance.GetCreateFleetInput(nodeClass, karpv1.CapacityTypeOnDemand, tags, mockLaunchTemplateConfig())
179+
createFleetInput := instance.NewCreateFleetInputBuilder(karpv1.CapacityTypeOnDemand, tags, mockLaunchTemplateConfig()).Build()
180180
createFleetInput.DryRun = lo.ToPtr(true)
181181
// Adding NopRetryer to avoid aggressive retry when rate limited
182182
if _, err := v.ec2api.CreateFleet(ctx, createFleetInput, func(o *ec2.Options) {

pkg/providers/instance/instance.go

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -333,27 +333,6 @@ func (p *DefaultProvider) launchInstance(
333333
return createFleetOutput.Instances[0], nil
334334
}
335335

336-
func GetCreateFleetInput(nodeClass *v1.EC2NodeClass, capacityType string, tags map[string]string, launchTemplateConfigs []ec2types.FleetLaunchTemplateConfigRequest) *ec2.CreateFleetInput {
337-
return &ec2.CreateFleetInput{
338-
Type: ec2types.FleetTypeInstant,
339-
Context: nodeClass.Spec.Context,
340-
LaunchTemplateConfigs: launchTemplateConfigs,
341-
TargetCapacitySpecification: &ec2types.TargetCapacitySpecificationRequest{
342-
DefaultTargetCapacityType: lo.Ternary(
343-
capacityType == karpv1.CapacityTypeReserved,
344-
ec2types.DefaultTargetCapacityType(karpv1.CapacityTypeOnDemand),
345-
ec2types.DefaultTargetCapacityType(capacityType),
346-
),
347-
TotalTargetCapacity: aws.Int32(1),
348-
},
349-
TagSpecifications: []ec2types.TagSpecification{
350-
{ResourceType: ec2types.ResourceTypeInstance, Tags: utils.EC2MergeTags(tags)},
351-
{ResourceType: ec2types.ResourceTypeVolume, Tags: utils.EC2MergeTags(tags)},
352-
{ResourceType: ec2types.ResourceTypeFleet, Tags: utils.EC2MergeTags(tags)},
353-
},
354-
}
355-
}
356-
357336
func (p *DefaultProvider) checkODFallback(nodeClaim *karpv1.NodeClaim, instanceTypes []*cloudprovider.InstanceType, launchTemplateConfigs []ec2types.FleetLaunchTemplateConfigRequest) error {
358337
// only evaluate for on-demand fallback if the capacity type for the request is OD and both OD and spot are allowed in requirements
359338
if getCapacityType(nodeClaim, instanceTypes) != karpv1.CapacityTypeOnDemand || !scheduling.NewNodeSelectorRequirementsWithMinValues(nodeClaim.Spec.Requirements...).Get(karpv1.CapacityTypeLabelKey).Has(karpv1.CapacityTypeSpot) {

0 commit comments

Comments
 (0)