Skip to content

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
ci-ram-golden-seedfrom
ci-ram-agents
Draft

shepherdjerred wants to merge 3 commits into
ci-ram-golden-seedfrom
ci-ram-agents

Conversation

@shepherdjerred

Copy link
Copy Markdown
Owner

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 -ram pools slots in the same change that routes work to them, so nothing idles in between.

What

  • The shared budget schema accepts optional pr-ram and main-ram compute pools, and computeWorkflows() counts the legacy agent and every default-queue pool for CI_COMPUTE_WORKFLOWS and the admission proof. The real budget is unchanged here (pr 12, main 10).
  • createWoodpeckerAgent takes the budget and runs a -ram agent only for a pool it lists. Such an agent creates claims on ci-workspace-ram at 12Gi, and its mandatory !ci-pool=<pool> label means it takes only routed work.
  • Boot gate: an init container in each RAM agent waits until ci-workspace-route's bootId equals 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.
  • Wiki CI admission (RAM agent pools, boot gate), liskov runbook (reading the gate's log).

Demo

Agents synthesized from the real budget and from a fixture budget with the -ram pools (agent.test.ts):

budget agents
real (this PR: pr 12, main 10) pr, main, review, completion; no RAM agent
fixture (pr 8 + pr-ram 4, main 8 + main-ram 2) the four above plus pr-ram and main-ram, each with the boot gate, ci-workspace-ram and 12Gi

The admission proof is tested with and without the -ram pools; 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; knip fails only on an unused @base-ui/react in packages/mail/package.json from 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.
  • Not run: a live reboot exercising the gate.

🤖 Generated with Claude Code

shepherdjerred and others added 3 commits November 28, 2026 15:03
…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>
@greptile-apps

greptile-apps Bot commented Nov 28, 2026

Copy link
Copy Markdown
Contributor

Automatic reviews are disabled for this repository. Configure in Code Review Settings.

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant