Commit Graph

17 Commits

Author SHA1 Message Date
Maarten 52d8dbdc89 OC v0.3.0 comprehensive test: retry logic, auto-heal, apply_defaults validation
Phase 0-10 of OC test plan completed:
- Add --retries N flag to incusos-proxmox (default 3, configurable boot retries)
- Add fix_scrub_schedule() auto-heal for IncusOS crontab bug via REST API
- Validate apply_defaults: false for OC-managed nodes (recommended approach)
- Test full OC lifecycle: deploy, provision, cluster, workloads, migration,
  evacuation, node failure/recovery, inventory query, REST API
- Update CLAUDE.md: OC v0.3.0 commands, --retries, scrub fix, node recovery
- Update operations-center-guide.md: v0.3.0, apply_defaults, scrub fix,
  node failure simulation, IncusOS REST API docs, inventory query

Key findings:
- apply_defaults: false lets OC Terraform handle everything cleanly
- fix_scrub_schedule() proactively heals ~50% crontab boot failure
- OC does not detect node failures (always shows "ready")
- inventory query (v0.3.0) provides cross-resource tree views
- Node crash recovery: auto-rejoin in ~60s, containers auto-start

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 21:41:34 +01:00
Maarten b8e7a7ca62 Update boot failure analysis: error is persistent within VM session
Verified across 6 observe-deploy runs (3/6 hit crontab error, all 6 PASS).
Key finding: the error persists across systemd daemon restarts because the
deferred Save() writes corrupt state.txt (encoder skips zero-value
ScrubSchedule). Recovery requires Proxmox stop+start (hard power-off may
lose uncommitted corrupt write). Updated CLAUDE.md accordingly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 18:16:34 +01:00
Maarten 1499dd7072 Add observe-deploy diagnostics, boot failure analysis, and deploy reliability fixes
Observational single-VM deploy tool (observe-deploy) captures frame-by-frame
console screenshots via Proxmox SSH root screendump to diagnose IncusOS boot
failures. Four deploys revealed ~50% "invalid crontab expression" hit rate
with no correlation to update.yaml presence.

Deep analysis of IncusOS source code (main.go, state/, scheduling/, install.go)
traced the full crash path: registerJobs() validates ScrubSchedule via gocron
at step 19 of startup(), after applications start at step 16 and REST API
starts even earlier. Most likely a race condition or gocron edge case.

Key fixes:
- incusos-proxmox: automatic retry on first-boot failure (stop+start cycle)
- incusos-proxmox: pve_destroy_vm now waits for async UPID task completion
- observe-deploy: same UPID wait for destroy, full screenshot pipeline
- incusos-seed: always generate update.yaml with explicit check_frequency
- CLAUDE.md: complete boot sequence timeline, source-level root cause analysis,
  proposed upstream fix for IncusOS registerJobs() defensive validation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 13:42:51 +01:00
Maarten 00f57746ff Auto-load env file for PROXMOX_TOKEN_SECRET on startup
Scripts now search for an 'env' file up the directory tree from the
script location and source it automatically. No manual 'source env'
needed. Falls back gracefully -- if no env file exists and the secret
isn't exported, require_api_auth() catches it with a clear error.

Also fix unbound variable in --labs when pool has no VMs (declare -A
needs explicit =() initialization under set -u).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 08:56:28 +01:00
Maarten e0faba8980 Fix critical auth validation, role naming, Sys.Audit, and apply_defaults
Safety fix: --cleanup-all, --resources, --labs silently failed when
PROXMOX_TOKEN_SECRET was not set, reporting "No VMs found" instead of
an auth error. Added require_api_auth() gate and error propagation in
pve_list_vms() to fail loudly on API auth failures.

Also:
- Standardize role name to IncusOSDeployer across all docs and scripts
- Add Sys.Audit privilege to all setup command examples
- Document /nodes/pve ACL requirement for scoped permissions
- Update lab-cluster.yaml: apply_defaults: false for joining nodes
  (upstream IncusOS recommendation to avoid 8-command cleanup)
- Add full cluster automation to lab-test phase_cluster:
  core.https_address setup, remote cert fixup, automated join prompts,
  conditional defaults cleanup for apply_defaults: true nodes

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 08:51:52 +01:00
Maarten ca660585dc Correct reboot diagnosis: OC-specific, not dqlite/TPM corruption
Volume testing with live Proxmox infrastructure proved that guest reboot
does NOT break standalone IncusOS nodes. Tested:
- 4 consecutive Proxmox stop/start cycles: all clean, data intact
- Single-node guest reboot: recovered in ~50s, containers auto-started
- Simultaneous 3-node guest reboot: all recovered, data integrity verified

The "reboot breaks IncusOS" issue is OC-specific. Console errors showed:
- Node 1: "failed to parse update frequency" (OC pushed bad crontab)
- Node 2: stuck at "starting application" (waiting for peers in loops)
- Node 3: "constraint violation" (OC re-registering existing server)

Updated all 8 references across CLAUDE.md, operations-center-guide.md,
and TESTING.md to reflect the corrected diagnosis.

Also fixed one more bare return bug in do_list_labs (empty pool path).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 00:48:06 +01:00
Maarten 37d63c35a6 Fix exit code bugs, doctor output, and labs parsing from live testing
Tested all new commands (--resources, --labs, --lab-down, --lab-up,
--doctor, --status) against live Proxmox with 4 running IncusOS VMs.

Fixes:
- return → return 0 in 4 early-exit paths (pipefail + [[ ]] false
  propagated non-zero exit codes)
- do_list_labs: broken ERE regex [^\ \]]+ → [^\ ]+ for config tag
- do_list_labs: line-based Python output instead of delimiter-based
  tr (descriptions with spaces broke read parsing)
- do_list_labs: unsafe echo|tr|sort pipeline → printf|sort
- run_doctor: operations-center version → --version (shows 0.2.2)
- run_doctor: ls glob pipeline crash under pipefail (|| true)

CLAUDE.md:
- Document env file (PROXMOX_TOKEN_SECRET) and source workflow
- Add Sys.Audit to minimum API privileges (needed for --resources)
- Correct role name to IncusOSDeployer
- Add /nodes/pve ACL requirement for node-level endpoints

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 00:08:29 +01:00
Maarten f812e04746 Add macOS support, multi-lab lifecycle, extended testing, and migration docs
Fix OC reboot diagnosis across all docs (dqlite corruption, not TPM PCR).
Add cross-platform support: genisoimage/mkisofs detection, portable dd/grep/
date usage. Add --lab-up/--lab-down/--resources/--labs to incusos-proxmox for
multi-lab coexistence. Add 7 new lab-test phases (storage, network, projects,
backup, limits, security, resilience). Fix VMID collision in lab-advanced
(910→930). Create migration guide and UTM design doc.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 23:41:06 +01:00
Maarten 8ae8700346 Add Operations Center hands-on testing, hybrid deployment, and comprehensive guide
Deployed and tested the full OC provisioning pipeline on Proxmox:
- Hybrid approach: incusos-proxmox --iso with OC-provisioned ISOs
- Token seeds, auto-registration, single-command cluster formation
- Inventory sync, live migration visibility, evacuation, node replacement
- Discovered OC reboot breaks TPM encryption on Proxmox VMs

Key findings documented: dual-seed coexistence, apply_defaults conflict
with Terraform, inventory requires explicit resync, stale server entries
from out-of-band changes, meshbr0 network added by OC clustering.

New files:
- notes/operations-center-guide.md: full tested OC reference
- incusos/examples/lab-oc-deploy.yaml: OC server deployment config
- incusos/examples/lab-oc-nodes.yaml: 3-node OC cluster config

Updated: CLAUDE.md (OC section rewrite), TESTING.md (hybrid workflow),
.gitignore (env file with Proxmox secrets)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 22:55:48 +01:00
Maarten 732d70b38e Add advanced migration testing, cluster lifecycle, and clustering guide
- New lab-advanced.yaml (3-node 6/4/4 core heterogeneous cluster) and
  lab-replace.yaml (single replacement node) for advanced migration and
  cluster lifecycle testing
- New notes/clustering-guide.md with full clustering walkthrough: cluster
  formation, storage pool conflict fix, join workflow, VM live migration
  with limits.cpu range fix, multi-vCPU test results (2/3/4 vCPUs),
  edge cases (I/O, memory, concurrent), and node replacement lifecycle
- Updated CLAUDE.md with clustering docs, rebalancing config keys,
  cluster enable syntax fix (TWO args not one), cluster remove syntax,
  agent reconnect timing (3-4s not 1-2s), and lifecycle procedure
- proxmox.yaml.example for Proxmox connection config reference

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-20 18:46:55 +01:00
Maarten 2aca6fb33b Add lab validation tooling: doctor check, deep cleanup, lab-test script
Implements the first wave of lab validation infrastructure:

incusos-proxmox enhancements:
- --doctor flag: standalone environment health check (tool versions,
  IncusOS CDN availability, Proxmox connectivity). Works with or
  without a config file.
- --cleanup --deep: extended cleanup that also removes seed ISOs,
  IncusOS ISOs from Proxmox storage, matching incus remotes, and
  the local ISO cache (~/.cache/incusos-proxmox/iso-cache/).
- --cleanup-all: pool-wide cleanup that destroys ALL VMs with the
  [incusos-lab:managed] marker in the configured resource pool.
  Requires a pool to be set in config for safety scoping.

New script -- lab-test:
- Guided lab validation with 5 phases: deploy & verify, single-node
  workloads (container + VM lifecycle), cluster formation (enable +
  join via incus remotes), cluster workloads (scheduler-placed +
  targeted), and migration & evacuation (stop/move + evacuate/restore).
- Interactive by default with --yes for unattended runs.
- Reports PASS/FAIL/SKIP per test with a summary.
- Supports --dry-run, --skip-deploy, --cleanup, per-phase execution.
- Reads the same YAML config format as incusos-proxmox.

New example configs:
- lab-cluster.yaml: 3-node Incus cluster (VMID 900+) for testing
  clustering, workloads, and migration.
- lab-oc.yaml: Operations Center + 3 Incus nodes (VMID 910+) for
  testing OC-managed provisioning and cluster formation.

Documentation:
- CLAUDE.md: added clustering workflow (incus cluster enable/add/join
  via remotes), lab-test overview, Operations Center CLI notes,
  doctor and cleanup feature descriptions.
- README.md: added lab-test section with usage/phases/options, doctor
  check docs, deep cleanup docs, new example files in listing.
- TESTING.md: added full lab validation guide (quick start, phase-by-
  phase testing, manual cluster formation alternative, OC lab workflow
  with CLI setup and provisioning steps), cleanup instructions.

Not yet tested against live infrastructure -- next step is to deploy
lab-cluster.yaml, add incus remotes, and run lab-test end-to-end.
Known areas to validate: cluster join syntax with remotes, VM nested
virt support, evacuation behavior, apply_defaults consistency across
cluster members.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 22:00:05 +01:00
Maarten a0a4b48c73 Implement end-to-end IncusOS Proxmox deployment via API
Major changes to incusos-proxmox and incusos-seed to achieve fully automated
IncusOS deployment to Proxmox VE. Fixes multiple blockers discovered during
testing: FAT→ISO 9660 seed format (CD-ROM label detection), preseed YAML
structure (Go yaml:",inline"), disk target auto-detection, install completion
monitoring via blockstat disk I/O, install media ejection, and ARP-based IP
detection for the agent-less IncusOS.

Key changes:
- incusos-seed: add --format iso using genisoimage, fix preseed structure
- incusos-proxmox: ISO seeds, blockstat install detection, media ejection,
  ARP-based IP lookup, force_reboot requirement
- Documentation: comprehensive updates to CLAUDE.md, README.md, TESTING.md
- Examples: fix preseed.certificates path in all YAML examples
- Notes: full session progress with all bugs found and fixed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 15:26:58 +01:00
Maarten dc9814d92d Add VM management markers, cleanup safety, and testing guide
- Add [incusos-lab:managed] description marker to created VMs so cleanup
  can distinguish script-managed VMs from unmanaged ones
- Add --force-cleanup flag to override the management marker check
- Add incusos/TESTING.md with detailed test scenario, authentication
  setup (API token with minimum privileges), and troubleshooting reference

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 09:27:24 +01:00
Maarten 331f61d92c Added initial lab setup scripts 2026-02-19 08:28:14 +01:00
Maarten e2909c9149 version and certificate refinement 2026-02-18 14:49:31 +01:00
Maarten 8260f04389 bugfix 2026-02-18 14:18:37 +01:00
Maarten ef98e3f131 Initial Commit 2026-02-18 14:04:05 +01:00