Repository navigation
feat(role): size a Colima node VM from the inventory through the quorum guard - #212
Merged
Merged
Conversation
The checks that refuse to recreate a node on the other network unless the cluster stays safe without it move to tasks/restart_guard.yml, so any step that restarts a running node uses the same reads and refusal. The step says what it does in the refusal, and whether runner pods on the node block it: a step that cordons the node and waits for them itself checks the cluster before that with the pods left out.
…um guard github_runner_cluster_colima_memory_gib and github_runner_cluster_colima_cpus set a Colima host's VM size; empty keeps the profile's own. The role reads the VM Lima runs with colima list --json, and when a size differs it resizes one host at a time, each in its own turn: it checks the cluster stays safe without the node, takes the fleet-regrade Lease (refusing while another step holds it), cordons the node, waits for its runner pods and drains it, checks the cluster again, stops the profile, starts it with --memory and --cpus, waits for the node to be Ready (and an etcd voter on a server), uncordons it and gives the Lease back. A value that is not a positive whole number, or a size set on a host that does not run Colima, fails before anything is read. A VM of the size set is only read, so a rerun changes nothing, and --check reports the resize and changes nothing. The native role switch's drain and Ready wait are reused, the drain's refusal naming the step it serves. Closes #208
…keep github_runner_cluster_colima_memory_reserved_gib, the memory a host's other workloads need, derives the VM's memory when no memory is set: the host's memory (memtotal_mb) less it and github_runner_cluster_colima_memory_host_reserve_gib, macOS's own, rounded down to a whole GiB, since colima takes whole GiB and rounding up would take memory a reserve keeps. The VM is never smaller than the node floor: the guest's baseline, github_runner_cluster_colima_guest_baseline_gib, plus one runner pod's memory limit, github_runner_cluster_colima_runner_memory_limit_gib, rounded up to a whole GiB. The cluster role does not install the runners, so it is told that limit, and a derivation without it fails before the VM is read. A derivation below the floor is sized at the floor, and the run prints a warning that the host keeps less than its reserves. A memory set explicitly wins, and with neither declared the profile is left as it is. A host whose runtime is not Colima is now left alone instead of failing, so the sizes and reserves can be set for a group that mixes runtimes. The host's memory is read from the hardware facts only when a derivation needs it and the caller did not gather them.
… derived defaults github_runner_cluster_native_drain_for is what tasks/native/drain.yml says was not done when it cannot empty the node, set by each caller and never by the inventory, so it is derived like the native units' names: the defaults test now lists it, and the README describes it with them.
…aults The runtime tasks' guard test holds every ansible_facts read in the defaults to the subsets runtime.yml gathers. The reserve's comment named the memory fact in that form, though only tasks/colima_size.yml reads it, after gathering the hardware subset itself, so the comment now names the fact and the task that gathers it.
Mearman
marked this pull request as ready for review
November 3, 2026 23:31
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
This security review couldn’t start because the paying account has exhausted its Codex allowance and has insufficient available credits. The payer can check their balance and add credits in the Codex usage dashboard, then try again. If you do not manage the paying account, contact this repository's admins. |
|
🎉 This PR is included in version 2.35.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
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.
Closes #208
A Colima host's VM memory and CPUs now come from the inventory and are applied through the quorum guard, one node at a time: check the cluster stays safe without the node, take the
fleet-regradeLease (refused while another step holds it), cordon, wait for runner pods, drain, check again,colima stop,colima start --activate=false --memory <GiB> --cpus <n>, wait for Ready (and an etcd voter on a server), uncordon, give the Lease back. A VM already at the wanted size is only read,--checkreports and changes nothing, and a host whose runtime is not Colima is left alone.The memory is either set (
github_runner_cluster_colima_memory_gib) or derived from what the host must keep: host memory lessgithub_runner_cluster_colima_memory_reserved_gib(other workloads) andgithub_runner_cluster_colima_memory_host_reserve_gib(macOS), rounded down to a whole GiB, never below the node floor ofgithub_runner_cluster_colima_guest_baseline_gibplusgithub_runner_cluster_colima_runner_memory_limit_gibrounded up. A derivation below the floor is sized at the floor with a warning. The runner limit is a variable because the cluster role does not install the runners; a derivation requires it.The size is fixed at provisioning time rather than ballooned at runtime for the reason in the issue: the node VM's balloon device does not offer free page reporting, so a balloon cannot give memory back to macOS.
tests/unit/test_cluster_colima_size.pyruns the role against stand-ins fordockerandcolimaand covers the argv, the no-op when sizes match, a held Lease, the drain order, an unhealthy or not-Ready voter, check mode, the derivation, the clamp and its warning, and the non-Colima no-op. Each rule's test was seen failing with that rule broken on purpose. A real VM's resize is shown only by its first run on a Mac.