Problem Statement
Catalog entry authors have no fast feedback loop to structurally validate their entries before deploying. virtwork run --from-catalog <entry> --dry-run renders full YAML specs without a cluster, but it doesn't surface parse errors, placeholder typos, or structural issues in isolation — it exercises the full orchestration path.
Proposed Solution
Add a virtwork validate CLI subcommand:
virtwork validate [entry-names...] [--catalog-dir path]
- Positional args: entry names to validate. If none given, discover all subdirectories in catalog-dir.
--catalog-dir: override catalog directory (default ~/.virtwork/catalog)
Per-entry validation (all already exists in LoadCatalogEntry / validateManifest):
- Entry directory exists and is a directory
- At least one
*.service file present
workload.yaml parses as valid YAML
- Storage: names non-empty, non-reserved, non-duplicate; sizes parse as K8s quantities; serials ≤20 chars; mounts are absolute paths
- Service: at least one port; ports 1–65535; protocol TCP or UDP
- Multi-role: every declared role has a matching
{role}.service file
- Placeholder consistency via
ValidatePlaceholders (see linked issue)
Output: pass/fail per entry with actionable error messages. Exit 0 if all pass, non-zero if any fail.
Alternatives Considered
- Extend
--dry-run with validation output — conflates "preview deployment" with "check structure"; different use cases
- Makefile/script wrapper around
LoadCatalogEntry — less discoverable, not part of the CLI's help output
Area
CLI / Configuration, Workloads
Architecture Layer
Layer 4 - Orchestration (cmd, cleanup)
Additional Context
Implementation plan: docs/plans/write-two-catalog-workloads-wiggly-lerdorf.md (section 2)
Depends on ValidatePlaceholders from the linked issue.
Files changed:
| File |
Change |
internal/config/config.go |
Add BindValidateFlags(cmd) binding --catalog-dir |
cmd/virtwork/main.go |
Add newValidateCmd(), validateE(), wire into root command |
Verification:
go run ./cmd/virtwork validate --catalog-dir ./catalog # exits 0
go run ./cmd/virtwork validate --catalog-dir ./catalog sysbench # single entry
go run ./cmd/virtwork validate --catalog-dir /nonexistent # exits non-zero
go test ./...
Problem Statement
Catalog entry authors have no fast feedback loop to structurally validate their entries before deploying.
virtwork run --from-catalog <entry> --dry-runrenders full YAML specs without a cluster, but it doesn't surface parse errors, placeholder typos, or structural issues in isolation — it exercises the full orchestration path.Proposed Solution
Add a
virtwork validateCLI subcommand:--catalog-dir: override catalog directory (default~/.virtwork/catalog)Per-entry validation (all already exists in
LoadCatalogEntry/validateManifest):*.servicefile presentworkload.yamlparses as valid YAML{role}.servicefileValidatePlaceholders(see linked issue)Output: pass/fail per entry with actionable error messages. Exit 0 if all pass, non-zero if any fail.
Alternatives Considered
--dry-runwith validation output — conflates "preview deployment" with "check structure"; different use casesLoadCatalogEntry— less discoverable, not part of the CLI's help outputArea
CLI / Configuration, Workloads
Architecture Layer
Layer 4 - Orchestration (cmd, cleanup)
Additional Context
Implementation plan:
docs/plans/write-two-catalog-workloads-wiggly-lerdorf.md(section 2)Depends on
ValidatePlaceholdersfrom the linked issue.Files changed:
internal/config/config.goBindValidateFlags(cmd)binding--catalog-dircmd/virtwork/main.gonewValidateCmd(),validateE(), wire into root commandVerification: