feat: make brigade cluster node count configurable#12
Merged
Conversation
Expose NODE_COUNT (default 2) to size the brigade cluster / flintlock host
droplets. The infra and bootstrap paths were already generic over host count
(droplet loop on droplet_count, host names {tag}-host{i}, Erlang mesh built
from all peer IPs), but droplet_count was a dead knob: a dataclass field that
load() never populated from the environment.
Wire NODE_COUNT through load() into droplet_count, validate >= 1, and default
brigade_min_cluster_size to the node count so an N-node run waits for all N to
mesh (explicit BRIGADE_MIN_CLUSTER_SIZE still overrides). Add the knob to
.env.example and a node_count dispatch input to the e2e workflow.
Also de-hardcode stale "2-node" / "both hosts" wording in docstrings/comments
now that the count is variable.
There was a problem hiding this comment.
Pull request overview
This PR makes the brigade cluster size (and corresponding flintlock host droplet count) configurable via a new NODE_COUNT environment variable, with a default of 2 to preserve current behavior. It also wires this through the GitHub Actions workflow dispatch input and updates documentation/comments to remove assumptions about a fixed 2-node cluster.
Changes:
- Add
NODE_COUNTparsing inliquidmetal_at/config.py, defaulting to 2 and using it to populatedroplet_countand the defaultbrigade_min_cluster_size. - Add a
node_countinput to thee2eworkflow and map it toNODE_COUNT. - Update
.env.exampleand various docstrings/comments to be N-node-aware.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
liquidmetal_at/config.py |
Introduces NODE_COUNT and updates defaults for droplet count and brigade quorum target. |
.github/workflows/e2e.yml |
Adds workflow_dispatch input for node count and exports it as NODE_COUNT. |
.env.example |
Documents new NODE_COUNT knob and notes quorum behavior. |
liquidmetal_at/bootstrap/host.py |
Updates docstrings to remove “both hosts” assumption. |
liquidmetal_at/bootstrap/__init__.py |
Updates package docstring to N-node language. |
liquidmetal_at/bootstrap/templates/cloud_init.yaml.j2 |
Updates template comment to “all hosts”. |
liquidmetal_at/flintlock/client.py |
Updates retry docstring language to no longer assume 2 nodes. |
tests/conftest.py |
Updates fixture docstrings to no longer assume a 2-node mesh. |
tests/test_ssh_reachability.py |
Updates helper docstring to cycle all hosts, not “both”. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+158
to
+163
| # Number of flintlock host droplets == brigade cluster nodes. Quorum target | ||
| # (brigade_min_cluster_size) follows this unless overridden explicitly. | ||
| node_count = int(os.environ.get("NODE_COUNT", "2")) | ||
| if node_count < 1: | ||
| raise ConfigError(f"NODE_COUNT={node_count} must be >= 1") | ||
|
|
Comment on lines
199
to
204
| keep_infra_on_failure=_bool(os.environ.get("KEEP_INFRA_ON_FAILURE", "false")), | ||
| artifacts_dir=_expand(os.environ.get("ARTIFACTS_DIR", "./artifacts")), | ||
| droplet_count=node_count, | ||
| ) | ||
| _validate_microvm_shape(cfg.microvm_mem_mb, cfg.microvm_vcpu, cfg.microvm_kernel_filename) | ||
| return cfg |
Comment on lines
+158
to
+162
| # Number of flintlock host droplets == brigade cluster nodes. Quorum target | ||
| # (brigade_min_cluster_size) follows this unless overridden explicitly. | ||
| node_count = int(os.environ.get("NODE_COUNT", "2")) | ||
| if node_count < 1: | ||
| raise ConfigError(f"NODE_COUNT={node_count} must be >= 1") |
Comment on lines
+43
to
44
| # defaults to NODE_COUNT when unset | ||
| BRIGADE_MIN_CLUSTER_SIZE=2 |
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.
What
Make the number of brigade cluster nodes (== flintlock host droplets) configurable via a new
NODE_COUNTenv var. Defaults to 2 (current behavior byte-for-byte); overridable locally and via the GitHub Actions dispatch workflow.Why
The infra + bootstrap code was already generic over host count — droplet creation loops on
droplet_count, host names derive as{tag}-host{i}, bootstrap iterates all droplets, and the Erlang mesh is built from every peer's private IP. Butdroplet_countwas a dead knob: a dataclass field defaulting to2thatload()never populated from the environment, so it could never change.Changes
config.py— readNODE_COUNT(default 2) →droplet_count; validate>= 1.brigade_min_cluster_sizenow defaults to the node count (so an N-node run waits for all N to mesh); an explicitBRIGADE_MIN_CLUSTER_SIZEstill wins..env.example— newNODE_COUNT=2cluster section; note quorum follows it..github/workflows/e2e.yml— newnode_countdispatch input mapped toNODE_COUNT.2-node/both hosts/two nodeswording now that the count is variable (lefttest_placement.py's "two hosts" anti-span assertion intact).Verification
Lint clean; offline suite
tests/test_cleanup.py9/9 green. Config load spot-checks:NODE_COUNT=3NODE_COUNT=3 BRIGADE_MIN_CLUSTER_SIZE=2NODE_COUNT=0Full e2e (
make test, real DO infra, costs money) not run. To exercise N>2 for real, dispatch thee2eworkflow withnode_count=3.