Skip to content

Commit

Permalink
Rename the Requirements method to Compatible in Offerings.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikmohan committed Jan 6, 2024
1 parent 93edef3 commit 7faf746
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pkg/cloudprovider/cloudprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ func (c *CloudProvider) resolveInstanceTypes(ctx context.Context, nodeClaim *cor
reqs := scheduling.NewNodeSelectorRequirements(nodeClaim.Spec.Requirements...)
return lo.Filter(instanceTypes, func(i *cloudprovider.InstanceType, _ int) bool {
return reqs.Compatible(i.Requirements, scheduling.AllowUndefinedWellKnownLabels) == nil &&
len(i.Offerings.Requirements(reqs).Available()) > 0 &&
len(i.Offerings.Compatible(reqs).Available()) > 0 &&

Check failure on line 243 in pkg/cloudprovider/cloudprovider.go

View workflow job for this annotation

GitHub Actions / Analyze Go

i.Offerings.Compatible undefined (type "sigs.k8s.io/karpenter/pkg/cloudprovider".Offerings has no field or method Compatible)

Check failure on line 243 in pkg/cloudprovider/cloudprovider.go

View workflow job for this annotation

GitHub Actions / ci

i.Offerings.Compatible undefined (type "sigs.k8s.io/karpenter/pkg/cloudprovider".Offerings has no field or method Compatible) (typecheck)
resources.Fits(nodeClaim.Spec.Resources.Requests, i.Allocatable())
}), nil
}
Expand Down
8 changes: 4 additions & 4 deletions pkg/providers/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,11 +374,11 @@ func orderInstanceTypesByPrice(instanceTypes []*cloudprovider.InstanceType, requ
sort.Slice(instanceTypes, func(i, j int) bool {
iPrice := math.MaxFloat64
jPrice := math.MaxFloat64
if len(instanceTypes[i].Offerings.Available().Requirements(requirements)) > 0 {
iPrice = instanceTypes[i].Offerings.Available().Requirements(requirements).Cheapest().Price
if len(instanceTypes[i].Offerings.Available().Compatible(requirements)) > 0 {

Check failure on line 377 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / Analyze Go

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 377 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.23.x)

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 377 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.28.x)

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 377 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.26.x)

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 377 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.24.x)

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 377 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.27.x)

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 377 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.25.x)

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 377 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 377 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)
iPrice = instanceTypes[i].Offerings.Available().Compatible(requirements).Cheapest().Price

Check failure on line 378 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / Analyze Go

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 378 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.23.x)

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 378 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.28.x)

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 378 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.26.x)

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 378 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.24.x)

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 378 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.27.x)

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 378 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.25.x)

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 378 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 378 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci

instanceTypes[i].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)
}
if len(instanceTypes[j].Offerings.Available().Requirements(requirements)) > 0 {
jPrice = instanceTypes[j].Offerings.Available().Requirements(requirements).Cheapest().Price
if len(instanceTypes[j].Offerings.Available().Compatible(requirements)) > 0 {

Check failure on line 380 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / Analyze Go

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 380 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.23.x)

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 380 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.28.x)

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 380 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.26.x)

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 380 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.24.x)

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 380 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.27.x)

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 380 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.25.x)

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 380 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 380 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)
jPrice = instanceTypes[j].Offerings.Available().Compatible(requirements).Cheapest().Price

Check failure on line 381 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / Analyze Go

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 381 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.23.x)

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 381 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.28.x)

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 381 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.26.x)

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 381 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.24.x)

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 381 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.27.x)

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 381 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci-test (1.25.x)

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)

Check failure on line 381 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible) (typecheck)

Check failure on line 381 in pkg/providers/instance/instance.go

View workflow job for this annotation

GitHub Actions / ci

instanceTypes[j].Offerings.Available().Compatible undefined (type cloudprovider.Offerings has no field or method Compatible)) (typecheck)
}
if iPrice == jPrice {
return instanceTypes[i].Name < instanceTypes[j].Name
Expand Down
8 changes: 4 additions & 4 deletions pkg/providers/instancetype/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,8 @@ var _ = Describe("InstanceTypes", func() {
// We need some way to deterministically order them if their prices match
reqs := scheduling.NewNodeSelectorRequirements(nodePool.Spec.Template.Spec.Requirements...)
sort.Slice(its, func(i, j int) bool {
iPrice := its[i].Offerings.Requirements(reqs).Cheapest().Price
jPrice := its[j].Offerings.Requirements(reqs).Cheapest().Price
iPrice := its[i].Offerings.Compatible(reqs).Cheapest().Price
jPrice := its[j].Offerings.Compatible(reqs).Cheapest().Price
if iPrice == jPrice {
return its[i].Name < its[j].Name
}
Expand Down Expand Up @@ -397,8 +397,8 @@ var _ = Describe("InstanceTypes", func() {
// We need some way to deterministically order them if their prices match
reqs := scheduling.NewNodeSelectorRequirements(nodePool.Spec.Template.Spec.Requirements...)
sort.Slice(its, func(i, j int) bool {
iPrice := its[i].Offerings.Requirements(reqs).Cheapest().Price
jPrice := its[j].Offerings.Requirements(reqs).Cheapest().Price
iPrice := its[i].Offerings.Compatible(reqs).Cheapest().Price
jPrice := its[j].Offerings.Compatible(reqs).Cheapest().Price
if iPrice == jPrice {
return its[i].Name < its[j].Name
}
Expand Down

0 comments on commit 7faf746

Please sign in to comment.