Skip to content

AzureMachinePoolMachine.Status.LatestModelApplied is never set #5547

Open
@mweibel

Description

@mweibel

/kind bug

What steps did you take and what happened:
When debugging an unrelated issue, I noticed that none of my AzureMachinePoolMachines have Status.LatestModelApplied set.
Example of a currently running VM:

apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
kind: AzureMachinePoolMachine
metadata:
  creationTimestamp: "2025-04-07T10:13:30Z"
  finalizers:
  - azuremachinepoolmachine.infrastructure.cluster.x-k8s.io
  generation: 1
  labels:
    REDACTED: owned
    azuremachinepool.infrastructure.cluster.x-k8s.io/machine-pool: REDACTED
    cluster.x-k8s.io/cluster-name: REDACTED
    cluster.x-k8s.io/pool-name: REDACTED
  name: REDACTED-593
  namespace: supplier-azure
  ownerReferences:
  - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1
    blockOwnerDeletion: true
    kind: AzureMachinePool
    name: REDACTED
    uid: 3bfdf0b5-55dd-4f05-83cf-7d190eddcb59
  - apiVersion: cluster.x-k8s.io/v1beta1
    blockOwnerDeletion: true
    controller: true
    kind: Machine
    name: REDACTED-593
    uid: 6852404b-8436-4bcc-8790-2637b5d25333
  resourceVersion: "2621480957"
  uid: 8b8354af-feba-453c-9c64-1a40b7cdbf59
spec:
  instanceID: "593"
  providerID: azure:///subscriptions/REDACTED/resourceGroups/REDACTED/providers/Microsoft.Compute/virtualMachineScaleSets/REDACTED/virtualMachines/593
status:
  conditions:
  - lastTransitionTime: "2025-04-07T10:15:42Z"
    status: "True"
    type: Ready
  - lastTransitionTime: "2025-04-07T10:15:42Z"
    status: "True"
    type: BootstrapSucceeded
  - lastTransitionTime: "2025-04-07T10:15:42Z"
    status: "True"
    type: NodeHealthy
  nodeRef:
    name: REDACTED
    uid: ad0a49d3-19c4-46b0-a2e4-b6a8523c063a
  provisioningState: Succeeded
  ready: true
  version: REDACTED

LatestModelApplied is updated as part of the normal reconciliation:

if s.instance != nil {
s.AzureMachinePoolMachine.Status.ProvisioningState = &s.instance.State
hasLatestModel, err := s.hasLatestModelApplied(ctx)
if err != nil {
return errors.Wrap(err, "failed to determine if the VMSS instance has the latest model")
}
s.AzureMachinePoolMachine.Status.LatestModelApplied = hasLatestModel
}

But seems like it's never stored in AMPM. I'm not yet sure if there's something off with my installation - will need to verify this once I got some more time.

What did you expect to happen:
Property is set correctly.

Anything else you would like to add:
Additionally, two other things I noticed:

  • MachinePool requeues reconciliation if not all instances have the latest model set. However, the check does not use AMPM.Status.LatestModelApplied but instead reimplements the Image equal check. IMO this should use the .Status.LatestModelApplied, too
  • VMSS VMs have properties.latestModelApplied as a property. Why don't we use this property instead of comparing the VM.Image with the VMSS.Image?

Environment:

  • cluster-api-provider-azure version: latest main (dev env) / v1.17.2 (prod)
  • Kubernetes version: (use kubectl version): 1.31.x
  • OS (e.g. from /etc/os-release): linux/windows

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.priority/critical-urgentHighest priority. Must be actively worked on as someone's top priority right now.

Type

No type

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions