Repository navigation
Commit b3aac80
committed
fix(apps/kubernetes): omit chart-managed spec.replicas so cluster-autoscaler owns the field alone
Structural follow-up to the previous commit's `replicas: {{ $group.minReplicas }}`.
Emitting the field from the chart at all — even with the semantically-
correct value — keeps the helm-controller ↔ cluster-autoscaler field-
ownership fight alive: helm-controller applies with SSA + force-conflicts
(https://fluxcd.io/flux/components/helm/helmreleases/), so every routine
`helm upgrade` action re-asserts `replicas: {{ $group.minReplicas }}` and
drains whatever the autoscaler had patched in the meantime, with a real
disruption window on running clusters.
Drop the field from the manifest entirely. CAPI's MachineDeployment
defaulting webhook seeds `spec.replicas` from the
`cluster-api-autoscaler-node-group-min-size` annotation on Create (see
https://cluster-api.sigs.k8s.io/tasks/automated-machine-management/autoscaling),
so fresh installs still start with the intended minimum. From that
point on the autoscaler owns the field via SSA field-manager tracking
and chart apply never touches it again.
Behavioural summary:
* Fresh install with `minReplicas: 0` → CAPI defaults `replicas: 0`
on Create → no worker DataVolumes provisioned until scale-out.
* Fresh install with `minReplicas: 2` → CAPI defaults `replicas: 2`
on Create → byte-identical to pre-#3231 behaviour.
* Existing customer (any minReplicas) → next chart upgrade does not
touch spec.replicas — the autoscaler-held value is preserved
unconditionally.
Regression tests updated to assert:
* `notExists: spec.replicas` on the emitted MachineDeployment (the
exact contract this commit establishes).
* Autoscaler `min-size` / `max-size` annotations continue to carry
the nodeGroup's declared bounds (so a future refactor cannot
accidentally drop the wiring the defaulting webhook depends on).
helm-unittest suite stays at 173/173.
Ref: #3231.
Signed-off-by: IvanHunters <[email protected]>1 parent d30a2cf commit b3aac80
2 files changed
Lines changed: 55 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
743 | 743 | | |
744 | 744 | | |
745 | 745 | | |
746 | | - | |
747 | | - | |
748 | | - | |
749 | | - | |
750 | | - | |
751 | | - | |
752 | | - | |
753 | | - | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
754 | 758 | | |
755 | 759 | | |
756 | 760 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
138 | 146 | | |
139 | 147 | | |
140 | 148 | | |
| |||
158 | 166 | | |
159 | 167 | | |
160 | 168 | | |
161 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
162 | 172 | | |
163 | | - | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
164 | 188 | | |
165 | 189 | | |
166 | 190 | | |
167 | 191 | | |
168 | 192 | | |
169 | | - | |
| 193 | + | |
170 | 194 | | |
171 | 195 | | |
172 | 196 | | |
| |||
190 | 214 | | |
191 | 215 | | |
192 | 216 | | |
193 | | - | |
| 217 | + | |
194 | 218 | | |
195 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
196 | 226 | | |
197 | 227 | | |
198 | 228 | | |
| |||
0 commit comments