Chapter 8 - Worked Answers
1. Predict nonempty precedence
Nonempty flags win, followed by nonempty environment values, then YAML. Removing flags allows environment to win; removing that environment setting exposes the YAML value. An empty override does not erase a lower-level nonempty value. Namespace ultimately defaults to default, while server URL remains required. The actual CLI lab exercised server and namespace conflicts. Token follows the same source-inspected loader order, but the lab intentionally does not claim a multi-token authentication experiment.
2. Distinguish local and network work
Validate invokes ParseDeployFile and returns parser/validator outcomes; it never calls the client factory. Service ls constructs a client, which first resolves a configured server URL and fails with actionable guidance if absent. A valid file can still be rejected by a server's policy, authorization, namespace or quota. Local validity therefore cannot be used as a deployment-success result.
3. Check the current version
The checker uses deployment_version from the bare service object, task version, desired_status and actual_status from each task, and spec.replicas. An old-version healthy task is not counted toward the current version. Current-version assigned tasks are not reported available, so the script exits one. This is a legitimate convergence failure rather than a JSON error. The two reads are not an atomic snapshot; a concurrent rollout can justify retrying the observation with a deadline, not changing intent automatically.
4. Preserve specific failures
A table grep can match an old replica, one of several replicas, a desired-running column, or diagnostic text. It also loses structured identity and version. The teaching checker validates the JSON shape, requires all current intended replicas available, and separates non-convergence from command/transport failure and incompatible data. The actual lab observed one before node registration, zero after manually accepted running reports, and two for missing service and connection refusal. It proves server-observed convergence only; no Docker or fresh endpoint health was measured.
Return to Chapter 8.