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 / upstream-release-acquisition

Upstream release acquisition

Upstream release acquisition obtains application content from a release source and turns it into a stable upstream archive for the delivery lifecycle. It discovers releases, keeps release identity and user state, prepares chart inputs, and writes the content that later rendering and deployment stages consume. See Application delivery lifecycle for the end-to-end view and Application rendering and deployment for the next stage.

Acquisition boundary

The acquisition boundary accepts a source reference and the context that selects a release. It returns an upstream model with files and release metadata. It then persists that model under the application workspace so later stages do not need to contact the source again.

The main source type is the replicated protocol. A local path can also supply release files for local or air-gapped work. Other URL schemes are not accepted by the acquisition path.

Source references

The source reference identifies an application and can identify a channel or exact version. A URI with user information treats the user name as the application slug and the host as a version label. A URI without user information treats the host as the application slug and the path as the channel.

The pull boundary normalizes a bare application value to a replicated:// URI. This gives command and API callers one common form before release selection starts.

References: pkg/…/fetch.go• L15-68 pkg/…/upstream.go• L17-42 pkg/…/upstream.go• L9-14

Release identity

Release identity combines the application, channel, cursor, version label, and release policy. The cursor marks the position in a channel. The version label gives the human-facing release name. Required status, release notes, release time, registry domains, chart names, and embedded-cluster artifact references travel with the release.

The stored Installation record carries this identity into the next pull. An update normally starts from its current channel and cursor. An air-gap record can replace those values with the channel and cursor in the package. A selected version label applies only to an initial install. Later updates use the current release position.

References: pkg/…/types.go• L25-55 pkg/…/fetch.go• L85-151 pkg/…/write.go• L117-169

Release discovery

Release discovery separates “what is available?” from “give me this release.” An update check asks the upstream service for channel releases after the current cursor. A fetch then requests the selected release and reads its content and identity from the response.

The discovery and fetch flow is shown below.

sequenceDiagram
    participant Caller
    participant Pull as Pull boundary
    participant Service as Upstream service
    participant Workspace

    Caller->>Pull: source URI and current context
    Pull->>Service: list releases after cursor
    Service-->>Pull: release metadata and update time
    Pull->>Service: request selected release
    Service-->>Pull: archive and release headers
    Pull->>Workspace: write upstream files and Installation

Update checks

An update check uses the current channel cursor and an optional last-check time. If the channel changes, the cursor is cleared so discovery starts from the new channel. The result exposes available releases with sequence, version label, required status, notes, release time, and embedded-cluster version.

A license is required for licensed release discovery. The license selects the service endpoint and supplies the application identity used by the request. The caller context is attached to the request, so a deadline or cancellation can stop a stalled upstream connection.

References: pkg/…/peek.go• L11-24 pkg/…/replicated.go• L75-114 pkg/…/replicated.go• L481-561 pkg/…/replicated_test.go• L877-920

Release requests

The fetch request uses the license endpoint and application identity. It sends the channel cursor, selected channel, and the release context needed by the service. The upstream service returns the archive body and release identity in response headers.

The response is accepted only when it is successful and contains a readable compressed archive. Each regular file becomes part of the upstream model. Directory entries are skipped, and chart archives remain unchanged because they are binary content. Plain troubleshoot.sh/v1beta3 documents are retained in the release rather than filtered at this boundary.

References: pkg/…/upstream.go• L45-76 pkg/…/replicated.go• L368-478 pkg/…/replicated_test.go• L590-877

Identity and repository context

Acquisition keeps application identity and repository context with the release because downstream chart and manifest work depends on both. The application identity comes from the release content or a safe default. The license is refreshed when the service provides a newer copy. Existing configuration and identity values are carried forward so a release update does not reset operator state.

Application and license identity

The application manifest is the primary source of the application name. If no application manifest exists, acquisition creates a default application identity so the release still has a usable name. A current license is included in upstream user data when one is available.

For licensed sources, the latest license is fetched after the release request. This lets the resulting release use current channel and entitlement data. License verification occurs before the fetch context is trusted.

References: pkg/…/replicated.go• L177-225 pkg/…/replicated.go• L227-318 pkg/…/api.go• L44-63

Repository context

Repository context links chart content to the source registry and chart names supplied by the release. Known repository names map to chart repository endpoints for Helm-related processing. Air-gap mode does not use custom online registry or proxy domains. It derives local artifact paths from air-gap metadata and local registry settings.

The repository context is not a separate release. It is release metadata that lets chart preparation and later rendering resolve the same application content in online and air-gapped environments.

References: pkg/…/repos.go• L3-9 pkg/…/fetch.go• L71-151 pkg/…/types.go• L25-45

Preserved user state

Existing configuration values and identity configuration are inputs to a new release. Acquisition merges the release configuration definition with existing values, then places the result in user data. If the release removes a configuration item, its prior value can still carry into the new version.

The prior installation also supplies the encryption key and current release identity. The writer preserves the prior channel when the update comes from a local settings change instead of an upstream release change.

References: pkg/…/replicated.go• L227-287 pkg/…/write.go• L37-70 pkg/…/write.go• L117-145

Release context selection

Release context selection chooses the values that describe the requested release before the source is contacted. Online acquisition uses the current installation context. Air-gap metadata takes precedence for the channel, cursor, version label, required state, chart names, and embedded-cluster artifacts.

The selection rules keep an initial install, an update, and an air-gap update on the same release model:

  • An initial install can request a specific version label.
  • An update uses the current version label and cursor unless air-gap metadata supplies replacements.
  • Air-gap registry and proxy domains are not copied from the online installation.
  • Air-gap embedded-cluster artifact names are rebuilt for the local registry and package identity.

References: pkg/…/fetch.go• L71-151 pkg/…/types.go• L96-126

File materialization

File materialization converts the release archive into named upstream files and writes them into a clean workspace. The workspace is the hand-off point between acquisition and rendering. It contains source files plus generated user data and, when requested, generated Admin Console content.

The materialization flow is shown below.

flowchart LR
    A[Release archive] --> B[Read regular files]
    B --> C[Normalize archive paths]
    C --> D[Preserve configuration and identity state]
    D --> E[Apply file protection and chart inputs]
    E --> F[Write upstream workspace]
    F --> G[Installation release record]

Archive files

Release files are represented as path and content pairs. Common archive prefixes are removed so application files have stable paths. User data files remain under userdata and are added back after path normalization.

Before writing, the previous upstream directory is removed. The writer creates parent directories and writes each file. It also records release identity in userdata/installation.yaml, which becomes the durable input for later updates.

References: pkg/…/replicated.go• L864-920 pkg/…/write.go• L20-35 pkg/…/write.go• L37-53 pkg/…/write.go• L72-115 pkg/…/write.go• L154-169

Protected user data

Configuration values and identity secrets are protected when acquisition receives unencrypted initial input. Existing installation data supplies the encryption key for later writes. The goal is to keep secrets in persisted upstream state without exposing the original plain text form.

This protection applies while files are materialized. It does not replace the later render stage, which uses the resulting user data to build application resources.

References: pkg/…/write.go• L66-101 pkg/…/write.go• L174-215 pkg/…/pull.go• L190-211

Generated platform content

The upstream workspace can include platform content that is not part of the application release. Admin Console files are generated from the current cluster and storage context. Existing Admin Console settings are read first so an update can retain platform credentials and tokens.

This content supports the platform around the application. It is included for replicated sources unless the caller excludes it.

References: pkg/…/pull.go• L299-325 pkg/…/admin-console.go• L45-100 pkg/…/admin-console.go• L102-215

Helm chart interactions

Helm chart interaction prepares packaged charts for the environment in which the application will run. Acquisition identifies the Replicated chart in a chart archive, adds platform context to its values, and repackages the chart without changing unrelated chart files.

Chart selection

The release supplies the chart names that carry Replicated integration. Acquisition checks the top-level chart and its direct subcharts. It does not configure deeper subcharts. When a parent chart gives a direct subchart an alias, that alias becomes the values key that Helm uses.

This matters because the same chart can appear as a top-level chart or as a direct dependency. The values must be placed at the location that Helm uses for that chart shape.

References: pkg/…/helm.go• L24-62 pkg/…/helm.go• L64-169 pkg/…/helm_test.go• L1270-1457

Chart values

The chart receives platform values such as application and Admin Console identifiers, air-gap mode, private certificate configuration, proxy settings, and embedded-cluster role context. Air-gap installs also receive license data because the later air-gap environment does not have live license context.

The original license payload is kept when it is available. If it is not available, acquisition serializes the current license before placing it in chart values. This keeps license fields that a newer upstream schema may contain.

Global values carry license and registry information when air-gap mode requires it. Existing YAML structure is merged instead of replaced, so application chart values remain available to the render stage.

References: pkg/…/helm.go• L262-386 pkg/…/helm.go• L389-515 pkg/…/helm_test.go• L1537-1561

Chart archive output

A chart is unpacked only long enough to update its values file. The updated files are packaged again as a compressed chart archive and returned as the file content for the upstream workspace.

The chart path is treated as archive data rather than as a trusted file system path. Invalid archive paths stop chart preparation instead of writing outside the temporary workspace.

References: pkg/…/helm.go• L171-260 pkg/…/helm.go• L517-573

Upgrade inputs

Upgrade inputs connect release discovery to a requested application update. They include selected release metadata, the current application version, cluster and registry state, preflight policy, and optional air-gap content. The update service uses these inputs to download a new version or retry a pending one.

Online upgrade inputs

The online path checks for releases through the Admin Console and reports the current release, available releases, and any release being deployed. A deploy request can ask for the latest available release or for a version label. Without a deploy request, the release is downloaded for a later operator action.

The CLI obtains an authenticated connection to the Admin Console and passes deploy, wait, preflight, compatibility, and registry choices to the upgrade service. This keeps release acquisition in the service while the CLI remains a request surface.

References: pkg/…/upgrade.go• L23-49 pkg/…/upgrade.go• L51-197 cmd/…/upstream-upgrade.go• L20-170

Air-gap upgrade inputs

An air-gap update supplies a bundle with release metadata and application content. Images can be pushed to the target registry before the bundle is uploaded. The application archive is extracted locally. Its air-gap metadata selects the channel, cursor, version label, registry paths, and embedded-cluster artifacts used for the fetch.

The bundle must match the license and selected channel. The upload is sent as a multipart request containing the metadata and application archive. This preserves the online release model while replacing network content with packaged content.

References: pkg/…/upgrade.go• L57-81 pkg/…/upgrade.go• L200-254 pkg/…/pull.go• L237-281 pkg/…/fetch.go• L104-151

Retry and pending downloads

When a release cannot be downloaded before a local version exists, the system records it as a pending download. A retry identifies the application version by sequence and asks the Admin Console to run acquisition again. The retry can change preflight, compatibility, or wait behavior without changing release identity.

After a successful fetch, the version is created or updated in application state. If the release is compatible and ready for the next stage, preflight checks can run before deployment takes over.

References: cmd/…/upstream-download.go• L20-174 pkg/…/upstream.go• L28-123 pkg/…/upstream.go• L125-297

Change checklist

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

  • Update the URI rules and release-selection inputs together if the source format changes. The parser, fetch context, metadata lookup, and update request must agree on application, channel, and version meaning.
  • Keep Installation release fields aligned with upstream response headers and air-gap metadata. A mismatch can make the next update start from the wrong channel or cursor.
  • Preserve the user-data hand-off when changing configuration, identity, or encryption behavior. The pull path reads these files before fetch and the writer recreates them after fetch.
  • Keep chart-name and chart-alias handling aligned with the values layout expected by Helm. A valid archive can still fail later if integration values use the wrong key.
  • Keep online and air-gap inputs equivalent where possible. Air-gap metadata must provide the context that online response headers normally provide.
  • Preserve the original license payload when chart values must carry license data. Rebuilding it from a local type can drop fields that the local schema does not know.
  • Keep pending-download sequence handling aligned with application version state. A retry must update the intended version rather than create a new one.
  • Keep update-check requests bound to their caller context. A change that drops context propagation can make a stalled upstream connection ignore cancellation.
  • Keep archive intake limited to regular files and leave binary chart archives intact. Filtering or skipping the wrong file type can remove required application content.

Important failure modes

TriggerConsequenceGuard
Missing or invalid license for a licensed sourceRelease discovery or fetch stops before application content is obtainedRequire and verify the license before the request
Channel or cursor does not match the intended releaseThe system can report the wrong updates or repeat an old releaseCarry channel ID, channel name, and cursor together in Installation and air-gap metadata
Requested initial version label differs from the source labelThe install is rejected rather than silently installing another versionCompare the requested label with the parsed upstream label
Release archive contains unsupported or malformed contentThe release can fail during archive reading or later document processingAccept only readable gzip and tar data and preserve regular files for downstream validation
Upstream update check stalls after its caller deadlineRelease discovery can hang instead of returning control to the callerBind the HTTP request to the caller context and test deadline cancellation
Compressed release data is invalid or interruptedThe release cannot be converted into application filesRequire valid gzip and tar streams and report archive read errors
Existing installation encryption key is lostPreviously protected user data may become unreadableReuse the key from the prior Installation record
Air-gap bundle app or channel does not match the licenseContent from the wrong application can be uploadedValidate the bundle signature and channel before extraction proceeds
Chart archive has an unsafe path or an unreadable values fileChart preparation fails before a modified archive is returnedValidate archive paths and require readable top-level chart values
Replicated chart is nested below a direct subchart or has no matching declared namePlatform values are not added to the chart that consumes themLimit selection to supported chart levels and keep release chart names aligned with chart metadata

Key files

FileWhy to read it
pkg/…/pull.goShows how caller state becomes fetch and write inputs and how acquisition joins the wider pull flow.
pkg/…/fetch.goDefines source dispatch and the rules that choose online, current-release, and air-gap context.
pkg/…/replicated.goExplains release discovery, archive intake, release identity, preserved user data, document handling, and file normalization.
pkg/…/peek.goShows how update checks select the supported upstream protocol before release discovery.
pkg/…/replicated_test.goShows the behavioral guarantees for archive intake, release identity, error handling, and cancellation of stalled checks.
pkg/…/types.goDefines the upstream release model and the fetch/write context passed across the boundary.
pkg/…/write.goShows the hand-off from an upstream model to persisted files and the durable Installation identity.
pkg/…/helm.goExplains how packaged Helm charts receive platform and air-gap context before rendering.
pkg/…/helm_test.goShows the chart-shape and license-payload guarantees that protect Helm value placement.
pkg/…/upstream.goDefines the source URI meaning and the request identity used with the upstream service.
pkg/…/api.goShows current-license and application-metadata acquisition for licensed sources.
pkg/…/upstream.goShows how an acquired update becomes a pending or stored application version.
cmd/…/upstream-upgrade.goDescribes the operator-facing upgrade inputs and the Admin Console request boundary.