Skip to content

✨ Add AWS SpotMarketOptions support to ROSA HCP MachinePools - #6193

Open
tinaafitz wants to merge 1 commit into
kubernetes-sigs:mainfrom
tinaafitz:feat/rosaeng-8275-spot-market-options
Open

✨ Add AWS SpotMarketOptions support to ROSA HCP MachinePools#6193
tinaafitz wants to merge 1 commit into
kubernetes-sigs:mainfrom
tinaafitz:feat/rosaeng-8275-spot-market-options

Conversation

@tinaafitz

@tinaafitz tinaafitz commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

What this adds

You can now run ROSA HCP worker nodes on AWS Spot instances. Spot is AWS's spare capacity — much cheaper than normal on-demand pricing, with the trade-off that AWS can take the nodes back at any time. It's a good fit for workloads that can handle a node dropping out, and an easy way to cut costs.

There's a new optional field on ROSAMachinePool:

  • spotMarketOptions: {} — use Spot, pay the going rate
  • spotMarketOptions: { maxPrice: "0.05" } — use Spot, but cap the hourly price

It maps to the OCM AwsNodePool.spot_market_options API, which already shipped and is live in production.

The rules

  • Day-1 only. Spot can't be turned on, off, or changed after the pool exists.
  • Needs OpenShift 4.22 or newer. Older versions are rejected.
  • Can't be used with Capacity Reservations. The two conflict, so setting both is rejected.

Things reviewers should know

  • Dependency bump: ocm-sdk-go and ocm-api-model were bumped to pick up the new Spot builder/getters.
  • Small CRD fix: a kubebuilder marker was written in lowercase (pattern=) and was being silently ignored. Fixed to Pattern= so the maxPrice format check actually gets applied.
  • No upper limit on maxPrice here — the $10/hr cap is enforced on the server side, same as the existing EC2 Spot path.
  • ROSAMachinePool is v1beta2-only, so no conversion webhook changes needed.

Testing

Covered with unit tests: the webhook (valid cases, blocking changes after creation, blocking the Capacity Reservation combo), the 4.22 version check, and the round-trip to OCM (with and without a price cap). Added a "Spot instances" section to the docs.

Added `spec.spotMarketOptions` to ROSAMachinePool for provisioning ROSA HCP node pools on AWS Spot instances (Day-1 only, requires OpenShift 4.22+).

@kubernetes-prow kubernetes-prow Bot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Aug 24, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign vincepri 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 requested review from damdo and serngawy August 24, 2026 19:02
@kubernetes-prow kubernetes-prow Bot added needs-priority size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 24, 2026
@linux-foundation-easycla

linux-foundation-easycla Bot commented Aug 24, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: tinaafitz / name: Tina Fitzgerald (6a842b0)

@kubernetes-prow

Copy link
Copy Markdown
Contributor

Hi @tinaafitz. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Tip

We noticed you've done this a few times! Consider joining the org to skip this step and gain /lgtm and other bot rights. We recommend asking approvers on your previous PRs to sponsor you.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubernetes-prow kubernetes-prow Bot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Aug 24, 2026
…5782)

Adds AWS Spot instance support to ROSA HCP MachinePools via the CAPA layer,
mapping a new optional, immutable spec.spotMarketOptions field to the OCM
AwsNodePool.spot_market_options API:

  - spotMarketOptions: {}                    -> Spot with no maximum price
  - spotMarketOptions: { maxPrice: "0.05" }  -> cap the hourly bid

Behavior and guardrails:
- Day-1 only / immutable: cannot be added, removed, or changed after the
  MachinePool is created. Enforced by the validating webhook and ignored in
  the reconcile diff so it never triggers a spurious Day-2 update.
- Requires OpenShift >= 4.22, gated in the controller against the control-plane
  version (the webhook cannot see the control-plane version). The gate runs even
  when spec.version is omitted (the common inherit-from-control-plane case).
- Incompatible with capacityReservationID; setting both is rejected.

Robust version gating:
- Uses semver.ParseTolerant so "4.22" and "v4.22.0" are accepted; unparsable or
  empty versions surface a user-visible Status.FailureMessage instead of an error
  that requeues forever.
- Compares on the {Major, Minor, Patch} triple, so pre-release control-plane
  versions such as "4.22.0-rc.1" are not wrongly rejected.
- Prefers the running control-plane version (Status.Version) over the requested
  version (Spec.Version), falling back to Spec.Version when Status is unset.
- Validation failures set Status.FailureMessage and mark the Ready condition
  False so they are observable via kubectl.

Also corrects the shared SpotMarketOptions MaxPrice kubebuilder marker from
lowercase 'pattern' (silently ignored) to 'Pattern', so the numeric validation
pattern is now emitted into all CRDs that embed the shared type. Bumps
ocm-sdk-go to v0.1.510 / ocm-api-model to v0.0.465 for the new spot builder.

Includes webhook, controller, and helper unit tests (immutability, capacity
reservation conflict, OCM round-trip, and the full version-gate matrix) and a
ROSA MachinePools docs section.
@tinaafitz
tinaafitz force-pushed the feat/rosaeng-8275-spot-market-options branch from 876e464 to 6a842b0 Compare August 24, 2026 19:09
@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Aug 24, 2026
@tinaafitz tinaafitz changed the title ✨ WIP Add AWS SpotMarketOptions support to ROSA HCP MachinePools ✨ Add AWS SpotMarketOptions support to ROSA HCP MachinePools Aug 24, 2026
@kubernetes-prow kubernetes-prow Bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Aug 24, 2026
@tinaafitz

Copy link
Copy Markdown
Contributor Author

Validated end-to-end — all 7 test cases pass (accept spot ±maxPrice, CRD/webhook rejections, 4.22 gate, live provision with 2 real EC2 spot instances, immutability).

@tinaafitz

Copy link
Copy Markdown
Contributor Author

Verified end-to-end: a spot-enabled node pool provisioned through to a live ROSA HCP cluster, backed by two real EC2 spot instances.

 1. Accept Spot with no max price — PASS
 2. Accept Spot with max price — PASS
 3. CRD rejects invalid maxPrice ("abc") — PASS
 4. Webhook rejects Spot + capacityReservationID — PASS
 5. Version gate passes vs live 4.22.8 control plane — PASS
 6. Spot node pool provisioned in OCM — 2 real EC2 spot instances — PASS
 7. Day-1 only / immutability — Spot excluded from reconcile diff — PASS

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. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant