Skip to content

fix: skip adding spot requirement during consolidation when no spot offerings are available - #3252

Open
bwagner5 wants to merge 1 commit into
kubernetes-sigs:mainfrom
bwagner5:consolidation-skip-spot-req
Open

fix: skip adding spot requirement during consolidation when no spot offerings are available#3252
bwagner5 wants to merge 1 commit into
kubernetes-sigs:mainfrom
bwagner5:consolidation-skip-spot-req

Conversation

@bwagner5

Copy link
Copy Markdown
Contributor

Fixes #N/A

Description

This patch fixes consolidation to skip adding a Spot requirement when a NodePool is compatible with both Spot and OD AND there are no spot offerings available. Before this patch, available offerings were not checked and a spot requirement was added in the case where Spot and OD were compatible. This would result in a NodeClaim being created that the provider could not launch to fulfill. The pricing filter in consolidation already checks available offerings so the OD price is used in this case anyways.

This improves consolidation when spot is temporarily unavailable.

For providers that have 1 capacity type (only OD), this change allows NodePools to omit the capacity-type requirement all together which is a nice quality of life improvement. Omitting a capacity-type requirement already works on the provisioning path. It was only assumed in the consolidation path.

How was this change tested?

  • Tested on a WIP Karpenter provider for Oxide
  • Added a local integ table test

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bwagner5
Once this PR has been reviewed and has the lgtm label, please assign gjtempleton for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 20, 2026
@kubernetes-prow kubernetes-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 20, 2026
@bwagner5
bwagner5 force-pushed the consolidation-skip-spot-req branch from 7595277 to b346b0d Compare August 20, 2026 19:01
// are injected on by the scheduler.
ctReq := results.NewNodeClaims[0].Requirements.Get(v1.CapacityTypeLabelKey)
if ctReq.Has(v1.CapacityTypeSpot) && ctReq.Has(v1.CapacityTypeOnDemand) {
if ctReq.Has(v1.CapacityTypeSpot) && ctReq.Has(v1.CapacityTypeOnDemand) && hasSpotOffering(results.NewNodeClaims[0]) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also update the block comment above with this change? something like "if Spot is unavailable at consolidation time, skip the Spot requirement and let the replacement launch as OD. The pricing filter picked the instance based on available offerings, so falling back to OD does not regress cost" ? WDYT?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants