kubernetes-sigs/cluster-api

Setting `md.spec.paused` to `true` should fully pause the MachineDeployment

Open

#8,629 opened on May 10, 2023

View on GitHub
 (20 comments) (0 reactions) (0 assignees)Go (1,532 forks)auto 404
help wantedkind/bugpriority/important-longtermtriage/accepted

Repository metrics

Stars
 (4,267 stars)
PR merge metrics
 (PR metrics pending)

Description

What steps did you take and what happened?

  • Create a legacy cluster with 1 MD
  • Set .spec.paused of the MD to true
  • Edit the MD to change md.spec.replicas

The MachineDeployment scales and creates new Machines.

What did you expect to happen?

Pausing the MachineDeployment should fully pause its reconciliation.

Looking at the MachineDeployment reconciler code the following is the piece of code responsible for this behavior. We still sync the MD even if the MD is paused.

/internal/controllers/machinedeployment/machinedeployment_controller.go#L266-L268

	if md.Spec.Paused {
		return ctrl.Result{}, r.sync(ctx, md, msList)
	}

Additional notes:

  • Setting md.spec.paused to true will not create a new MS but will still reconcile changes that do no need a rollout.
  • Setting the cluster.x-k8s.io/paused annotation will pause the MD completely.

It is better to have consistent behavior and and fully pause MD reconciliation if md.spec.paused is set to true.

Cluster API version

main

Kubernetes version

No response

Anything else you would like to add?

No response

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.

Contributor guide