Skip to content

Commit

Permalink
fix: kwok offerings to use correct requirements (#1319)
Browse files Browse the repository at this point in the history
  • Loading branch information
njtran authored Jun 13, 2024
1 parent 24c9761 commit 37db06f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion kwok/cloudprovider/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ func newInstanceType(options InstanceTypeOptions) *cloudprovider.InstanceType {
})
return req.Values
})))

requirements := scheduling.NewRequirements(
scheduling.NewRequirement(v1.LabelInstanceTypeStable, v1.NodeSelectorOpIn, options.Name),
scheduling.NewRequirement(v1.LabelArchStable, v1.NodeSelectorOpIn, options.Architecture),
Expand All @@ -173,7 +174,13 @@ func newInstanceType(options InstanceTypeOptions) *cloudprovider.InstanceType {
Name: options.Name,
Requirements: requirements,
Offerings: lo.Map(options.Offerings, func(off KWOKOffering, _ int) cloudprovider.Offering {
return off.Offering
return cloudprovider.Offering{
Requirements: scheduling.NewRequirements(lo.Map(off.Requirements, func(req v1.NodeSelectorRequirement, _ int) *scheduling.Requirement {
return scheduling.NewRequirement(req.Key, req.Operator, req.Values...)
})...),
Price: off.Offering.Price,
Available: off.Offering.Available,
}
}),
Capacity: options.Resources,
Overhead: &cloudprovider.InstanceTypeOverhead{
Expand Down

0 comments on commit 37db06f

Please sign in to comment.