✨ Add AWS SpotMarketOptions support to ROSA HCP MachinePools - #6193
✨ Add AWS SpotMarketOptions support to ROSA HCP MachinePools#6193tinaafitz wants to merge 1 commit into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
|
|
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 Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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. |
…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.
876e464 to
6a842b0
Compare
|
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). |
|
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 |
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 ratespotMarketOptions: { maxPrice: "0.05" }— use Spot, but cap the hourly priceIt maps to the OCM
AwsNodePool.spot_market_optionsAPI, which already shipped and is live in production.The rules
Things reviewers should know
ocm-sdk-goandocm-api-modelwere bumped to pick up the new Spot builder/getters.pattern=) and was being silently ignored. Fixed toPattern=so themaxPriceformat check actually gets applied.maxPricehere — the $10/hr cap is enforced on the server side, same as the existing EC2 Spot path.ROSAMachinePoolis 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.