Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MachinePool observedGeneration is updated without changing conditions on upgrades #10059

Open
Tracked by #10852
dkoshkin opened this issue Jan 25, 2024 · 10 comments
Open
Tracked by #10852
Labels
area/machinepool Issues or PRs related to machinepools kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.

Comments

@dkoshkin
Copy link
Contributor

dkoshkin commented Jan 25, 2024

What steps did you take and what happened?

Create an AKS cluster with machinepools with CAPZ then upgrade the spec.version in the MachinePool.

What did you expect to happen?

We rely on status.observedGeneration and different status fields and conditions to determine if the MachinePool is still being upgraded. This works great with MachineDeployments with lots of different infra providers, but for MachinePools there is no clear signal when the upgrade has started.

I've captured the MachinePool objects during an upgrade:

  1. spec.version was upgraded to v1.28.3 but observedGeneration is still 2, this is expected the controllers haven't acted yet.
[2024-01-16 15:54:09] ---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachinePool
metadata:
  creationTimestamp: "2024-01-16T23:45:43Z"
  finalizers:
  - machinepool.cluster.x-k8s.io
  generation: 3
  name: dkoshkin-az-upgrade-8
  namespace: default
  resourceVersion: "4509"
  uid: 612e7d87-b0d2-4da9-8174-9ca890642246
spec:
  template:
    spec:
      version: v1.28.3
status:
  availableReplicas: 3
  bootstrapReady: true
  conditions:
  - lastTransitionTime: "2024-01-16T23:51:06Z"
    status: "True"
    type: Ready
  - lastTransitionTime: "2024-01-16T23:45:43Z"
    status: "True"
    type: BootstrapReady
  - lastTransitionTime: "2024-01-16T23:51:06Z"
    status: "True"
    type: InfrastructureReady
  - lastTransitionTime: "2024-01-16T23:45:43Z"
    status: "True"
    type: ReplicasReady
  infrastructureReady: true
  observedGeneration: 2
  phase: Running
  readyReplicas: 3
  replicas: 3

The controller picks up the spec change and reconciles it, updating observedGeneration to 3 which matches generation.
This is where I would expect to some status change that the spec is outdated and will be upgraded.

[2024-01-16 15:54:09] ---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachinePool
metadata:
  creationTimestamp: "2024-01-16T23:45:43Z"
  finalizers:
  - machinepool.cluster.x-k8s.io
  generation: 3
  name: dkoshkin-az-upgrade-8
  namespace: default
  resourceVersion: "4510"
  uid: 612e7d87-b0d2-4da9-8174-9ca890642246
spec:
  template:
    spec:
      version: v1.28.3
status:
  availableReplicas: 3
  bootstrapReady: true
  conditions:
  - lastTransitionTime: "2024-01-16T23:51:06Z"
    status: "True"
    type: Ready
  - lastTransitionTime: "2024-01-16T23:45:43Z"
    status: "True"
    type: BootstrapReady
  - lastTransitionTime: "2024-01-16T23:51:06Z"
    status: "True"
    type: InfrastructureReady
  - lastTransitionTime: "2024-01-16T23:45:43Z"
    status: "True"
    type: ReplicasReady
  infrastructureReady: true
  observedGeneration: 3
  phase: Running
  readyReplicas: 3
  replicas: 3

Then about 10 seconds later we get a status change with Ready and InfrastructureReady conditions changing to False. By this point our wait code has exited since it checks for observedGeneration==generation and the Ready condition.

[2024-01-16 15:54:21]  ---
apiVersion: cluster.x-k8s.io/v1beta1
kind: MachinePool
metadata:
  creationTimestamp: "2024-01-16T23:45:43Z"
  finalizers:
  - machinepool.cluster.x-k8s.io
  generation: 3
  name: dkoshkin-az-upgrade-8
  namespace: default
  resourceVersion: "4574"
  uid: 612e7d87-b0d2-4da9-8174-9ca890642246
spec:
  template:
    spec:
      version: v1.28.3
status:
  availableReplicas: 3
  bootstrapReady: true
  conditions:
  - lastTransitionTime: "2024-01-16T23:54:21Z"
    message: agentpools creating or updating
    reason: Creating
    severity: Info
    status: "False"
    type: Ready
  - lastTransitionTime: "2024-01-16T23:45:43Z"
    status: "True"
    type: BootstrapReady
  - lastTransitionTime: "2024-01-16T23:54:21Z"
    message: agentpools creating or updating
    reason: Creating
    severity: Info
    status: "False"
    type: InfrastructureReady
  - lastTransitionTime: "2024-01-16T23:45:43Z"
    status: "True"
    type: ReplicasReady
  infrastructureReady: true
  observedGeneration: 3
  phase: Running
  readyReplicas: 3
  replicas: 3

Cluster API version

v1.5.3

Kubernetes version

No response

Anything else you would like to add?

We would like to avoid solving this and not have "sleeps" to wait for changes to happen (or not happen) and instead would like to use the status.

I'm looking for some guidance

  1. Confirming that this is a bug
  2. and any pointers if this is already handled in the topology reconcilers, as I believe there would be a similar need to know when a MachinePool is outdated and is going to be upgraded

Label(s) to be applied

/kind bug
One or more /area label. See https://github.com/kubernetes-sigs/cluster-api/labels?q=area for the list of labels.

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 25, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If CAPI contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions 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/test-infra repository.

@fabriziopandini
Copy link
Member

@jackfrancis @willie-yao could you kindly triage this issue?

@willie-yao
Copy link
Contributor

willie-yao commented Mar 19, 2024

/triage accepted
Will take a look and try to reproduce!

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 19, 2024
@sbueringer
Copy link
Member

Cluster topology controller only waits for Kubernetes upgrades. We check if all Machines have been upgraded via versions on the corresponding Nodes.

@chrischdi
Copy link
Member

/retitle MachinePool observedGeneration is updated without changing conditions on upgrades

@k8s-ci-robot k8s-ci-robot changed the title MachinPool observedGeneration is updated without changing conditions on upgrades MachinePool observedGeneration is updated without changing conditions on upgrades Mar 26, 2024
@fabriziopandini
Copy link
Member

/priority important-longterm

@k8s-ci-robot k8s-ci-robot added the priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. label Apr 11, 2024
@fabriziopandini
Copy link
Member

@willie-yao @mboersma @Jont828 PTAL

/remove-triage accepted

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. and removed triage/accepted Indicates an issue or PR is ready to be actively worked on. labels May 6, 2024
@sbueringer sbueringer added the area/machinepool Issues or PRs related to machinepools label Jul 10, 2024
@sbueringer
Copy link
Member

@willie-yao @mboersma @Jont828 Do you have some time to take a look?

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle stale
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 26, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues.

This bot triages un-triaged issues according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue as fresh with /remove-lifecycle rotten
  • Close this issue with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Dec 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/machinepool Issues or PRs related to machinepools kind/bug Categorizes issue or PR as related to a bug. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete.
Projects
None yet
Development

No branches or pull requests

7 participants