Show K3s recovery in OpsProof demo
Homelab Main / validate (push) Failing after 1m51s Details
Homelab Main / running-update (push) Has been skipped Details
Homelab Main / debian-ops (push) Has been skipped Details

This commit is contained in:
juvenal.diaz 2026-12-05 08:13:20 -06:00
parent a6ef6d19f4
commit 238aa4049f
6 changed files with 62 additions and 12 deletions

View File

@ -145,6 +145,11 @@ The first complete scenario will model the Orange Pi K3s storage incident:
- validation: pinned cluster identity, node readiness, and application health;
- report: findings, diagnosis, 5 Whys, mitigation, and validation evidence.
The public demo now presents a sanitized fixture of this completed scenario,
including bounded evidence, the approval-gated repair, rollback boundary,
post-change validation, Five Whys, and a prevention recommendation. It never
connects to Jeannie or exposes private infrastructure data.
This scenario is valuable to a prospective client because it demonstrates
diagnosis, safety design, AI-assisted reasoning, infrastructure automation,
observability, and a verified operational outcome rather than a chat demo.

View File

@ -8,18 +8,28 @@ import (
func Show(*web.Request) *web.Response {
return inertia.Render("Demo", inertia.Props{
"demo": inertia.Props{
"scope": "cluster", "target": "example-api", "outcome": "validated",
"finding": "A disposable application repeatedly restarted after a configuration rollout.",
"diagnostic": "Focused evidence linked the restarts to one invalid application setting; node and storage checks remained healthy.",
"proposal": "Run the constrained Jeannie Doctor repair for the affected application.",
"rollback": "Restore the previous application revision and confirm readiness before reopening traffic.",
"validation": "The execution completed and a fresh focused Doctor run returned no warning or failing evidence.",
"scope": "opi5", "target": "k3s-storage", "outcome": "validated",
"finding": "The Orange Pi K3s service failed after its USB SSD disappeared and the stale ext4 mount was remounted read-only.",
"diagnostic": "The mounted runtime still referenced the vanished block-device identity. The SSD later reappeared under a different Linux device name, so its name alone was not trusted.",
"proposal": "Run the constrained doctor opi5 --repair-k3s workflow only after matching the reappeared filesystem to the pinned K3s CA and cluster identity.",
"rollback": "Keep K3s stopped and leave the replacement mount disconnected if the filesystem UUID, pinned CA, or live cluster identity does not match.",
"validation": "The guarded workflow verified the pinned CA, remounted the intended filesystem read-write, started K3s, confirmed the pinned cluster identity, and observed the Orange Pi node Ready.",
"evidence": []inertia.Props{
{"id": "C01", "status": "fail", "check": "Application readiness", "summary": "Desired 1, ready 0"},
{"id": "C02", "status": "warn", "check": "Container restarts", "summary": "Restart backoff observed"},
{"id": "C03", "status": "ok", "check": "Post-change validation", "summary": "Desired state satisfied"},
{"id": "C01", "status": "fail", "check": "K3s service", "summary": "Service exited while its runtime filesystem was unavailable"},
{"id": "C02", "status": "fail", "check": "Runtime mount", "summary": "Stale ext4 mount was read-only and its original block device was absent"},
{"id": "C03", "status": "warn", "check": "Filesystem evidence", "summary": "Kernel journal recorded repeated ext4 directory read errors"},
{"id": "C04", "status": "ok", "check": "Identity validation", "summary": "Reappeared SSD contained the pinned K3s CA and expected cluster identity"},
{"id": "C05", "status": "ok", "check": "Post-change validation", "summary": "Filesystem was read-write, K3s was active, and the node was Ready"},
},
"notice": "Sanitized fixture only. This public route has no Jeannie client, credentials, approval, or execution capability.",
"fiveWhys": []string{
"K3s was unavailable because its service could not use the runtime directory.",
"The runtime directory was unavailable because the backing ext4 mount was stale and read-only.",
"The mount became stale because the USB SSD disappeared while the kernel retained the old mounted device identity.",
"The returning SSD received a different Linux device name, so an automatic name-based remount would have been unsafe.",
"Recovery must identify storage by durable filesystem and cluster identity, then validate the service and node before declaring success.",
},
"recommendation": "Keep the identity-pinned recovery in Jeannie, alert on read-only K3s storage, and investigate the USB power, cable, enclosure, and host-controller path if the disconnect recurs.",
"notice": "Sanitized fixture only. This public route has no Jeannie client, credentials, approval, or execution capability.",
},
})
}

View File

@ -7,6 +7,8 @@ interface Demo {
proposal: string;
rollback: string;
validation: string;
fiveWhys: string[];
recommendation: string;
notice: string;
evidence: Array<{ id: string; status: string; check: string; summary: string }>;
}
@ -52,6 +54,24 @@ export default function DemoPage({ demo }: { demo: Demo }) {
))}
</section>
<section className="mt-8 grid gap-6 rounded-3xl border border-white/10 bg-[#0b1621] p-6 lg:grid-cols-[1.4fr_1fr]">
<div>
<p className="text-xs uppercase tracking-[0.18em] text-cyan-200">Five Whys</p>
<ol className="mt-4 space-y-3">
{demo.fiveWhys.map((why, index) => (
<li key={why} className="flex gap-3 text-sm leading-6 text-slate-400">
<span className="font-mono text-cyan-300">{index + 1}</span>
<span>{why}</span>
</li>
))}
</ol>
</div>
<div className="border-t border-white/10 pt-6 lg:border-l lg:border-t-0 lg:pl-6 lg:pt-0">
<p className="text-xs uppercase tracking-[0.18em] text-cyan-200">Recommendation</p>
<p className="mt-4 text-sm leading-6 text-slate-400">{demo.recommendation}</p>
</div>
</section>
<footer className="py-8 text-xs text-slate-600">
Built with Laravel Go, React/Inertia, PostgreSQL, Dex, Jeannie, Holmes, and an OCI edge boundary.
</footer>

View File

@ -14,5 +14,8 @@ func TestPublicDemoUsesSanitizedFixtureWithoutAuthentication(t *testing.T) {
"OPSPROOF_JEANNIE_TOKEN": "must-not-be-used",
}))
client.WithoutRedirects().Get("/").AssertRedirect("/demo")
client.Get("/demo").AssertOK().AssertInertia("Demo").AssertProp("demo.outcome", "validated")
client.Get("/demo").AssertOK().AssertInertia("Demo").
AssertProp("demo.scope", "opi5").
AssertProp("demo.target", "k3s-storage").
AssertProp("demo.outcome", "validated")
}

View File

@ -8,5 +8,7 @@ import (
func TestTheWelcomePageRenders(t *testing.T) {
client := tests.New(t)
client.Get("/").AssertOK().AssertInertia("Demo").AssertProp("demo.outcome", "validated")
client.Get("/").AssertOK().AssertInertia("Demo").
AssertProp("demo.target", "k3s-storage").
AssertProp("demo.outcome", "validated")
}

View File

@ -196,8 +196,17 @@ class OpsProofPipelineTests(unittest.TestCase):
ROOT / "apps/opsproof/overlay/handlers/demo/show.go"
).read_text(encoding="utf-8")
self.assertIn("Sanitized fixture only", demo_handler)
self.assertIn('"target": "k3s-storage"', demo_handler)
self.assertIn('"fiveWhys": []string{', demo_handler)
self.assertIn('"recommendation":', demo_handler)
self.assertNotIn("Jeannie.", demo_handler)
demo_page = (
ROOT / "apps/opsproof/overlay/resources/js/pages/Demo.tsx"
).read_text(encoding="utf-8")
self.assertIn("Five Whys", demo_page)
self.assertIn("demo.recommendation", demo_page)
edge = (ROOT / "bootstrap/edge/templates/default.conf.tftpl").read_text(
encoding="utf-8"
)
@ -218,6 +227,7 @@ class OpsProofPipelineTests(unittest.TestCase):
).read_text(encoding="utf-8")
self.assertIn("TestTheWelcomePageRenders", welcome_test)
self.assertIn('AssertInertia("Demo")', welcome_test)
self.assertIn('AssertProp("demo.target", "k3s-storage")', welcome_test)
if __name__ == "__main__":