Repository navigation
Commit 8a7ebff
committed
feat(featureflags): read int flag fallbacks from the environment
A deployment with no LAUNCH_DARKLY_API_KEY serves every flag's compiled-in
fallback, so an int flag resolves to a value only a rebuild can change.
That is fine for flags whose fallback is a safe default, but not for the
per-node limits: max-sandboxes-per-node falls back to 200, which is sized
for cloud node types rather than for the host it runs on. A self-hosted
node with 384 CPUs and 1.5 TB of memory refuses the 201st sandbox with
ResourceExhausted, and the only way past it is editing a literal in this
file.
Add envIntOr, the int twin of envBoolOr, and use it for the two per-node
limits: max-sandboxes-per-node (MAX_SANDBOXES_PER_NODE) and
max-starting-instances-per-node (MAX_STARTING_INSTANCES_PER_NODE). The
override applies to the fallback rather than to the evaluated value, so
both modes stay consistent: without a LaunchDarkly key it is the value
the offline store serves, and with a key set it is the default for flags
that the LaunchDarkly environment does not define. A defined LaunchDarkly
flag still wins, so live configuration is not bypassed.
Unset, empty, unparseable and non-positive values all keep the existing
fallback. Rejecting non-positive values means a typo cannot silently stop
a node from accepting sandboxes, and it matches the "Must be > 0"
requirement already documented on MaxStartingInstancesPerNode.
Only these two flags opt in; other int flags are unchanged. Other flag
types can follow the same shape if there is demand.
Signed-off-by: Wei Wang <wei.w.wang@hotmail.com>1 parent 9219790 commit 8a7ebff
2 files changed
Lines changed: 56 additions & 2 deletions
File tree
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
506 | 506 | | |
507 | 507 | | |
508 | 508 | | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
509 | 528 | | |
510 | 529 | | |
511 | 530 | | |
| |||
521 | 540 | | |
522 | 541 | | |
523 | 542 | | |
524 | | - | |
| 543 | + | |
525 | 544 | | |
526 | 545 | | |
527 | 546 | | |
| |||
681 | 700 | | |
682 | 701 | | |
683 | 702 | | |
684 | | - | |
| 703 | + | |
685 | 704 | | |
686 | 705 | | |
687 | 706 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
0 commit comments