Repository navigation
feat(ci): seed the RAM pool's golden workspace from the NVMe golden as its own maintenance kind - #5498
Draft
shepherdjerred wants to merge 4 commits into
Draft
feat(ci): seed the RAM pool's golden workspace from the NVMe golden as its own maintenance kind#5498shepherdjerred wants to merge 4 commits into
shepherdjerred wants to merge 4 commits into
Conversation
…s its own maintenance kind
Why
RAM workspace claims can only clone a snapshot in the RAM pool, and the route
publisher reports `seeding` until `ci-workspace-golden-ram` names a 12Gi RAM
snapshot taken on the live pool. Nothing produced one. The pool and its
datasets vanish on every reboot, and a RAM golden goes stale with every NVMe
golden refresh, so the seed must repeat exactly then, and a RAM problem must
never hold back the NVMe golden refresh every workspace depends on.
What
- New maintenance kind `workspace-golden-ram`. Whenever the `workspace-golden`
candidate exists, an infra read proposes a RAM seed at its verified source
when `ci-workspace-golden` names an NVMe snapshot and `ci-workspace-route`
reports an ONLINE pool (ready, full or seeding). The fingerprint is
`<nvme snapshot>@<pool GUID>`, so it changes on each NVMe refresh and each
reboot.
- Before submitting it, `ensureCiWorkspaceGoldenRamClaim` makes the
Temporal-owned claim `woodpecker-workspace-golden-ram` (ci-golden-ram, 12Gi,
RWX, backup disabled) carry the live pool GUID, deleting and awaiting a claim
from an earlier pool first. A failed read or claim leaves the RAM kind out
of that tick and the coordinator submits the next kind instead.
- After the pipeline succeeds, the RAM claim is snapshotted as
`ci-workspace-golden-ram-<source12>-<req8>` and selected with
`{snapshot, restoreSize: 12Gi, poolGuid}`, keeping only the selected
snapshot. A claim from an earlier pool abandons the publication so the next
tick seeds the new pool. NVMe and RAM share one parameterized snapshot
publisher; NVMe names, 32Gi, two retained snapshots and `{snapshot,
restoreSize}` are unchanged, and NVMe pruning ignores RAM snapshots.
- The coordinator guards all three new activity calls with patch
`ci-maintenance-golden-ram-v1`. A frozen pre-change coordinator fixture
records the history the replay test feeds the new code.
- Extension: `maintenance-workspace-golden-ram` mounts both golden claims and
runs `ci/scripts/publish-workspace-golden-ram.ts`, which copies the published
NVMe golden tree with the same staging swap, chown and marker, and fails when
the NVMe marker is missing. Requests need the verified main source like the
other workspace kinds.
- Homelab: the CI pod guard lets the RAM seed mount the NVMe golden and only
the RAM seed (main, manual) mount the RAM golden; the infra worker's golden
Role gains the RAM ConfigMap, the route read, PVC create and get/delete of
the RAM claim; the PVC backup policy classifies the RAM claim.
- Ops signals page on a blocked RAM kind; toolkit classifies, lists and
retries it.
- Docs: wiki ci-admission explains the seed, its re-seeding and the claim's
ownership; extension, Temporal and toolkit READMEs describe the kind.
Verification
- bunx turbo run build typecheck test lint --filter=@shepherdjerred/temporal
--filter=@shepherdjerred/woodpecker-config-extension --filter=@homelab/cdk8s
--filter=@shepherdjerred/toolkit --continue: 49/49 tasks pass.
- Workflow tests (Node): a coordinator recorded by the frozen pre-change
fixture replays on the new code, then the new code takes over the same
execution, seeds the RAM golden (inspect, ensure claim, submit), selects its
snapshot, does not reseed the same fingerprint, and reseeds after a pool
GUID change; history carries one `ci-maintenance-golden-ram-v1` marker and
replays. Without the patch guard the fixture replay fails with
"Activity type of scheduled event 'submitCiMaintenance' does not match
activity type of activity command 'inspectCiWorkspaceGoldenRam'". A failing
claim ensure hands the tick to the NVMe golden refresh.
- Activity tests: the RAM candidate exists only with an NVMe golden and an
ONLINE pool, and its fingerprint changes with the GUID or NVMe snapshot; a
claim with a stale or missing GUID is deleted, awaited and recreated, and
nothing is touched while the pool is absent; a seeded claim is selected with
`{snapshot, restoreSize: "12Gi", poolGuid}` and every other RAM snapshot is
pruned; a claim from an earlier pool abandons the publish. NVMe publication
still writes `{snapshot, restoreSize: "32Gi"}` and never prunes a RAM
snapshot; existing NVMe golden tests pass unchanged.
- bun run check-ci-admission-budget: holds for 61 generated steps.
- bunx turbo run jscpd quality-ratchet knip --filter=//: 16/16 pass.
- bunx lefthook run pre-commit: pass.
- Not run: live seeding (no Temporal, Woodpecker or cluster writes),
retained-production-history replay, the extended tier (verify:extended), and
the RAM publisher script itself (it needs the /woodpecker claim mounts). The
NVMe golden mount is read-write: the step volume model has no read-only
option. The pod guard CEL is checked as text, not evaluated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… golden in place, and reap leaked RAM workspaces Why A RAM claim admitted just before a reseed's selection swap is provisioned from the snapshot it was given, but the RAM golden kept only the selected snapshot, so that snapshot could be deleted under it and the claim would hang. The workspace reaper and its leak alert knew only the ci-workspace class, so a leaked RAM workspace would hold liskov memory indefinitely. The seed rebuilt a full copy beside the live tree, which shares no blocks with the snapshot of the tree it replaces, and it mounted the NVMe golden every workspace clones read-write. What - RAM_GOLDEN retains the selected snapshot and its predecessor, as NVMe does, and never prunes a snapshot a Pending, Bound or phase-less claim in woodpecker-ci names as dataSource or dataSourceRef. The infra role gains list on PVCs; the NVMe golden does not list claims. - ci-workspace-reaper reaps ci-workspace-ram claims under the same age and terminal-pod rules, and WoodpeckerWorkspaceClaimLeaked matches both classes. - The RAM seed syncs the NVMe golden into the live RAM tree in place (syncTree: rsync -aH --numeric-ids --delete --chown=1000:1000, which the CI base image ships), unmarked while it changes, marker written last, then Temporal snapshots it. The 12Gi quota counts snapshots: in place it holds G + D = 6.06 GiB steady and G + 2D = 7.46 GiB during a reseed, against about 2G + D = 10.72 GiB for the old staged copy (G = 4.66 GiB, D = 1.40 GiB at zstd-1 and ashift 12). - MutatingAdmissionPolicy woodpecker-workspace-golden-ram-reader.sjer.red, matched to pods whose step key is maintenance-workspace-golden-ram, makes their mounts of woodpecker-workspace-golden read-only, mirroring the workspace-seeds readerMounts; the pod guard refuses that step otherwise. Cluster-baseline admission inventory and the pvc-backup-policy admission counts include it. - Docs: wiki CI admission and workflow families, the Temporal and extension READMEs. Verification - bun vitest (packages/temporal) src/activities/maintenance and src/activities/homelab/zfs-maintenance.test.ts: 30 files, 321 tests pass, including retention, referenced-snapshot and RAM reaper tests. - bun vitest (packages/woodpecker-config-extension) test/checkout/golden-sync.test.ts and test/maintenance.test.ts: pass; the sync tests run real rsync for unchanged, changed, deleted, symlink and hard link cases. - bun run scripts/run-test.ts (packages/homelab/src/cdk8s) ci-namespace, ci-workspace-golden-rbac, cluster-baseline, backup-policy and woodpecker rules: 5 files, 63 tests pass. - bunx turbo run typecheck lint for @homelab/cdk8s, temporal, woodpecker-config-extension and root-scripts: 43/43. - Read-only: the live ci-maintenance-coordinator history (704 events, via toolkit temporal workflow show) replays under this branch's workflows. It is not committed as the replay fixture: every tick failed in inspectCiMaintenance, so it never reaches the patched candidate path. - bunx lefthook run pre-commit: pass. - Not run: the server-side dry-run compile of the new mutation and guard rule, and a live reseed; no live change was made. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cies from one helper Why The RAM golden reader mutation copied the workspace-seeds mutation's shape, which the jscpd ratchet rejects as new duplication. What - createReaderMountPolicy builds the MutatingAdmissionPolicy and binding from an id, name, match conditions and the CEL variable naming the volumes; the workspace-seeds and RAM golden reader policies both use it. Verification - The pod guard chart synthesizes byte-identical YAML before and after. - bun run scripts/run-test.ts ci-namespace and cluster-baseline (packages/homelab/src/cdk8s): 2 files, 33 tests pass; eslint and tsc --noEmit pass. - bunx lefthook run pre-commit: pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s models Why main adopted typescript-eslint 8.74 (#5165), whose no-unsafe-class-instance-assignment rule rejects plain objects passed where a Kubernetes client model is expected. The RAM golden snapshot-reference test, rebased onto main, built its claims as object literals and failed the temporal lint. What - The claims in the snapshot-reference test are built with model(), as main's other Kubernetes tests are, including their spec, data source and status. Verification - bunx eslint src/activities/maintenance (packages/temporal): clean. - bun vitest src/activities/maintenance/ci-workspace-golden.test.ts: 10 pass. - tsc --noEmit (packages/temporal): no errors outside the unrelated ungenerated artifacts client. - 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
RAM workspaces clone a golden workspace that must live in the RAM pool, because ZFS clones only within a pool. That golden must be seeded, refreshed whenever the NVMe golden refreshes, and re-seeded after every reboot, which empties the pool. A RAM problem must never block the NVMe golden refresh.
PR 3 of 5.
What
workspace-golden-ram, separate fromworkspace-golden:ci-workspace-routestate. It offers a candidate only when an NVMe golden is selected and the pool is ONLINE. The fingerprint is<NVMe snapshot>@<pool GUID>, so the RAM golden re-seeds exactly when the NVMe golden changes or the pool is recreated.ensureCiWorkspaceGoldenRamClaimmakes sure the Temporal-owned PVCwoodpecker-workspace-golden-ramexists onci-golden-ram, 12Gi, annotated with the live pool GUID. A claim from an earlier pool generation is deleted, its removal waited out with heartbeats, and the claim recreated. ArgoCD could not repair it after a reboot.maintenance-workspace-golden-ramsyncs the published NVMe golden tree into the live RAM tree in place (syncTree:rsync -aH --numeric-ids --delete --chown=1000:1000, the CI base image ships rsync): changed files (by size and mtime) are rewritten, extraneous ones deleted, modes, symlinks and hard links kept, matching files untouched. The old marker is removed first and the new one written last, then Temporal snapshots the claim. It fails loudly without the NVMe marker. Leftover.staging/.retiredtrees from the earlier approach are removed.publish-workspace-golden-ram.ts): the claim's 12Gi ZFS quota counts its snapshots, so it must hold the live tree G plus what the retained snapshots alone hold, about the delta D between refreshes. At zstd-1/ashift 12 (PR 1's sizing): G = 4.66 GiB, D = 1.40 GiB (the 1.3x turnover). In place: G + D = 6.06 GiB steady, G + 2D = 7.46 GiB during a reseed until the oldest retained snapshot is pruned. The old staging swap shares no blocks with the snapshot of the tree it replaces: about 2G + D = 10.72 GiB transiently, 1.3 GiB under the quota.ci-workspace-golden-ram-…, 12Gi, its own label) and selects it inci-workspace-golden-ramas{snapshot, restoreSize: "12Gi", poolGuid}. It retains the selected snapshot and its predecessor, as NVMe does, and never prunes a RAM snapshot that a Pending or Bound claim inwoodpecker-cinames asdataSource/dataSourceRef: a RAM claim admitted just before a reseed's selection swap is provisioned from the snapshot it was given, and would hang if that snapshot were deleted first. The infra role gainsliston PVCs. NVMe pruning excludes the RAM prefix and does not list claims.patched("ci-maintenance-golden-ram-v1"). A RAM claim failure hands the tick to the other kinds. A RAM publish is abandoned if the pool was recreated in between, and RAM seeding waits while an NVMe snapshot is pending.ci-pod-guard: the RAM step may mount both golden claims. The RAM golden claim is otherwise mountable only by that step, on main and manual. The RAM step mounts the NVMe golden read-only: a new MutatingAdmissionPolicywoodpecker-workspace-golden-ram-reader.sjer.red, scoped by matchConditions to pods whose step key ismaintenance-workspace-golden-ramand that mountwoodpecker-workspace-golden, rewrites those container and init-container mounts toreadOnly: true(mirroring the workspace-seeds policy'sreaderMounts; the CSI volume itself stays RW for ZFS), and the pod guard refuses that step if any such mount is still writable. Temporal RBAC grows to cover the RAM ConfigMap, the route ConfigMap and the RAM claim.ci-workspace-reaperreaps leakedci-workspace-ramclaims under the same age and terminal-pod rules asci-workspaceones (not the Temporal-owned RAM golden claim), andWoodpeckerWorkspaceClaimLeakedmatches both classes.Demo
Seeding is proven in tests (
ci-workspace-golden-ram.test.ts,maintenance-golden-ram.test.ts):submitCiMaintenancevsinspectCiWorkspaceGoldenRam).{snapshot, restoreSize: "32Gi"}and never prunes a RAM snapshot, and a failing RAM claim hands the tick to the NVMe refresh.golden-sync.test.ts, real rsync): an unchanged file keeps its inode and mtime, a changed file is rewritten with its new mtime, extraneous files and directories are deleted while the target's marker is neither copied nor deleted, symlinks (including dangling) stay links, hard links stay one inode, a link replaced by a file becomes a file, and an rsync failure throws.ci-maintenance-coordinatorhistory (704 events, exported withtoolkit temporal workflow show -o json) replays cleanly under this branch's workflows.Verification
woodpecker-ci-pod-guard, which every CI pod passes through (one golden-claim mount rule now allows two step keys, a new rule for the RAM golden claim, and the read-only rule for the RAM step), and adds thewoodpecker-workspace-golden-ram-readermutation.bunx turbo run build typecheck test lint --filter=@homelab/cdk8s --filter=@shepherdjerred/temporal --filter=@shepherdjerred/woodpecker-config-extension --filter=@shepherdjerred/toolkit: 49/49, on the restacked base.bun run check-ci-admission-budget: holds.bunx turbo run jscpd quality-ratchet knip --filter=//: pass.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.ci/scripts/publish-workspace-golden-ram.tsitself, which needs the claim mounts;inspectCiMaintenance("GitHub source tree was truncated"), so it never reaches candidate selection where the patch guard matters, and an exported history cannot seed the takeover half of the test.🤖 Generated with Claude Code