kubernetes-sigs/cluster-api

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

Open

#8,629 建立於 2023年5月10日

在 GitHub 查看
 (20 留言) (0 反應) (0 負責人)Go (1,532 fork)auto 404
help wantedkind/bugpriority/important-longtermtriage/accepted

倉庫指標

Star
 (4,267 star)
PR 合併指標
 (PR 指標待抓取)

描述

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.

貢獻者指南