spin-node: honour multi-aggregator presets, enforce >=1 per subnet#172
Open
ch4r10t33r wants to merge 1 commit intomainfrom
Open
spin-node: honour multi-aggregator presets, enforce >=1 per subnet#172ch4r10t33r wants to merge 1 commit intomainfrom
ch4r10t33r wants to merge 1 commit intomainfrom
Conversation
The aggregator selection block previously enforced "exactly one aggregator
per subnet": it kept only the first preset found per subnet, reset every
isAggregator flag to false up front, and aborted the deploy if it ever
saw more than one true row in a subnet. Operators who hand-edited the
YAML for redundancy (e.g. zeam_0 + grandine_0 on subnet 0) silently lost
their second aggregator on the next full deploy.
Change the policy to:
1. --aggregator NODE: NODE is the sole aggregator for its subnet
(presets on that subnet are discarded). Other subnets fall through.
2. Otherwise, every preset (isAggregator: true row) in the YAML is
honoured. Multiple aggregators per subnet are intentional and
supported for redundancy.
3. Subnets with no presets get one random pick, preferring client
families not already aggregating elsewhere — same family-uniqueness
heuristic as before.
The verification invariant relaxes from `==1` to `>=1`. Downstream
client cmds and ansible roles already read isAggregator per node, so
multiple true rows naturally translate into multiple `--is-aggregator`
container flags without further changes.
The YAML mutation is now a single pass (set true iff selected, else
false) instead of reset-then-set, avoiding the transient state where
no node carries the flag.
The inline "Aggregator Selection" box now lists all aggregators per
subnet, e.g. "subnet 0 → zeam_0, grandine_0".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
`spin-node.sh` enforced "exactly one aggregator per subnet": it kept only the first preset per subnet, reset every `isAggregator` flag to false on every deploy, and aborted with `expected exactly 1` if it ever saw more than one `true` row in a subnet. Operators who hand-edited `validator-config.yaml` for redundancy (e.g. `zeam_0` + `grandine_0` on subnet 0, `qlean_1` + `ethlambda_0` on subnet 1) silently lost their second aggregator on the next full deploy.
Behaviour change
The YAML mutation is now a single pass: each row is set to `true` iff its name is in the final aggregator set, else `false`. This replaces the previous reset-then-set sequence which left the file in a transiently empty state.
Why this is safe downstream
Every client cmd (`client-cmds/zeam-cmd.sh`, `ethlambda-cmd.sh`, `grandine-cmd.sh`, etc.) and every ansible role (`ansible/roles/*/tasks/main.yml`) reads `isAggregator` per node independently. Multiple `true` rows in the YAML naturally translate into multiple containers being launched with `--is-aggregator`. There is no global "single aggregator" assumption anywhere in the deploy path.
What stays the same
Test plan
Verified in a temp `NETWORK_DIR` with a 3-subnet, 8-node fixture:
Output of the new selection box (case 1):
```
╔══════════════════════════════════════════════════════════════╗
║ 🗳 Aggregator Selection ║
╠══════════════════════════════════════════════════════════════╣
║ subnet 0 → zeam_0, grandine_3 ║
║ subnet 1 → ethlambda_4 ║
║ subnet 2 → qlean_2 ║
╚══════════════════════════════════════════════════════════════╝
```