Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-60943

[AWS][CAPI] machine get Running when set CapacityReservationsOnly on spot instance

XMLWordPrintable

    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • Moderate
    • None
    • None
    • None
    • None
    • In Progress
    • Bug Fix
    • Hide
      *Cause*: What actions or circumstances cause this bug to present.
      *Consequence*: What happens when the bug presents.
      *Fix*: What was done to fix the bug.
      *Result*: Bug doesn’t present anymore.
      Show
      *Cause*: What actions or circumstances cause this bug to present. *Consequence*: What happens when the bug presents. *Fix*: What was done to fix the bug. *Result*: Bug doesn’t present anymore.
    • 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

              rh-ee-btroutma Brae Troutman
              huliu@redhat.com Huali Liu
              None
              None
              Huali Liu Huali Liu
              None
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Created:
                Updated: