Repository navigation
feat(homelab): run RAM workspace agents only for budgeted pools, gated on the route for this boot - #5499
Draft
shepherdjerred wants to merge 3 commits into
Draft
feat(homelab): run RAM workspace agents only for budgeted pools, gated on the route for this boot#5499shepherdjerred wants to merge 3 commits into
shepherdjerred wants to merge 3 commits into
Conversation
…for this boot Why Woodpecker creates each workflow's workspace claim from its agent's storage settings, and the claim carries no workflow labels. The RAM workspace pool and its routing policy (earlier in this stack) can only serve a workflow that runs on an agent whose claims ask for ci-workspace-ram, so the RAM workspace needs agents of its own before the generator can route anything to it. After a reboot the ci-workspace-route ConfigMap still holds the previous boot's decision while the pool, its golden snapshot and every claim on it are gone. An agent that took work before the publisher ran again could send new claims to a snapshot that no longer exists, where they would sit Pending. What - Admission budget: two new compute pools, pr-ram (3) and main-ram (2), carved out of pr (12 -> 9) and main (10 -> 8). Total workflows (26), compute workflows (22), Kueue's pods quota and the admission proof are unchanged; the shared schema, CI_COMPUTE_WORKFLOWS and the budget check count the new pools. - Agents: Deployments for pr-ram and main-ram whose claims use ci-workspace-ram at the 12Gi RAM workspace size. Their mandatory !ci-pool label keeps them idle until the generator routes to them. - Boot gate: each RAM agent has a workspace-route-boot-gate init container (the shared kubectl script container, RuntimeDefault seccomp, no privilege escalation, emptyDir /tmp for kubectl's cache) that waits until the route ConfigMap's bootId is the node's own boot_id, logging which boot the route it read belongs to, and fails on an API error. The agent Role gains get on the ci-workspace-route ConfigMap by name; the agent NetworkPolicy already allows the Kubernetes API. The new agent containers also run under RuntimeDefault seccomp. - Docs: the CI admission explanation covers the RAM agent pools and the boot gate; the liskov runbook says how to read the gate's log. Verification - bunx turbo run build typecheck test lint --filter=@homelab/cdk8s --filter=homelab --filter=@shepherdjerred/root-scripts --filter=@shepherdjerred/docs-wiki --output-logs=errors-only --continue - bun run check-ci-admission-budget - bun run --cwd packages/homelab check:kubeconform - bunx turbo run jscpd quality-ratchet knip --filter=// - New tests: agent pools (RAM class, size, gate, seccomp; ordinary pools unchanged), the agent Role's named ConfigMap read, the boot gate script against a fake kubectl (immediate start, waiting through a missing and a stale route, failure on an API error), and the budget proof counting the RAM pools' slots. - Not run: verify:extended; no live deployment or rollout. The RAM agents connect idle once deployed; nothing routes to them until the next change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s slots Why This branch carved pr-ram and main-ram out of the pr and main pools before anything routes work to them, so 5 of 22 compute slots would sit idle on agents nothing could use until the routing change merged. What - The admission budget keeps pr 12 and main 10; the routing change adds the -ram pools in the same change that routes work to them. - The shared schema makes pr-ram and main-ram optional, and computeWorkflows() counts the legacy agent and every default-queue pool, present or not, for CI_COMPUTE_WORKFLOWS and the admission proof. - createWoodpeckerAgent takes the budget and creates a RAM workspace agent only for a pool it lists; the boot gate, the route ConfigMap read and the RAM claim settings are unchanged. - Agent tests use a fixture budget with the RAM pools, and prove the real budget runs only the four ordinary agents; the budget test proves the compute proof with and without the RAM pools. - Wiki: a RAM agent runs only for a pool with slots, added with routing. Verification - bun run scripts/run-test.ts (packages/homelab/src/cdk8s) over src/resources/woodpecker, kueue-config, cluster-baseline and src/misc: 36 files, 258 tests pass. - bun vitest (scripts) checks/ci/check-ci-admission-budget.test.ts: 17 pass. - bun run check-ci-admission-budget: 61 generated steps across 2 graphs hold. - bunx turbo run typecheck lint for @homelab/cdk8s, root-scripts and woodpecker-config-extension: 33/33. - bunx lefthook run pre-commit: pass. - Not run: any live deployment; no live change was made. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Why Rebased onto main, whose pooled admission budget tests already sit near the 200-line function limit, the RAM workspace pool slot proof pushed the `pooled CI admission budget` block to 219 lines and failed the root-scripts lint. What - The RAM pool slot proof moves unchanged into its own `RAM workspace pools` describe block, which parses the budget itself. Verification - bunx eslint checks/ci/check-ci-admission-budget.test.ts (scripts): clean. - bun vitest checks/ci/check-ci-admission-budget.test.ts: 27 pass. - bunx lefthook run pre-commit: pass. - Not run: any live check; test-only change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
This change is part of the following stack: Change managed by git-spice. |
Contributor
|
Automatic reviews are disabled for this repository. Configure in Code Review Settings. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
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.
Why
Woodpecker creates each workflow's workspace claim from its agent's settings, and claims carry no workflow labels. Routing a workflow's workspace to the RAM pool therefore means routing the workflow to an agent whose claims use the RAM class. After a reboot the route ConfigMap still says what it said before. A RAM agent must not take work until the route publisher has spoken for the current boot. Otherwise claims could clone a RAM snapshot that vanished with the pool and hang Pending.
PR 4a of 5. This adds only the mechanism: no RAM agent runs until PR 4b gives the
-rampools slots in the same change that routes work to them, so nothing idles in between.What
pr-ramandmain-ramcompute pools, andcomputeWorkflows()counts the legacy agent and every default-queue pool forCI_COMPUTE_WORKFLOWSand the admission proof. The real budget is unchanged here (pr 12, main 10).createWoodpeckerAgenttakes the budget and runs a-ramagent only for a pool it lists. Such an agent creates claims onci-workspace-ramat 12Gi, and its mandatory!ci-pool=<pool>label means it takes only routed work.ci-workspace-route'sbootIdequals the node's/proc/sys/kernel/random/boot_id, and logs why it waits. The agent role may read that ConfigMap by name. RAM agent containers run under RuntimeDefault seccomp.Demo
Agents synthesized from the real budget and from a fixture budget with the
-rampools (agent.test.ts):ci-workspace-ramand 12GiThe admission proof is tested with and without the
-rampools; the compute slot count stays 22 either way.Verification
bunx turbo run build typecheck test lint(touched packages): 40/40.bun run check-ci-admission-budget: 61 steps across 2 graphs.bun run check:kubeconform: 0 invalid.bunx turbo run jscpd quality-ratchet knip --filter=//: jscpd and quality-ratchet pass;knipfails only on an unused@base-ui/reactinpackages/mail/package.jsonfrom main's feat(mail): shared console shell, banner, description list and email preview #5483, which this stack does not touch.bunx lefthook run pre-commit: pass.bun run verify:extended -- --filter='...[origin/main...HEAD]': 72/72 at the pre-rebase stack top (ce27b2e17e); to be re-run on the final heads before any PR is marked ready.🤖 Generated with Claude Code