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

A new awsmachinetemplate should be created when changing mapi spec.template

XMLWordPrintable

    • Quality / Stability / Reliability
    • False
    • Hide

      None

      Show
      None
    • None
    • Moderate
    • None
    • None
    • CLOUD Sprint 272, CLOUD Sprint 273
    • 2
    • Done
    • Release Note Not Required
    • N/A
    • None
    • None
    • None
    • None

      This is a clone of issue OCPBUGS-54705. The following is the description of the original issue:

      Description of problem:

      Enable MachineAPIMigration, update status.authoritativeAPI to MachineAPI, change mapi machineset instanceType from m6i.xlarge to m5.large, no change for awsmachinetemplate.  

      Version-Release number of selected component (if applicable):

      4.19.0-0.ci-2025-04-07-182331

      How reproducible:

      Always

      Steps to Reproduce:

      1. Enable MachineAPIMigration
      2. Manually update status.authoritativeAPI to MachineAPI
      3. Update mapi machineset instanceType: m6i.xlarge to instanceType: m5.large  
      3.
          

      Actual results:

      No awsmachinetemplate was recreated, the awsmachinetemplateinstanceType is still m6i.xlarge, not change.
      
      $ oc get machineset.m -n openshift-machine-api zhsun-aws48-444p5-worker-us-east-2a -o yaml
      status:
        authoritativeAPI: MachineAPI
        availableReplicas: 1
        conditions:
        - lastTransitionTime: "2025-04-08T04:03:20Z"
          message: The AuthoritativeAPI is set to MachineAPI
          reason: AuthoritativeAPIMachineAPI
          severity: Info
          status: "False"
          type: Paused
        - lastTransitionTime: "2025-04-08T04:15:48Z"
          message: 'failed to update CAPI infra machine template: admission webhook "validation.awsmachinetemplate.infrastructure.cluster.x-k8s.io"
            denied the request: AWSMachineTemplate.infrastructure.cluster.x-k8s.io "zhsun-aws48-444p5-worker-us-east-2a"
            is invalid: spec.template.spec: Invalid value: v1beta2.AWSMachineTemplate{TypeMeta:v1.TypeMeta{Kind:"AWSMachineTemplate",
            APIVersion:"infrastructure.cluster.x-k8s.io/v1beta2"}, ObjectMeta:v1.ObjectMeta{Name:"zhsun-aws48-444p5-worker-us-east-2a",
            GenerateName:"", Namespace:"openshift-cluster-api", SelfLink:"", UID:"66534b11-f232-44fd-981a-d3facf25419b",
            ResourceVersion:"114892", Generation:2, CreationTimestamp:time.Date(2025, time.April,
            8, 4, 3, 20, 0, time.Local), DeletionTimestamp:<nil>, DeletionGracePeriodSeconds:(*int64)(nil),
            Labels:map[string]string(nil), Annotations:map[string]string(nil), OwnerReferences:[]v1.OwnerReference{v1.OwnerReference{APIVersion:"cluster.x-k8s.io/v1beta1",
            Kind:"Cluster", Name:"zhsun-aws48-444p5", UID:"7bc5afc4-d5b3-4085-8e04-cce4381aaa5e",
            Controller:(*bool)(0xc0031b7057), BlockOwnerDeletion:(*bool)(0xc0031b7056)}},
            Finalizers:[]string(nil), ManagedFields:[]v1.ManagedFieldsEntry{v1.ManagedFieldsEntry{Manager:"machine-api-migration",
            Operation:"Update", APIVersion:"infrastructure.cluster.x-k8s.io/v1beta2", Time:time.Date(2025,
            time.April, 8, 4, 16, 49, 0, time.Local), FieldsType:"FieldsV1", FieldsV1:(*v1.FieldsV1)(0xc0031aa660),
            Subresource:""}}}, Spec:v1beta2.AWSMachineTemplateSpec{Template:v1beta2.AWSMachineTemplateResource{ObjectMeta:v1beta1.ObjectMeta{Labels:map[string]string(nil),
            Annotations:map[string]string(nil)}, Spec:v1beta2.AWSMachineSpec{ProviderID:(*string)(nil),
            InstanceID:(*string)(nil), InstanceMetadataOptions:(*v1beta2.InstanceMetadataOptions)(0xc0031aeac0),
            AMI:v1beta2.AMIReference{ID:(*string)(0xc002fdbb40), EKSOptimizedLookupType:(*v1beta2.EKSAMILookupType)(nil)},
            ImageLookupFormat:"", ImageLookupOrg:"", ImageLookupBaseOS:"", InstanceType:"m5.large",
            AdditionalTags:v1beta2.Tags{"kubernetes.io/cluster/zhsun-aws48-444p5":"owned"},
            IAMInstanceProfile:"zhsun-aws48-444p5-worker-profile", PublicIP:(*bool)(nil),
            ElasticIPPool:(*v1beta2.ElasticIPPool)(nil), AdditionalSecurityGroups:[]v1beta2.AWSResourceReference{v1beta2.AWSResourceReference{ID:(*string)(nil),
            Filters:[]v1beta2.Filter{v1beta2.Filter{Name:"tag:Name", Values:[]string{"zhsun-aws48-444p5-node"}}}},
            v1beta2.AWSResourceReference{ID:(*string)(nil), Filters:[]v1beta2.Filter{v1beta2.Filter{Name:"tag:Name",
            Values:[]string{"zhsun-aws48-444p5-lb"}}}}}, Subnet:(*v1beta2.AWSResourceReference)(0xc000988da0),
            SecurityGroupOverrides:map[v1beta2.SecurityGroupRole]string(nil), SSHKeyName:(*string)(nil),
            RootVolume:(*v1beta2.Volume)(0xc00308c0a0), NonRootVolumes:[]v1beta2.Volume(nil),
            NetworkInterfaces:[]string(nil), NetworkInterfaceType:"", UncompressedUserData:(*bool)(nil),
            CloudInit:v1beta2.CloudInit{InsecureSkipSecretsManager:false, SecretCount:0,
            SecretPrefix:"", SecureSecretsBackend:""}, Ignition:(*v1beta2.Ignition)(0xc0031aca50),
            SpotMarketOptions:(*v1beta2.SpotMarketOptions)(nil), PlacementGroupName:"",
            PlacementGroupPartition:0, Tenancy:"", PrivateDNSName:(*v1beta2.PrivateDNSName)(nil),
            CapacityReservationID:(*string)(nil), MarketType:""}}}, Status:v1beta2.AWSMachineTemplateStatus{Capacity:v1.ResourceList(nil)}}:
            AWSMachineTemplate.Spec is immutable'
          reason: FailedToUpdateCAPIInfraMachineTemplate
          severity: Error
          status: "False"
          type: Synchronized
        fullyLabeledReplicas: 1
        observedGeneration: 3
        readyReplicas: 1
        replicas: 1
        synchronizedGeneration: 2

      Expected results:

      A new awsmachinetemplate should be created. 

      Additional info:

      From Joel https://issues.redhat.com/browse/OCPCLOUD-2644?focusedId=26403166&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-26403166
      The machine template name should be constructed based on a hash of the content within it, if the name of the machine template is just the name of the machineset for now

              rmanak@redhat.com Radek Manak
              openshift-crt-jira-prow OpenShift Prow Bot
              None
              None
              Zhaohua Sun Zhaohua Sun
              None
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: