Expand description
DeploymentController — reconciles Deployments into
ReplicaSets.
K8s rule:
- each Deployment owns 1..N
ReplicaSetsvia ownerReferences - the CURRENT
ReplicaSetis the one whosespec.templateEQUALS the Deployment’s, ignoring thepod-template-hashlabel (upstream’sEqualIgnoreHash, seecrate::pod_template) — the hash only names a new one - older
ReplicaSetsare kept around atreplicas=0sokubectl rollout undostill works (revision history)
R9.5 implementation (this file):
- For each Deployment, normalize its template.
- Find owned
ReplicaSets(via uid). - Pick the current one: an owned RS running an equal template
(
current_replicaset). If there is none, create one, named by the template’s hash. - Scale the current RS to
Deployment.spec.replicas. - Scale every other owned RS to 0 (revision history retained).
Skips: status updates, paused rollouts, partial-rollout strategies — those are R9.5b. The substrate’s good enough to prove the controller pattern compounds.
Structs§
Functions§
- current_
replicaset - The owned
ReplicaSetthat is a Deployment’s current one — upstream’sFindNewReplicaSet: an RS whosespec.templateequalstemplate, ignoring thepod-template-hashlabel.Nonewhen no owned RS runs it, the one case in which a new RS is created.