Image and air-gap artifacts
The image and air-gap artifact system moves container images and embedded-cluster files from release data to a registry that a cluster can reach. It finds image references, records access needs, rewrites names for the target registry, and supports both online copies and offline bundle uploads. Read Delivery integrations for the wider delivery model and GitOps synchronization for the related sync path.
Image dependency discovery
Image discovery builds one stable set of image references from rendered Kubernetes data. That set drives known-image records, privacy checks, registry copies, image rewrites, and pull-secret behavior during delivery.
The discovery path reads files below a directory, splits multi-document YAML, and asks each valid Kubernetes document for its images. Invalid YAML documents are skipped. The result is de-duplicated and sorted so later records and rewrites are repeatable. The midstream path combines these images with KOTS image data before it saves Installation.Spec.KnownImages.
Each known image has an IsPrivate value. Existing values are kept. New values are checked against the source registry. Air-gap mode and public-image proxy mode mark all images as private because the normal public pull path is not used.
Runtime image lookup also keeps the image used by a Kurl MinIO add-on. A default-namespace Kurl install can use the upstream RELEASE image from the running MinIO workload. Other cases use the bundled MinIO image. This keeps image selection aligned with the add-on already present in the cluster.
References: pkg/…/online.go• L44-143 pkg/…/online.go• L629-684 pkg/…/write.go• L87-107 pkg/…/minio.go• L14-67
Registry and Docker interactions
Registry handling separates the source registry, the optional replicated proxy, and the destination registry. This allows one image flow to support public images, private images, custom registries, and air-gap installs.
Private images are rewritten through the replicated proxy when no custom destination is set. A configured destination registry receives the rewritten image and its copied content. The source and destination use separate credentials. Docker Hub credentials can raise the request limit while the system checks image privacy or reads public images. ECR credentials are converted to the login form needed by the destination.
The copy path normalizes image references so each source uses either a tag or a digest. Digest-pinned images copy all architectures and preserve the digest. Tag-based copies use the selected image architecture. An optional existing-image check compares source and destination manifests in raw and canonical form. When they match, the copy is skipped. This supports safe re-pushes to registries that reject tag replacement.
The source registry can use insecure TLS only when KOTSADM_INSECURE_SRCREGISTRY=true. This is a development setting and does not provide a safe production transport. Image copy also retries transient failures in the air-gap upload path before it reports an error.
References: pkg/…/online.go• L145-260 pkg/…/online.go• L263-364 pkg/…/online.go• L367-455 pkg/…/online.go• L470-613 pkg/…/types.go• L15-61 pkg/…/registry.go• L62-107
Image name utilities
Image utilities keep image references consistent across Kubernetes rewrites, Docker archives, and registry destinations. They preserve whether an image uses a tag or a digest while changing the registry layout.
The main mappings are:
| Input or need | Result |
|---|---|
| Application image to a target registry | Target host and namespace plus the image name |
| Embedded-cluster image to a target registry | Target host and namespace plus the embedded-cluster area and image name |
| Docker archive path | A Kustomize image rewrite that changes the source registry and keeps the tag or digest |
| Docker Hub image matching | Equivalent forms such as redis, library/redis, and docker.io/library/redis |
| Image tag or repository cleanup | A Docker-valid tag or lower-case repository name |
The same destination rules must produce both the registry push name and the name rendered into Kubernetes objects. Embedded-cluster artifact paths use a separate repository and a tag built from channel, update cursor, and version information.
References: pkg/…/image.go• L17-131 pkg/…/image.go• L134-267 pkg/…/image.go• L269-387 pkg/…/rewrite.go• L18-119 pkg/…/fetch.go• L126-150
Air-gap bundle model
An air-gap bundle is a compressed tar package that carries release metadata, application files, image content, and optional embedded-cluster files. Its airgap.yaml metadata defines how image content is stored and which artifact paths belong to the release.
The bundle supports two image layouts:
| Format | Image source during upload | Main use |
|---|---|---|
docker | An extracted temporary Docker Registry rooted at images | Registry bundles that can include multi-architecture images |
docker-archive or empty | Individual Docker archive files below images | Legacy or single-architecture image packages |
The metadata also names embedded-cluster files such as the binary, charts, image archive, metadata, and additional files. The upload path selects only those named files. This keeps the OCI artifact content tied to the release contract rather than to every file in the bundle.
References: pkg/…/types.go• L3-10 scripts/create-airgap-file.go• L29-58 pkg/…/airgap.go• L149-207 pkg/…/airgap.go• L882-1004 pkg/…/kots.go• L1556-1605
Air-gap package flow
Air-gap processing first makes the application payload usable and then makes its images and embedded-cluster files available in the configured registry. Install and update use the same package model. Update also checks that the new release can follow the current embedded-cluster version.
The main flow is:
flowchart TD
A[Air-gap bundle] --> B[Read airgap.yaml]
B --> C[Extract release payload]
A --> D{Image format}
D -->|docker| E[Start temporary registry]
D -->|docker-archive| F[Read Docker archives]
E --> G[Push application images]
F --> G
A --> H[Select named embedded-cluster files]
H --> I[Pack OCI artifact]
I --> J[Push artifact to registry]
G --> K[Rewrite image references]
J --> L[Record artifact references]
K --> M[Create or update app version]
L --> M
For an install, the air-gap lifecycle marks the app as air-gapped, extracts the release, validates the license and channel, runs the pull flow with air-gap settings, and creates the first app version. For an update, it extracts the bundle, checks deployability against the current embedded-cluster version, loads the current base archive, and creates the next app version.
Bundle image pushes can run in parallel with embedded-cluster artifact pushes. Later rendering does not copy images again when the air-gap bundle has already supplied them. If no destination registry is given, the system records that it did not push images. The cluster must then use a local registry path or images that already exist.
References: pkg/…/airgap.go• L33-53 pkg/…/airgap.go• L92-123 pkg/…/airgap.go• L198-230 pkg/…/update.go• L56-219 pkg/…/pull.go• L237-281 pkg/…/pull.go• L384-395 pkg/…/pull.go• L550-559 pkg/…/airgap.go• L122-207
Image archive handling
Archive helpers provide bounded access to compressed tar content without requiring every caller to unpack the full bundle. They extract named files, filter a bundle to selected files, inspect directories, and reject paths that escape the destination directory.
Docker archive inspection reads manifest.json to find image layers and their sizes. Registry-format bundles are read through a temporary registry and can include all architectures. Docker-archive uploads are single-image copies and do not support multi-architecture content. Layer data feeds progress reporting rather than changing image content.
Air-gap image uploads report queued, uploading, uploaded, and failed states. They can also report current and total layer counts. Docker archives are extracted to temporary files as they are read. The upload path limits concurrent blob copies and removes temporary files after each push.
References: pkg/…/archives.go• L17-197 pkg/…/airgap.go• L13-95 pkg/…/docker_archive.go• L17-80 pkg/…/airgap.go• L317-429 pkg/…/airgap.go• L432-703 pkg/…/airgap.go• L745-879 pkg/…/types.go• L40-102
Embedded-cluster artifact flow
Embedded-cluster files travel as OCI artifacts rather than Docker images. The bundle consumer selects the required files, gives each file a media type, packs them into an OCI manifest, and pushes that manifest to a registry repository derived from the artifact name and release identity.
The registry path uses the embedded-cluster repository area. Its tag joins the channel ID, update cursor, and version label, then applies Docker tag rules. The upload tries HTTPS first and then plain HTTP. The KOTS binary and embedded-cluster version can be read back from the bundle for an update process that runs the bundled binary.
References: pkg/…/airgap.go• L882-1065 pkg/…/types.go• L104-125 pkg/…/image.go• L351-386 pkg/…/fetch.go• L126-150 pkg/…/kots.go• L1753-1819 cmd/…/airgap-update.go• L170-195
Imagedeps command surface
cmd/imagedeps is a release-maintenance command that turns a small image specification into pinned image references used by the repository. It does not discover application images at runtime. It updates fixed third-party images used to build and run the Admin Console.
Run it from the repository root:
go run ./cmd/imagedeps
Each line in cmd/imagedeps/image-spec gives a short image key, an untagged source reference, and an optional regular expression. The command reads tags from a Docker Registry HTTP API. It normally selects the highest matching semantic version. MinIO tags use a date-aware numeric comparison. Some image projects resolve through GitHub release history instead.
On success, generation updates the fully qualified constants in pkg/…/constants.go, image tag variables in .image.env, and matching Makefile variables. The scheduled dependency workflow runs the command with a GitHub token and opens an automated pull request when values change. Invalid specification lines, unknown keys, invalid filters, and lookups with no matching version stop generation instead of producing partial output.
The generated constants currently pin MinIO, rqlite, Dex, SchemaHero, and the local volume provider. They are generated outputs. Change the image specification or lookup source rather than editing pkg/…/constants.go by hand.
References: cmd/…/README.md• L1-51 cmd/…/main.go• L17-25 cmd/…/main.go• L69-124 cmd/…/tag-finder.go• L19-62 cmd/…/tag-finder.go• L84-155 cmd/…/tag-finder.go• L174-322 cmd/…/image-spec• L1-5 pkg/…/constants.go• L1-13 .github/…/image-deps-updater.yaml• L1-87
Change checklist
When these files or sections are changed, remember to consider these:
- Keep airgap.yaml image format values aligned with bundle creation and both image readers. A format mismatch can leave images in the bundle without a matching upload path.
- Keep
EmbeddedClusterArtifactspaths aligned with artifact selection, OCI path generation, release fetch, and update package filtering. A path change can make a file present but unreachable. - Keep destination image naming aligned with Kustomize rewrite names and registry push destinations. A change on one side can leave Kubernetes objects pointing to an old name.
- Keep
Installation.Spec.KnownImagesprivacy data aligned with private-image rewriting and source authentication. Missing data can change the pull route for a protected image. - Keep
SkipExistingImagesbehavior aligned across command options, image copy options, and registry expectations. A disabled precheck can make a re-push fail on an immutable tag. - Keep
cmd/imagedeps/image-speckeys aligned with generated constants, environment names, and Makefile replacement patterns. A key change can leave one build input on an old tag.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| Bundle has no usable airgap.yaml or application payload | The release cannot select its image format or be extracted | Validate bundle metadata before install, update, or image push |
| Bundle format does not match its image layout | Image content is read by the wrong loader or skipped | Use docker for registry layouts and docker-archive for archive files |
| Destination registry is unreachable or credentials are wrong | Image or artifact upload fails and rewritten references may not start | Check registry settings and credentials before deployment |
| Existing-image checks are not enabled for an immutable destination tag | A repeat push can fail even when the destination already has the same image | Enable SkipExistingImages for idempotent re-pushes |
| Source registry cannot be reached during privacy detection | The image is treated as private and routed through protected access | Allow the source or proxy endpoint and provide required credentials |
| Required embedded-cluster metadata or artifact is missing | OCI upload or bundled KOTS update cannot proceed | Include all paths named by EmbeddedClusterArtifacts |
Kurl MinIO image has no supported upstream RELEASE tag | Runtime image lookup cannot select the existing add-on image | Keep the add-on image in the supported release-tag form or use the bundled image |
| Image-spec filter matches no valid tag | imagedeps stops without a reliable generated dependency | Use a valid registry or release filter and review the generated diff |
Key files
| File | Why to read it |
|---|---|
| pkg/…/online.go | Image discovery, privacy classification, online copy, manifest checks, and source rewriting |
| pkg/…/airgap.go | Air-gap image readers, uploads, OCI artifact pushes, and progress reporting |
| pkg/…/types.go | Contracts for image processing, copy behavior, idempotency, progress, and OCI artifacts |
| pkg/…/minio.go | Runtime selection of the MinIO image used by a Kurl installation |
| pkg/…/image.go | Shared rules for image parsing, destination paths, rewrites, aliases, and artifact tags |
| pkg/…/base.go | Image discovery across rendered Kubernetes bases |
| pkg/…/rewrite.go | Registry and replicated-proxy rewrite policy |
| pkg/…/write.go | Point where discovered images become known images, copied images, and rewritten objects |
| pkg/…/archives.go | Compressed-tar access and safe extraction behavior |
| pkg/…/airgap.go | Air-gap metadata extraction and filtered update bundle creation |
| pkg/…/docker_archive.go | Docker archive manifest and layer inspection |
| pkg/…/temp_registry.go | Temporary registry used to read registry-format bundle images |
| pkg/…/registry.go | Registry and proxy endpoint selection plus registry credentials |
| pkg/…/airgap.go | Initial air-gap install lifecycle |
| pkg/…/update.go | Air-gap update lifecycle and deployability checks |
| cmd/…/airgap-update.go | CLI path for pushing an update bundle and its selected artifacts |
| cmd/…/main.go and cmd/…/tag-finder.go | Image dependency generation and tag lookup rules |
cmd/imagedeps/image-spec and pkg/…/constants.go | Current third-party image inputs and generated pinned values |