feat(cluster): bootstrap RAM preflight sets a 2GB minimum with a memory breakdown#215
Merged
Conversation
…ry breakdown Dogfooding showed 1GB runs the control plane but is exhausted the moment a public site adds the ingress controller and cert-manager (kswapd thrashing, k3s API TLS-handshake timeouts), so the bootstrap RAM preflight now treats 2GB as the honest minimum: it refuses below roughly 2GB unless --yes and prints a breakdown of what uses the memory (k3s, Postgres, burrowd, and the ingress controller plus cert-manager for a public site), noting that 1-2GB is control-plane and internal-only and under 1GB will not start k3s. Signed-off-by: Nicholas Phillips <nsphilli@gmail.com>
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.
Dogfooding showed 1GB runs the control plane but is exhausted the moment a public site adds the ingress controller and cert-manager (kswapd thrashing, k3s API TLS-handshake timeouts), so the bootstrap RAM preflight now treats 2GB as the honest minimum: it refuses below roughly 2GB unless
--yesand prints a breakdown of what uses the memory (k3s, Postgres, burrowd, and the ingress controller plus cert-manager for a public site), noting that 1-2GB is control-plane and internal-only and under 1GB will not start k3s.Thresholds
minBootstrapRAM = 1900 MiB— the 2GB honest minimum (set under a nominal 2GB so a real 2GB box passes once the kernel reserves its share). Below it bootstrap refuses unless--yes; at or above it proceeds silently.k3sMinRAM = 960 MiB— below this k3s itself is unlikely to start; used only to branch the refusal's sub-message.Message
The refusal (and the
--yeswarning) leads with the breakdown:then a tier-specific reason:
< ~1GiB: "Below ~1GB, k3s itself likely will not start (512MB is known to fail)."1-2GiB: "1-2GB runs the control plane and internal apps, but a public site (the ingress controller and cert-manager) will exhaust it."and, when refusing, "Re-run with --yes to bootstrap anyway." With
--yesit prints the breakdown + reason and "Proceeding anyway because --yes was set."The
--yesflag, the memory-reader seam, the ordering beforeconfirmBootstrap, and the already-running fast path are all unchanged.Tests
TestBootstrapRefusesSubGiBRAMWithoutYes(wasTestBootstrapRefusesUndersizedRAMWithoutYes) — 512 MiB, no--yes: refuses, asserts the 2GB minimum, the breakdown (cert-manager), and the k3s-won't-start reason.TestBootstrapRefusesTightRAMWithoutYes(replacesTestBootstrapWarnsTightRAM) — 1.5 GiB, no--yes: now refuses (was warn-and-proceed), asserts the public-site reason and the breakdown, and that Install never runs.TestBootstrapProceedsUndersizedRAMWithYes— 512 MiB +--yes: proceeds, breakdown still printed.TestBootstrapProceedsTightRAMWithYes(new) — 1.5 GiB +--yes: proceeds, public-site warning + breakdown printed.TestBootstrapComfortableRAMNoWarning(2 GiB) andTestBootstrapSkipsRAMCheckWhenUnreadableunchanged and green; the full-flow tests still use a comfortable 4 GiB reading.Light gate passes:
go build,go vet,gofmt -l(empty),go test ./..., andscripts/check-spdx.sh.