Commit 40f5d6b
committed
trafficrouting: avoid divide-by-zero on PromoteFull with zero-replica rollout
reconcileTrafficRouting computes the PromoteFull desired weight as
(maxWeight * canaryAvailable) / *rollout.Spec.Replicas when
dynamicStableScale is on. Rollouts that are temporarily scaled to
zero still have a spec and are promotable, so PromoteFull can run
while *rollout.Spec.Replicas is 0 - the division panics, the
recovered error is logged in a hot loop, and the rollout is stuck
in a progressing state (#3686).
Guard the division: pull spec.Replicas out, treat a nil pointer as
zero, and only compute the ratio when we actually have replicas.
With zero spec replicas there is nothing to ratio against, so
desiredWeight stays at its zero default rather than shifting
traffic to a canary that has nowhere to land.
Signed-off-by: SAY-5 <SAY-5@users.noreply.github.com>
Fixes #36861 parent c40cb0d commit 40f5d6b
1 file changed
Lines changed: 11 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
239 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
240 | 250 | | |
241 | 251 | | |
242 | 252 | | |
| |||
0 commit comments