Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
287131e
fix(site): Close a boot admission when its deadline stops the worker
scotwells Nov 25, 2026
d10a1dc
fix(site): Power off the local VM guest before a wipe
scotwells Nov 25, 2026
27d95dd
test(multiplane): Run the #174 failure scenarios end to end
scotwells Nov 25, 2026
67687b7
docs: Map the #174 acceptance tests to their end-to-end phases
scotwells Nov 25, 2026
91ad1bc
test(multiplane): Stop the boot server once the deadline worker exists
scotwells Nov 25, 2026
24187fd
test(multiplane): Withhold the deadline installer with a lab boot hook
scotwells Nov 25, 2026
f4c0730
test(multiplane): Reach the hold check with the mismatched recovery
scotwells Nov 25, 2026
2bf9435
test(multiplane): Show a tenant cannot act on hardware it does not hold
scotwells Nov 25, 2026
425fdaa
test(custody): Guard how recoveries use site fence reports
scotwells Nov 25, 2026
327bac9
test(multiplane): Make the failure scenarios prove what they claim
scotwells Nov 25, 2026
ccee923
fix(multiplane): Never record an interrupted run as passed
scotwells Nov 25, 2026
1592e83
test(multiplane): Prove the deadline hook denied a boot
scotwells Nov 26, 2026
cf2d90d
test(multiplane): Give the interrupt self-test default signals
scotwells Nov 26, 2026
cfd501a
docs: Record that both multi-plane runs pass on custody
scotwells Nov 26, 2026
c0f00aa
feat(multiplane): Run acceptance in GitHub Actions
scotwells Nov 27, 2026
65ad93f
fix(multiplane): Find the partition trace mid-line
scotwells Nov 27, 2026
88874ea
fix(multiplane): Mark the partition step in one line
scotwells Nov 27, 2026
e71d2f1
fix(multiplane): Ignore the marker's own shell trace
scotwells Nov 27, 2026
f6398a7
test(multiplane): Shorten lab timers
scotwells Nov 27, 2026
a3528b5
ci(multiplane): Cache Go builds per mode
scotwells Nov 27, 2026
76ce21d
test(multiplane): Run Redfish targets under KVM
scotwells Nov 27, 2026
2d620b1
ci(multiplane): Shard each suite in two
scotwells Nov 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
221 changes: 221 additions & 0 deletions .github/workflows/multiplane-acceptance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
name: multiplane-acceptance
# The multi-plane acceptance in CI mode (docs/operations/multiplane.md#ci-mode)
# on a disposable GitHub-hosted runner: three kind clusters, Milo, Karmada, kro,
# Flux and a privileged libvirt/QEMU site Pod. Both modes run their guests
# under KVM. It runs on demand,
# nightly, and on a pull request only when the multiplane-acceptance label is
# applied, never on every push.
on:
workflow_dispatch:
inputs:
mode:
description: Site provider
type: choice
options: [both, localvm, redfish]
default: both
schedule:
- cron: '23 5 * * *'
pull_request:
types: [labeled]
permissions:
contents: read
jobs:
acceptance:
if: github.event_name != 'pull_request' || github.event.label.name == 'multiplane-acceptance'
name: acceptance (${{ matrix.mode }}, ${{ matrix.group }})
# Each suite runs as two shards on separate runners, after the same setup
# and core install scenarios: flux runs the Flux scenarios, release the
# reflection, release, reuse, deadline and rebuild scenarios. The
# acceptance job below passes only if every shard passed. A new suite is
# one more mode here and in the task selection below.
strategy:
fail-fast: false
matrix:
mode: ${{ fromJSON(github.event_name == 'workflow_dispatch' && inputs.mode != 'both' && format('["{0}"]', inputs.mode) || '["localvm","redfish"]') }}
group: [flux, release]
# A newer labeled run for the same pull request replaces an older one;
# nightly and manual runs never cancel each other. A cancelled run never
# counts as passed.
concurrency:
group: multiplane-acceptance-${{ github.event.pull_request.number || github.run_id }}-${{ matrix.mode }}-${{ matrix.group }}
cancel-in-progress: true
runs-on: ubuntu-24.04
timeout-minutes: 120
env:
FLEET_MULTIPLANE_RUNTIME: ci
FLEET_MULTIPLANE_DOCKER_CONTEXT: default
FLEET_MULTIPLANE_ARCH: amd64
FLEET_MULTIPLANE_ACCEL: kvm
FLEET_MULTIPLANE_GROUP: ${{ matrix.group }}
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with: {persist-credentials: false}
# A pull request run tests GitHub's merge of the head into the base.
- name: Record the tested commits
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
run: printf 'Tested commit %s for head %s\n' "$(git rev-parse HEAD)" "$HEAD_SHA" | tee -a "$GITHUB_STEP_SUMMARY"
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6
with: {go-version-file: go.mod, cache: false}
# This job's own Go build cache: the readiness tests build with the race
# detector and the site binary without cgo, so a cache saved by another
# workflow holds neither. Keyed by commit, restoring the newest for the
# same go.sum.
# Saved after the build phase even when the run later fails, so a failing
# run still warms the next one.
- uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: multiplane-go-${{ matrix.mode }}-${{ hashFiles('go.mod', 'go.sum') }}-${{ github.sha }}
restore-keys: |
multiplane-go-${{ matrix.mode }}-${{ hashFiles('go.mod', 'go.sum') }}-
multiplane-go-${{ matrix.mode }}-
- uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with: {python-version: '3.12.12'}
- uses: imranismail/setup-kustomize@2ba527d4d055ab63514ba50a99456fc35684947f # v2
with: {kustomize-version: 5.8.1}
- name: Install pinned kind, kubectl and task
run: |
set -euo pipefail
go install sigs.k8s.io/kind@v0.31.0
go install github.com/go-task/task/v3/cmd/task@v3.53.1
directory=$(mktemp -d)
trap 'rm -rf "$directory"' EXIT
cd "$directory"
curl --fail --location --retry 3 --max-time 60 -o kubectl https://dl.k8s.io/release/v1.35.0/bin/linux/amd64/kubectl
curl --fail --location --retry 3 --max-time 60 -o kubectl.sha256 https://dl.k8s.io/release/v1.35.0/bin/linux/amd64/kubectl.sha256
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
chmod +x kubectl
mkdir -p "$HOME/.local/bin"
mv kubectl "$HOME/.local/bin/kubectl"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
# The runner's disk has far more free space than the 12 GiB the harness
# requires in the Docker data root, and preflight checks it.
- name: Record runner capacity
run: |
{
echo "FLEET_MULTIPLANE_STATE_ROOT=$RUNNER_TEMP/fleet-multiplane"
echo "METRICS=$RUNNER_TEMP/runner-metrics"
} >> "$GITHUB_ENV"
nproc
free -m
df -h / /var/lib/docker
docker version --format 'docker {{.Server.Version}}'
# Hosted runners restrict /dev/kvm to the kvm group; grant the runner
# access, as GitHub documents for hardware acceleration.
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
ls -l /dev/kvm || true
- name: Sample runner memory
run: |
mkdir -m 0700 "$METRICS"
# Every 10 s: memory, swap, the run's container memory and free disk. Container
# names and byte counts only. The script expands in its own shell.
# shellcheck disable=SC2016
nohup sh -c 'while :; do
printf "%s %s\n" "$(date -u +%FT%TZ)" "$(awk "/^(MemTotal|MemAvailable|SwapTotal|SwapFree):/ {printf \"%s=%s \", \$1, \$2}" /proc/meminfo)" >> "$1/meminfo.log"
docker stats --no-stream --format "{{.Name}} {{.MemUsage}}" 2>/dev/null | sed "s/^/$(date -u +%FT%TZ) /" >> "$1/containers.log"
printf "%s %s\n" "$(date -u +%FT%TZ)" "$(df -k --output=avail /var/lib/docker | tail -1)" >> "$1/disk.log"
sleep 10
done' sh "$METRICS" >/dev/null 2>&1 &
echo $! > "$METRICS/sampler.pid"
- name: Run multi-plane acceptance (${{ matrix.mode }})
timeout-minutes: 100
env:
TASK: ${{ matrix.mode == 'localvm' && 'multiplane:acceptance' || 'multiplane:redfish-acceptance' }}
run: |
mkdir -m 0700 "$FLEET_MULTIPLANE_STATE_ROOT"
task "$TASK"
# A timeout or cancellation can stop run.sh before its own scan, so the
# evidence is scanned again here. A match is redacted in place, and the
# second scan must be clean before anything is uploaded.
- name: Record memory and secret-scan evidence
id: scan
if: always()
run: |
kill "$(cat "$METRICS/sampler.pid")" 2>/dev/null || true
sudo dmesg | grep -iE 'out of memory|oom-kill' > "$METRICS/oom.log" || true
python3 - "$METRICS" <<'PY' | tee "$METRICS/summary.txt" >> "$GITHUB_STEP_SUMMARY"
import pathlib, sys
m = pathlib.Path(sys.argv[1])
rows = [dict(f.split('=') for f in l.split()[1:]) for l in (m / 'meminfo.log').read_text().splitlines()] if (m / 'meminfo.log').exists() else []
if rows:
total = int(rows[0]['MemTotal:']) / 2**20
low = min(int(r['MemAvailable:']) for r in rows) / 2**20
swap = max(int(r['SwapTotal:']) - int(r['SwapFree:']) for r in rows) / 2**20
print('Runner memory: %.1f GiB total, %.1f GiB peak used, %.1f GiB minimum available, %.2f GiB peak swap, %d samples' % (total, total - low, low, swap, len(rows)))
disk = [int(l.split()[1]) for l in (m / 'disk.log').read_text().splitlines()] if (m / 'disk.log').exists() else []
if disk:
print('Runner disk: %.1f GiB minimum available in the Docker data root' % (min(disk) / 2**20))
oom = (m / 'oom.log').read_text().strip().splitlines() if (m / 'oom.log').exists() else []
print('Kernel OOM events: %d' % len(oom))
PY
found=false
for state in "$FLEET_MULTIPLANE_STATE_ROOT"/fleet-multiplane.*; do
[ -d "$state/evidence" ] || continue
mkdir -p "$state/evidence/runner"
cp "$METRICS"/meminfo.log "$METRICS"/containers.log "$METRICS"/summary.txt "$METRICS"/oom.log "$METRICS"/disk.log "$state/evidence/runner/" 2>/dev/null || true
if ! python3 hack/multiplane/harness.py scan --state "$state"; then
redacted=true
python3 hack/multiplane/harness.py scan --state "$state"
fi
found=true
done
echo "found=$found" >> "$GITHUB_OUTPUT"
echo "redacted=${redacted:-false}" >> "$GITHUB_OUTPUT"
# Both shards of a mode build the same binaries; one save per commit is
# enough, and a second save of the same key is skipped.
- name: Save the Go build cache
if: always() && matrix.group == 'release'
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: multiplane-go-${{ matrix.mode }}-${{ hashFiles('go.mod', 'go.sum') }}-${{ github.sha }}
# Only evidence/ is uploaded, never the private state directory.
- name: Upload sanitized evidence
if: always() && steps.scan.outcome == 'success' && steps.scan.outputs.found == 'true'
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
with:
name: multiplane-evidence-${{ matrix.mode }}-${{ matrix.group }}-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/fleet-multiplane/fleet-multiplane.*/evidence/
if-no-files-found: error
retention-days: 14
# The job passes only if exactly one run recorded passed with every phase
# passed and teardown passed. A killed, timed-out or cancelled run fails.
- name: Verify the recorded result
if: always()
run: |
states=("$FLEET_MULTIPLANE_STATE_ROOT"/fleet-multiplane.*)
[ "${#states[@]}" -eq 1 ] && [ -d "${states[0]}" ] || { echo "expected exactly one run, found ${#states[@]}"; exit 1; }
python3 hack/multiplane/harness.py verify --state "${states[0]}" --group "$FLEET_MULTIPLANE_GROUP"
# A secret that reached evidence fails the job, even after its redaction.
- name: Fail on redacted evidence
if: always() && steps.scan.outputs.redacted == 'true'
run: |
echo 'evidence matched a retained secret and was redacted; see the scan step'
exit 1
# The one result for a run: it fails unless every shard of every suite
# passed, including when a shard was skipped or cancelled.
acceptance-result:
name: acceptance
if: always() && (github.event_name != 'pull_request' || github.event.label.name == 'multiplane-acceptance')
needs: acceptance
# A newer labeled run replaces this one too, so a replaced run leaves no
# stale result beside the new one.
concurrency:
group: multiplane-acceptance-${{ github.event.pull_request.number || github.run_id }}-result
cancel-in-progress: true
runs-on: ubuntu-24.04
timeout-minutes: 5
steps:
- name: Require every shard to pass
env:
RESULT: ${{ needs.acceptance.result }}
run: |
[ "$RESULT" = success ] || { echo "a multi-plane acceptance shard did not pass: $RESULT"; exit 1; }
echo 'every multi-plane acceptance shard passed'
24 changes: 18 additions & 6 deletions cmd/fleet-multiplane/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func main() {

func run() error {
if len(os.Args) < 2 {
return fmt.Errorf("usage: fleet-multiplane coordinator|site-worker|site-observer|image|boot-service|boot-denials|dhcp-feed|redfish-probe|<management phase> [flags]")
return fmt.Errorf("usage: fleet-multiplane coordinator|site-worker|site-observer|image|boot-service|boot-withhold|boot-denials|dhcp-feed|redfish-probe|<management phase> [flags]")
}
fs := flag.NewFlagSet(os.Args[1], flag.ContinueOnError)
once := fs.Bool("once", false, "one attempt, for fault injection")
Expand All @@ -49,6 +49,8 @@ func run() error {
uuid := fs.String("uuid", "", "enrolled Redfish System UUID (redfish-probe)")
pin := fs.String("pin", "", "the BMC's approved key digest; the probe connects only to that key (redfish-probe)")
syncToken := fs.String("sync-token-file", "", "file holding the DHCP synchronizer bearer token (dhcp-feed)")
installationDeadline := fs.Duration("installation-deadline", 0, "replace the installation deadline for operations this coordinator admits (coordinator)")
skewMargin := fs.Duration("skew-margin", 0, "replace the margin after a deadline before the coordinator declares it exceeded (coordinator)")
if err := fs.Parse(os.Args[2:]); err != nil {
return err
}
Expand All @@ -61,10 +63,10 @@ func run() error {
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer cancel()
fmt.Println("coordinator: custody coordinator running")
return multiplane.Coordinate(ctx, config, func(err error) {
return multiplane.Coordinate(ctx, config, multiplane.CoordinatorOptions{InstallationDeadline: *installationDeadline, SkewMargin: *skewMargin}, func(err error) {
fmt.Fprintf(os.Stderr, "%s coordinator: pass incomplete: %v\n", time.Now().UTC().Format(time.RFC3339), err)
})
case "seed", "allocate", "install", "install-b", "admit-install", "release", "release-b", "reuse":
case "seed", "allocate", "install", "admit-install", "admit-install-b", "release", "release-b", "reuse", "recovery-mismatch", "probe-unallocatable", "tenant-isolation":
return phase(os.Args[1], *configPath, *once)
case "redfish-probe":
return probe(*endpoint, *credentials, *system, *uuid, *pin)
Expand All @@ -77,6 +79,8 @@ func run() error {
return nil
case "boot-service", "boot-denials", "dhcp-feed":
return boot(os.Args[1], *origin, *extraMAC, *syncToken)
case "boot-withhold":
return armWithhold(fs.Arg(0))
case "site-worker", "site-observer":
default:
return fmt.Errorf("unknown command")
Expand Down Expand Up @@ -142,8 +146,9 @@ func phase(name, configPath string, once bool) error {
return err
}
action := map[string]func(context.Context) error{
"allocate": r.Allocate, "admit-install": r.AdmitInstall, "install": r.Install, "install-b": r.InstallSecond,
"allocate": r.Allocate, "admit-install": r.AdmitInstall, "install": r.Install,
"release": r.Release, "release-b": r.ReleaseSecond, "reuse": r.Reuse,
"admit-install-b": r.AdmitInstallSecond, "recovery-mismatch": r.RecoveryMismatch, "probe-unallocatable": r.ProbeUnallocatable, "tenant-isolation": r.TenantIsolation,
}[name]
last := ""
for {
Expand All @@ -154,10 +159,13 @@ func phase(name, configPath string, once bool) error {
last = err.Error()
fmt.Printf("%s: waiting: %v\n", name, err)
}
if name == "admit-install" && errors.Is(err, multiplane.ErrAdmittedUnknown) {
if strings.HasPrefix(name, "admit-install") && errors.Is(err, multiplane.ErrAdmittedUnknown) {
fmt.Println("Installation admitted and delivered; its result remains Unknown")
return nil
}
if err == nil && (name == "recovery-mismatch" || name == "probe-unallocatable" || name == "tenant-isolation") {
return nil
}
if err == nil {
fmt.Println(name + ": verified local acceptance phase (synthetic authority)")
return nil
Expand All @@ -180,7 +188,8 @@ func redfishMode() bool { return os.Getenv("FLEET_SITE_PROVIDER") == "redfish" }

// probe performs read-only Redfish discovery of one enrolled System and
// prints only an outcome class. Exit codes: 0 discovered, 10 credential
// rejected, 11 capability unsupported, 12 identity mismatch.
// rejected, 11 capability unsupported, 12 identity mismatch, 13 TLS key
// other than the pin.
func probe(endpoint, credentials, system, uuid, pin string) error {
user, err1 := os.ReadFile(credentials + "/username")
password, err2 := os.ReadFile(credentials + "/password")
Expand All @@ -204,6 +213,9 @@ func probe(endpoint, credentials, system, uuid, pin string) error {
case errors.Is(err, redfish.ErrUnsupported):
fmt.Println("redfish-probe: required capability not advertised; no effect issued")
os.Exit(11)
case errors.Is(err, redfish.ErrPinMismatch):
fmt.Println("redfish-probe: the BMC's TLS key does not match the pin; no request sent")
os.Exit(13)
case errors.Is(err, redfish.ErrIdentity):
fmt.Println("redfish-probe: enrolled identity not matched exactly; no effect issued")
os.Exit(12)
Expand Down
29 changes: 22 additions & 7 deletions cmd/fleet-multiplane/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,16 @@ func vmConfig() (vmwork.Config, fixture.Enrollment, error) {
default:
return vmwork.Config{}, nil, errors.New("FLEET_LOCAL_VM_ACCEL must be kvm or tcg")
}
if accelerator == "kvm" {
if _, err := os.Stat("/dev/kvm"); err != nil {
return vmwork.Config{}, nil, err
}
}
uri := os.Getenv("FLEET_LIBVIRT_URI")
if !strings.HasPrefix(uri, "qemu:///system?socket="+libvirtSocketDir+"/") {
return vmwork.Config{}, nil, errors.New("FLEET_LIBVIRT_URI must name the site's libvirt socket")
}
// The worker starts no hypervisor itself: the runtime behind the socket
// does, and it checks its own device. A worker runs only against a
// runtime that published the same accelerator.
if err := runtimeAccelerator(libvirtSocketDir, accelerator); err != nil {
return vmwork.Config{}, nil, err
}
var enrollment fixture.Enrollment
decoder := json.NewDecoder(strings.NewReader(os.Getenv("FLEET_SITE_ENROLLMENT")))
decoder.DisallowUnknownFields()
Expand All @@ -115,6 +116,19 @@ func vmConfig() (vmwork.Config, fixture.Enrollment, error) {
return config, enrollment, nil
}

// runtimeAccelerator checks that the VM runtime sharing dir published
// accelerator.
func runtimeAccelerator(dir, accelerator string) error {
data, err := os.ReadFile(filepath.Join(dir, "accelerator"))
if err != nil {
return errors.New("the site's VM runtime has not published its accelerator")
}
if published := strings.TrimSpace(string(data)); published != accelerator {
return fmt.Errorf("the site's VM runtime runs %s guests, not %s", published, accelerator)
}
return nil
}

// redfishBootServer is what the Redfish boot server needs: the artifacts it
// serves, the image they are, the listener firmware reaches, and where it
// records deliveries. It reads no enrollment or credential.
Expand Down Expand Up @@ -245,7 +259,7 @@ func boot(command, origin, extraMAC, syncToken string) error {
}
return server.ServeDHCP(strings.TrimSpace(string(token)))
}
return server.Serve(vmwork.DefaultBootWindow * 2)
return serveBoot(server.Handler(), vmwork.DefaultBootWindow*2)
}
if command == "dhcp-feed" {
return errors.New("the DHCP reservation feed serves only a Redfish site")
Expand All @@ -254,5 +268,6 @@ func boot(command, origin, extraMAC, syncToken string) error {
if err != nil {
return err
}
return vm.ServeBoot(store)
// Emulated firmware takes minutes to fetch the installer.
return serveBoot(vm.BootHandler(store), vmwork.DefaultBootWindow)
}
25 changes: 25 additions & 0 deletions cmd/fleet-multiplane/site_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package main

import (
"os"
"path/filepath"
"testing"
)

// TestAWorkerRunsOnlyAgainstARuntimeWithItsAccelerator refuses a runtime
// that published nothing or another accelerator.
func TestAWorkerRunsOnlyAgainstARuntimeWithItsAccelerator(t *testing.T) {
dir := t.TempDir()
if err := runtimeAccelerator(dir, "kvm"); err == nil {
t.Fatal("a runtime that published no accelerator was accepted")
}
if err := os.WriteFile(filepath.Join(dir, "accelerator"), []byte("tcg\n"), 0o600); err != nil {
t.Fatal(err)
}
if err := runtimeAccelerator(dir, "kvm"); err == nil {
t.Fatal("a KVM worker accepted a TCG runtime")
}
if err := runtimeAccelerator(dir, "tcg"); err != nil {
t.Fatalf("a TCG worker refused a TCG runtime: %v", err)
}
}
Loading
Loading