Commit a40f399
committed
Fix HA volume placement in scale command
When scaling apps with volumes, flyctl was hardcoding RequireUniqueZone=false,
causing all volumes (and their attached machines) to be placed on the same host.
This defeated the purpose of HA when scaling with volumes.
The fix detects HA scenarios by checking if total machines in a region > 1:
- Single machine (existingCount + delta == 1): RequireUniqueZone=false
- HA scenario (existingCount + delta > 1): RequireUniqueZone=true
This ensures volumes are distributed across different hosts, and since
machines follow their volumes via RequireVolumeID, the machines will
also be distributed for proper HA.
Examples:
- Scale 1→3: Existing=1, Delta=2, Total=3 → RequireUniqueZone=true ✅
- Deploy with 1: Existing=0, Delta=1, Total=1 → RequireUniqueZone=false ✅
- Scale 0→3: Existing=0, Delta=3, Total=3 → RequireUniqueZone=true ✅
Fixes: TestFlyScaleTo3/With_Volume where all 3 machines ended up on one host1 parent 0ac8487 commit a40f399
File tree
2 files changed
+12
-5
lines changed- internal/command/scale
2 files changed
+12
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
| 320 | + | |
320 | 321 | | |
321 | 322 | | |
322 | 323 | | |
323 | 324 | | |
324 | | - | |
| 325 | + | |
325 | 326 | | |
326 | 327 | | |
327 | | - | |
| 328 | + | |
328 | 329 | | |
329 | 330 | | |
330 | 331 | | |
| |||
352 | 353 | | |
353 | 354 | | |
354 | 355 | | |
355 | | - | |
| 356 | + | |
356 | 357 | | |
357 | 358 | | |
358 | 359 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
126 | 132 | | |
127 | 133 | | |
128 | 134 | | |
129 | 135 | | |
130 | 136 | | |
131 | | - | |
| 137 | + | |
132 | 138 | | |
133 | 139 | | |
134 | 140 | | |
| |||
0 commit comments