Introducing a new way to review your PRs.

Read the announcement

replicatedhq / kots

KOTS provides the framework, tools and integrations that enable the delivery and management of 3rd-party Kubernetes applications, a.k.a. Kubernetes Off-The-Shelf (KOTS) Software.

View on GitHub

21 documents · Updated Nov 23, 2026

docs / preflight-validation

Preflight validation

Preflight validation checks whether an application version can run on a target cluster before KOTS installs or upgrades it. The lifecycle turns an application-defined preflight specification and cluster facts into stored results, deployment decisions, operator-facing progress, and optional product reports.

System boundary

Preflight validation sits between version preparation and deployment. It uses the candidate version as the source of application requirements, reads the live cluster as the source of environment facts, and returns a decision that later install or upgrade work can use.

The system has two related execution paths:

PathPurposeState location
KOTS install and downstream upgradeValidate a version in a managed downstream before deployment.Downstream version records in the KOTS store.
Upgrade serviceValidate an upgrade in the upgrade-service process.A temporary preflight data file owned by that process.

The shared evaluator keeps the result shape and check behavior aligned across both paths. The API and state layer differ because the standard path controls a downstream version while the upgrade service runs beside the upgrade flow.

Compatibility inputs

Application requirements

The candidate release supplies a Troubleshoot preflight specification. Its collectors describe the cluster data to gather and its analyzers describe the conditions that produce pass, warning, or fail results. The specification is rendered for the candidate release before evaluation, so application templates and chart values can affect the checks. pkg/…/preflight_helm_values.go• L75-156

The system can add checks that depend on the target setup. A read-only private registry adds an image-availability check. An installer comparison can compare the installed cluster installer with the installer shipped by the candidate release. These checks make registry and installer compatibility part of the same validation result. pkg/…/preflight.go• L404-503

References: pkg/…/preflight_helm_values.go• L75-156 pkg/…/preflight.go• L404-503

Cluster context

The evaluator reads the live Kubernetes cluster through the preflight collectors. Cluster access and permission results are part of validation because a check cannot confirm a requirement when it cannot collect the needed data. The caller may choose to ignore permission errors and rerun, but this does not turn other failed checks into passes. pkg/…/execute.go• L108-164

The run also uses release and platform context. Registry settings can rewrite collector image references, while air-gapped and unsupported Troubleshoot cases can add a notice that explains why normal checks are limited. pkg/…/preflight.go• L69-111, pkg/…/preflight.go• L37-84

References: pkg/…/execute.go• L108-164 pkg/…/preflight.go• L69-111 pkg/…/preflight.go• L37-84

Validation lifecycle

Run preparation

Validation starts for a specific application and version sequence. The standard path does not run while required application configuration is incomplete. It also returns without work when the release has no preflight checks. Otherwise, it marks the version as pending preflight and prepares the rendered specification and collector context. pkg/…/preflight.go• L47-111

The upgrade service follows the same preparation model for its next sequence. It resets any prior local result, loads the upgrade archive, adds the applicable defaults, and starts the shared evaluator in the background. pkg/…/preflight.go• L18-42, pkg/…/preflight.go• L37-100

Check execution

The evaluator runs collection before analysis. Collection gathers the requested cluster facts and emits progress. Analysis applies the specification's outcomes to that data and maps each result to a common pass, warning, or fail record. A collection permission error produces explicit error records and skips analysis so operators do not mistake incomplete data for a valid pass. pkg/…/execute.go• L29-106, pkg/…/execute.go• L136-206

The execution flow is asynchronous from the HTTP caller's point of view. Progress is written while collection runs, and the final result is written after execution completes or after a run-level error is captured. This lets the API report a running check without holding the request open. pkg/…/preflight.go• L113-161, pkg/…/execute.go• L42-105

The following diagram shows how a candidate version becomes a deployment decision and an operator result.

flowchart LR
    A[Candidate application version] --> B[Render preflight specification]
    B --> C[Collect cluster facts]
    C --> D[Analyze requirements]
    D --> E[Persist progress and result]
    E --> F[Gate install or upgrade]
    E --> G[Expose result to operator]
    E --> H[Report lifecycle event]

References: pkg/…/preflight.go• L113-161 pkg/…/execute.go• L29-206 pkg/…/preflight.go• L86-100

Deployment gating

The overall state is fail when a run has errors or a check fails. A warning is returned when no check fails but a warning or notice exists. Non-strict checks can be ignored for the deployment decision when the caller requests that policy. pkg/…/preflight.go• L250-275

For a first install, a passing result can trigger automatic deployment. For later versions, the update flow waits for pending preflight work and rejects a failed result before deployment. Strict analyzer failures remain separately available so the deployment path can enforce them even when non-strict warnings are allowed. pkg/…/preflight.go• L208-247, pkg/…/version.go• L195-232, pkg/…/updatechecker.go• L652-695

References: pkg/…/preflight.go• L208-247 pkg/…/preflight.go• L250-275 pkg/…/version.go• L195-232 pkg/…/updatechecker.go• L652-695

Result persistence

Managed downstream state

The standard path stores progress with the downstream version and stores the final JSON result with its creation time. Writing a result clears progress and returns the version to its normal pending state unless it is already deploying or deployed. The stored record also carries application and cluster identity, skipped state, and whether a strict check failed. pkg/…/preflight_store.go• L16-109, pkg/…/types.go• L9-27

The stored result joins the candidate version's preflight specification with the returned data. This allows later readers to determine whether strict checks existed and whether any of them failed, rather than relying only on the current in-memory execution. pkg/…/preflight_store.go• L142-206

Upgrade-service state

The upgrade service stores progress and the final result in one temporary JSON document. A new run removes the old document first. Completion clears progress and records the result, timestamp, application slug, cluster identity, and strict-failure flag. pkg/…/preflight.go• L21-35, pkg/…/preflight.go• L105-183, pkg/…/preflight.go• L186-190

References: pkg/…/preflight_store.go• L16-109 pkg/…/preflight_store.go• L142-206 pkg/…/preflight.go• L105-190 pkg/…/types.go• L9-27

API exposure

Managed validation API

The managed API starts a run and returns the current result and progress for an application sequence. It also supports a rerun after permission errors and exposes a command that prepares a rendered specification for an operator-led kubectl preflight run. The command path chooses the result upload endpoint for the caller's network location. pkg/…/preflight.go• L169-295

The evaluator posts operator-led results to a separate upload endpoint. That endpoint is intentionally unauthenticated because the kubectl preflight command calls it directly; the application and sequence in the path still identify where the result belongs. pkg/…/preflight.go• L297-346, pkg/…/handlers.go• L148-159, pkg/…/handlers.go• L383-385

Upgrade-service API

The upgrade service exposes a smaller run-and-read interface under its application route. A caller starts validation with POST /preflight/run, then reads progress and the result with GET /preflight/result. pkg/…/handlers.go• L26-43, pkg/…/preflight.go• L18-70

The operator upgrade status view keeps polling during temporary server errors and resumes upgrade status refresh after recovery. It treats an actual 401 response as session expiry rather than as a validation result. web/…/UpgradeStatusModal.test.tsx• L27-65

For the operator view of result states and payloads, see Preflight evaluation results.

References: pkg/…/preflight.go• L34-69 pkg/…/preflight.go• L169-346 pkg/…/handlers.go• L148-159 pkg/…/handlers.go• L383-385 pkg/…/handlers.go• L26-43 pkg/…/preflight.go• L18-70 web/…/UpgradeStatusModal.test.tsx• L27-65

Reporting

Preflight completion can produce a product report after the deployment state is known. Reporting waits for the relevant application status and result, then sends the sequence, install status, skip choice, preflight state, and application state when a license is available. This reporting path is separate from the result API and does not replace the stored operator result. pkg/…/preflight.go• L14-95, pkg/…/preflight_report.go• L12-39

References: pkg/…/preflight.go• L14-95 pkg/…/preflight_report.go• L12-39

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the shared result fields aligned with both the managed store response and the upgrade-service response.
  • Keep the pending-preflight status transition aligned with result writes and with the polling used by install and upgrade gates.
  • Keep the rendered upload URL aligned with the authenticated API route and the unauthenticated operator upload route.
  • Keep strict-check detection aligned with the deployment gate and with the stored HasFailingStrictPreflights value.
  • Keep permission-error handling aligned with the rerun path that sets the ignore-permissions choice.

Important failure modes

TriggerConsequenceGuard
Required application configuration is incompleteThe run does not start.Complete configuration before starting validation.
The release archive has no preflight specificationNo checks run and no new result is produced.Treat the release's preflight presence as a prerequisite for expecting a result.
Cluster collectors lack permissionAnalysis is skipped and the result contains RBAC errors.Grant the needed permissions or use the explicit ignore-and-rerun action.
A strict analyzer failsThe install or upgrade can remain blocked even when non-strict warnings are allowed.Resolve the failed requirement or make an intentional policy decision before rerun.
A preflight result is posted for the wrong application or sequenceThe result is associated with the wrong candidate version.Build the upload URL from the rendered candidate and preserve its sequence.
A run fails before it produces normal resultsThe failure is saved as an error result so the caller does not see a silent pass.Read the stored error result and retry after correcting the source failure.
The status endpoint returns a temporary server errorThe operator view can stop showing current upgrade progress if it treats the error as session expiry.Continue polling through temporary errors and log out only for 401.

Key files

FileWhy to read it
pkg/…/preflight.goMain managed lifecycle, state decisions, default checks, and deployment gate.
pkg/…/execute.goShared collection, analysis, progress, and error behavior.
pkg/…/types.goCommon result contract used by both execution paths and APIs.
pkg/…/preflight_store.goDurable progress and result behavior for managed downstreams.
pkg/…/preflight.goUpgrade-service lifecycle and local result state.
pkg/…/preflight.goManaged start, read, command, rerun, and upload API behavior.
pkg/…/preflight.goUpgrade-service start and read API behavior.
pkg/…/version.goStrict preflight enforcement during deployment.
pkg/…/updatechecker.goWaiting for preflight completion during version updates.
pkg/…/preflight.goReporting handoff after validation and deployment state settle.
web/…/UpgradeStatusModal.test.tsxOperator polling behavior during upgrade status API errors.