operator-lifecycle-cli is an internal binary that exposes Rust lifecycle
contracts to non-Rust operators over JSON stdin/stdout. It is intended for Go
controller-runtime controllers that need the SDK admission, compatibility,
config-apply, or dataplane preflight logic without reimplementing it.
The binary accepts one subcommand:
version: printscontractVersionandcrateVersion; no stdin required.admission: reads anAdmissionRequestplusexpectedContractVersionand returnsAdmissionResponse.compatibility: readsCompatibilityRequestplusexpectedContractVersionand returnsCompatibilityDecision.config-apply: readsConfigApplyRequestplusexpectedContractVersionand returnsConfigApplyDecision.preflight: readsPreflightRequestplusexpectedContractVersionand returnsDataPlanePreflightReport.
All JSON responses include contractVersion on success. Errors are sanitized
and also include contractVersion when available.
cargo run -p operator-lifecycle-cli -- versionprintf '%s\n' '{
"expectedContractVersion": 1,
"uid": "example",
"runtime_mode": "lab",
"claims_ha": false,
"config_backend": "sqlite",
"session_backend": "fake",
"admin_auth": {"token_enabled": false, "admin_token": null},
"identity": {"kms_enabled": false, "spiffe_enabled": false}
}' | cargo run -p operator-lifecycle-cli -- admission- Wraps
operator-lifecycledecisions. - Uses
opc-node-resourcesto build production preflight reports from CLI resource-profile and node-capability JSON. - Used by integration tests through Cargo's
CARGO_BIN_EXE_operator-lifecycle-clipath.
- Unpublished binary crate (
publish = false). expectedContractVersionis required on stdin for every subcommand exceptversion.- Exit code
0means success,1means JSON/validation/runtime command error, and2means missing or mismatched contract version. - Stdin is capped at 1 MiB.
- The CLI does not watch Kubernetes resources, run a server, or persist state.
- Add subcommands only for stable pure-Rust contracts.
- Bump
operator-lifecycle::CONTRACT_VERSIONwhen request/response envelope compatibility changes. - Keep CLI error text sanitized because controller logs often persist it.
cargo test -p operator-lifecycle-cli
cargo run -p operator-lifecycle-cli -- version