Preflight workflows
Preflight is a check flow that tests whether a target environment can support an application before installation or operation. It turns a check specification into collected facts, evaluates those facts against stated outcomes, and returns results that a user or another system can act on.
Preflight purpose
Preflight gives an application owner an early view of environment readiness. A specification states what to inspect and what each observed state means, so the same checks can run before an install, an upgrade, or another operation.
Readiness decision
The flow separates fact gathering from the readiness decision. A collector gathers data from a Kubernetes cluster, a host, or selected remote hosts. An analyzer reads that data and turns it into a pass, warning, or failure with a message and optional help URI. References: pkg/…/preflight_types.go• L23-30, pkg/…/hostpreflight_types.go• L23-29, pkg/…/analyze.go• L52-138
Specification preparation
The preflight command accepts specifications from sources that fit the delivery context. It prepares those inputs before any target check runs, which lets an installer keep its checks in a local file, a remote service, a Kubernetes object, or standard input.
Specification sources
The command can load a specification from the following source types:
| Source | Role in the workflow |
|---|---|
| Local file or standard input | Carries a checked-in or generated specification. |
| HTTP URL or OCI reference | Lets a vendor publish the specification separately from the installer. |
| Kubernetes Secret or ConfigMap | Lets a cluster-managed object provide one or more specifications. |
uri field in a specification | Replaces the referring specification with a fetched version when URI loading is enabled. |
Unlike support-bundle discovery, preflight does not depend on an installed application or in-cluster specification discovery. The caller supplies the input because the check normally runs before the application exists. References: cmd/…/root.go• L22-35, internal/…/specs.go• L72-237, internal/…/specs.go• L376-431
Templated specifications
Templating lets one specification describe several installation or operation modes. Values from files are merged in order and command-line values override them. The command renders conditional parts before loading the final checks; preflight template exposes the same preparation step when a user needs to inspect or save the resolved specification.
The rendered v1beta3 path preserves an analyzer’s strict marker when the specification is converted to the loaded preflight model. This keeps vendor-marked requirements available to strict enforcement, including when the marker appears in a templated specification.
References: pkg/…/read_specs.go• L86-260, pkg/…/template.go• L16-79, cmd/…/template.go• L8-40, pkg/…/strict_v1beta3_test.go• L15-18, pkg/…/strict_v1beta3_test.go• L54-112
Specification assembly
Multiple inputs form one logical check set for the run. Cluster and host preflight entries are combined by appending their collectors and analyzers. A specification with an upload destination remains a separate cluster run so its results can go to that destination instead of being mixed with the local result set. References: pkg/…/read_specs.go• L43-83, pkg/…/concat.go• L7-36
Check execution
Execution gathers the facts named by the prepared specification and then evaluates the matching analyzers. The flow supports Kubernetes checks, local host checks, and remote host checks so readiness can cover both the control plane and the machines that will run the application.
Environment coverage
The main environment paths are:
| Path | Environment view |
|---|---|
| Cluster preflight | Kubernetes resources, cluster state, and other data available through the Kubernetes API. |
| Host preflight | The machine where the command runs. |
| Remote collection | Selected host nodes that collect data and return it for host analyzers. |
The cluster path adds the basic cluster facts needed for broad checks. Host and remote paths use the collectors named by their own specifications. Permission limits can skip some cluster collectors when the run is configured to continue without all permissions. References: pkg/…/collect.go• L96-166, pkg/…/collect.go• L169-367, pkg/…/collect.go• L369-509
Execution sequence
This sequence shows how a supplied specification becomes a user-facing readiness decision.
flowchart LR
A[Specification sources] --> B[Render and load]
B --> C[Prepare and validate]
C --> D[Collect target facts]
D --> E[Evaluate analyzers]
E --> F[Render results]
F --> G[Display or save]
E --> H[Upload result payload]
The command stops before collection when the input has no usable preflight content or when the applied values exclude all required collectors or analyzers. A dry run ends after preparation and prints the resolved specification instead of contacting the target. References: pkg/…/run.go• L54-83, pkg/…/validate_specs.go• L12-117
Specification validation
Validation checks that the prepared run still has enough work to produce a decision. It warns when no preflight exists, when a host preflight has no collectors or analyzers, or when applied conditions exclude every relevant item. The detailed rules are described in Preflight specification and validation. References: pkg/…/validate_specs.go• L12-117
Execution and analysis
Collection stores the facts in a temporary preflight bundle and analysis reads those facts through the analyzer definitions. A missing input or an analyzer error becomes a failed analysis result, which keeps an incomplete check visible instead of silently treating it as a pass. The detailed execution and result rules are described in Preflight execution and results. References: pkg/…/run.go• L85-214, pkg/…/analyze.go• L52-138
Result delivery
Result delivery makes the readiness decision useful to both a person and an automation system. The same analyzed outcomes can be shown in a terminal, written to a file, or sent to a configured HTTP destination.
User-facing results
Interactive mode presents a navigable terminal view with status, details, and optional help links. Non-interactive mode writes human-readable text or structured JSON or YAML to standard output or to a chosen file. The process exit status also carries the overall decision: success for all passes, a failure code when any check fails, and a warning code when there are warnings but no failures. References: pkg/…/interactive_results.go• L22-84, pkg/…/text_results.go• L13-45, pkg/…/run.go• L213-234
Result upload
An upload destination receives a JSON payload with each result’s status, title, message, strict marker, and optional URI. Permission errors can also be sent as error entries, which lets a remote consumer distinguish a failed requirement from an inability to inspect the target. References: pkg/…/upload_results.go• L13-74, pkg/…/run.go• L123-143, pkg/…/run.go• L192-202
Result artifacts
The run keeps collected data, the tool version, and analysis data in a temporary preflight bundle. It archives that bundle after analysis so a user has a record for follow-up even when the main result is displayed interactively or delivered elsewhere. References: pkg/…/run.go• L89-103, pkg/…/run.go• L178-208
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to the specification shape must stay aligned with the loader’s accepted API versions and the rendered v1beta3 path.
- Changes to v1beta3 conversion or template rendering must preserve analyzer strict markers for downstream enforcement.
- Changes to collector names or collected data paths must preserve the analyzer-to-data relationship.
- Changes to outcome fields must stay aligned across terminal output, structured output, upload payloads, and exit-code handling.
- Changes to URI loading must preserve the distinction between the referring specification and the fetched specification.
- Changes to host or remote collection must keep the target scope clear so a result is not shown as a cluster result.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| A templated v1beta3 specification has no values | Preparation fails before checks run. | Supply values with a values file or command-line override. |
| v1beta3 loading or template rendering drops an analyzer’s strict marker | Downstream consumers may not enforce a vendor-marked requirement. | Preserve the marker through conversion and template preparation. |
| All collectors or analyzers are excluded by applied values | The command returns a warning instead of claiming readiness. | Check the rendered specification before running it. |
| The target denies required cluster permissions | A collector may be skipped or the run may stop, depending on the permission setting. | Grant the needed permissions or use the continue-without-permissions behavior with care. |
| A collector fails or produces no usable data | The related analysis can fail, and an empty analysis cannot produce a successful run. | Inspect progress messages and the saved preflight bundle. |
| A configured result endpoint rejects the upload | The local run reports the upload problem through progress output. | Check the endpoint and retain the local bundle. |
Key files
| File | Why to read it |
|---|---|
| cmd/…/root.go | Defines the product entry point, supported input model, and user-facing run options. |
| pkg/…/read_specs.go | Shows the boundary between source loading, template preparation, URI expansion, and assembled specs. |
| pkg/…/strict_v1beta3_test.go | Captures the contract that strict analyzer markers survive v1beta3 loading and template preparation. |
| pkg/…/validate_specs.go | Defines the minimum content needed for a meaningful preflight decision. |
| pkg/…/run.go | Connects preparation, collection, analysis, artifact creation, result delivery, and exit status. |
| pkg/…/collect.go | Shows the supported target scopes and the fact-gathering stage. |
| pkg/…/analyze.go | Shows how collected facts become pass, warning, or failure results. |
| pkg/…/text_results.go | Defines the non-interactive result forms. |
| pkg/…/upload_results.go | Defines the result contract for remote delivery. |
| pkg/…/preflight_types.go | Defines the cluster preflight contract at a high level. |
| pkg/…/hostpreflight_types.go | Defines the host preflight contract at a high level. |