Add native airgap bundle support#1080
Open
kke wants to merge 11 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class configuration and execution support for k0s airgap bundles via spec.k0s.airgap, including schema/defaulting/validation, artifact resolution & caching, and a new apply phase to upload bundles to worker-capable Linux hosts.
Changes:
- Introduces
spec.k0s.airgapAPI (defaults/validation/path resolution) and documents usage in README. - Adds an
airgappackage for resolving official/custom bundle artifacts, caching downloads, and checksum verification helpers. - Adds a new
AirgapBundlesphase and wires it intoapplywith basic ordering tests.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Documents spec.k0s.airgap configuration, supported sources/modes, and behavior. |
| pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/spec.go | Treats enabled airgap config as “non-empty k0s” and resolves airgap paths relative to baseDir. |
| pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/k0s.go | Adds K0s.Airgap, defaulting hook, and validation wiring. |
| pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/k0s_test.go | Adds tests for airgap defaulting and validation constraints. |
| pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/airgap.go | New API type/constants + defaulting/validation/path resolution for airgap config. |
| pkg/airgap/airgap.go | New artifact resolution, URL template expansion, XDG caching, download, and SHA-256 verification helpers. |
| pkg/airgap/airgap_test.go | Unit tests for resolver behavior, planning, cache path, checksum verification, and local path resolution. |
| phase/airgap_bundles.go | New phase to plan/cache/upload bundles to <data-dir>/images on worker-capable Linux hosts. |
| phase/airgap_bundles_test.go | Tests for planning, dry-run output, version requirement, and download de-duplication. |
| action/apply.go | Inserts AirgapBundles into the apply pipeline. |
| action/apply_test.go | Adds ordering assertions for the new phase relative to worker phases. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Add native handling for k0s airgap bundles under spec.k0s.airgap so users do not need to model the official bundle upload manually with spec.hosts[*].files. This MVP adds: - schema, defaults, and validation for enabled, source, mode, path, url, and sha256 - support for source: auto, source: local, and source: url in upload mode - official release bundle resolution from spec.k0s.version - local XDG cache storage and per-platform download deduplication - SHA-256 validation for local and custom URL sources - Linux worker-capable host planning for worker, controller+worker, and single roles - upload of bundles to <data-dir>/images before worker install or upgrade work - dry-run output that reports per-host artifact and destination plans - README documentation for native airgap usage and the remaining files: escape hatch Planned follow-up PRs: - add smoke coverage with local fake or cached bundles, likely after improving smoke-test fixtures - support mode: remoteDownload for mirror-backed environments - support sha256File for release and mirror workflows - add destinationDir and upload-only validation controls for advanced deployments - add cleanup policy for bundles previously placed by k0sctl without deleting arbitrary image files - add per-host airgap overrides once a concrete use case exists - support extra addon/workload bundles while keeping the official k0s bundle as the default path Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add native handling for k0s airgap bundles under spec.k0s.airgap so users do not need to model the official bundle upload manually with spec.hosts[*].files.
This MVP adds:
Planned follow-up PRs: