-
Bug
-
Resolution: Done
-
Major
-
4.20
-
None
-
Quality / Stability / Reliability
-
False
-
-
None
-
Moderate
-
None
-
None
-
Proposed
-
None
-
Done
-
Bug Fix
-
-
None
-
None
-
None
-
None
Description of problem:
machine get Running when set CapacityReservationsOnly on spot instance, but this combination should not be allowed, because I checked on AWS console it's not allowed https://drive.google.com/file/d/1Rr9royBaOGlT-J8Q2gG2r3GXc3yrBK48/view?usp=sharing we should give webhook for this case to keep consistent with AWS.
Version-Release number of selected component (if applicable):
4.20.0-0.nightly-2025-08-25-002949
How reproducible:
always
Steps to Reproduce:
1.Create an awsmachinetemplate set CapacityReservationsOnly on spot instance
liuhuali@Lius-MacBook-Pro huali-test % cat ms2.yaml
apiVersion: infrastructure.cluster.x-k8s.io/v1beta2
kind: AWSMachineTemplate
metadata:
name: huliu-aws827b-smwxl-worker-test1
namespace: openshift-cluster-api
spec:
template:
metadata: {}
spec:
additionalSecurityGroups:
- filters:
- name: tag:Name
values:
- huliu-aws827b-smwxl-node
- filters:
- name: tag:Name
values:
- huliu-aws827b-smwxl-lb
additionalTags:
kubernetes.io/cluster/huliu-aws827b-smwxl: owned
ami:
id: ami-0e939a03652163c23
iamInstanceProfile: huliu-aws827b-smwxl-worker-profile
ignition:
storageType: UnencryptedUserData
version: "3.4"
instanceMetadataOptions:
httpEndpoint: enabled
httpPutResponseHopLimit: 1
httpTokens: optional
instanceMetadataTags: disabled
instanceType: m6i.large
rootVolume:
encrypted: true
size: 120
type: gp3
subnet:
filters:
- name: tag:Name
values:
- huliu-aws827b-smwxl-subnet-private-us-east-2a
capacityReservationPreference: CapacityReservationsOnly
marketType: Spot
liuhuali@Lius-MacBook-Pro huali-test %
liuhuali@Lius-MacBook-Pro huali-test % oc create -f ms2.yaml
awsmachinetemplate.infrastructure.cluster.x-k8s.io/huliu-aws827b-smwxl-worker-test1 created
2.create machineset
liuhuali@Lius-MacBook-Pro huali-test % oc create -f ms3.yaml
machineset.cluster.x-k8s.io/huliu-aws827b-smwxl-worker-test created
3.The machine get Running but this combination should not be allowed
liuhuali@Lius-MacBook-Pro huali-test % oc get machine.c
NAME CLUSTER NODENAME PROVIDERID PHASE AGE VERSION
huliu-aws827b-smwxl-worker-test-8xdrx huliu-aws827b-smwxl ip-10-0-14-192.us-east-2.compute.internal aws:///us-east-2a/i-054097f28739faf10 Running 18m
The instance on AWS
https://drive.google.com/file/d/16c6sUJc-FHZ3Wbfk3VzvhIECMrK69g0y/view?usp=sharing
Actual results:
The machine get Running
Expected results:
This combination(CapacityReservationsOnly and Spot) should not be allowed
Additional info:
New feature testing for https://issues.redhat.com/browse/OCPCLOUD-3028