Skip to content

[Feature]: CLI flag for per-workload params #187

Description

@mrhillsman

Problem Statement

Per-workload params (e.g., cpu-load-percent, scale-factor, parallel-streams) can only be set via a YAML config file under workloads.<name>.params. For quick one-off runs or CI scripts, requiring a YAML file just to override a single param adds friction. Users should be able to pass params directly from the command line.

Proposed Solution

Add a single --params CLI flag that accepts comma-separated workload.key=value pairs, consistent with how --workloads handles comma-separated values:

virtwork run --workloads cpu --params cpu.cpu-load-percent=50,cpu.cpu-method=matrixprod

The flag would parse each pair into the corresponding WorkloadConfig.Params map entry. CLI params follow the existing priority chain: CLI flags win over YAML config, so --params would override any matching key in the YAML params block.

A corresponding VIRTWORK_PARAMS environment variable would use the same comma-separated format, matching the pattern established by VIRTWORK_SSH_AUTHORIZED_KEYS.

Depends on #188 — the typed param registry provides the schema needed to validate workload names, param keys, and value types at parse time, avoiding silent failures from typos.

Alternatives Considered

  • Status quo (YAML only): Works but requires creating a config file for even a single param override.
  • Repeatable --param flag (--param cpu.key=val --param cpu.key2=val2): Works but inconsistent with virtwork's comma-separated pattern (--workloads). More complex implementation (slice accumulation vs single string parse).
  • Structured env var per workload (e.g., VIRTWORK_CPU_PARAMS="cpu-load-percent=50"): More granular but explodes the env var namespace.
  • JSON string flag (--params '{"cpu": {"cpu-load-percent": "50"}}'): Flexible but poor ergonomics on the command line.

Area

CLI / Configuration

Architecture Layer

Layer 1 - Infrastructure (config, cluster, cloudinit, audit)

Additional Context

All nine workloads now support params via WorkloadConfig.Params map[string]string. The YAML path works well for reproducible runs and in-cluster deployments. This feature would complement it for ad-hoc CLI usage. The single-flag comma-separated pattern (one flag, one Viper binding, one parse function) is the simplest approach and matches the existing --workloads convention.

Implementation sequence: #184 (params on all workloads) → #188 (typed param registry) → this issue (CLI surface).

Metadata

Metadata

Assignees

Labels

good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.kind/featureCategorizes issue or PR as related to a new feature.priority/backlogHigher priority than priority/awaiting-more-evidence.tech-debtTechnical debt, code quality, or maintenance concerntriage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions