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).
Problem Statement
Per-workload
params(e.g.,cpu-load-percent,scale-factor,parallel-streams) can only be set via a YAML config file underworkloads.<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
--paramsCLI flag that accepts comma-separatedworkload.key=valuepairs, consistent with how--workloadshandles comma-separated values:The flag would parse each pair into the corresponding
WorkloadConfig.Paramsmap entry. CLI params follow the existing priority chain: CLI flags win over YAML config, so--paramswould override any matching key in the YAMLparamsblock.A corresponding
VIRTWORK_PARAMSenvironment variable would use the same comma-separated format, matching the pattern established byVIRTWORK_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
--paramflag (--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).VIRTWORK_CPU_PARAMS="cpu-load-percent=50"): More granular but explodes the env var namespace.--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
paramsviaWorkloadConfig.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--workloadsconvention.Implementation sequence: #184 (params on all workloads) → #188 (typed param registry) → this issue (CLI surface).