Skip to content

Add native airgap bundle support#1080

Open
kke wants to merge 11 commits into
mainfrom
airgap-mvp
Open

Add native airgap bundle support#1080
kke wants to merge 11 commits into
mainfrom
airgap-mvp

Conversation

@kke

@kke kke commented May 7, 2026

Copy link
Copy Markdown
Contributor

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 /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

@kke kke added the enhancement New feature or request label May 7, 2026
@kke kke requested a review from Copilot May 7, 2026 10:01

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.airgap API (defaults/validation/path resolution) and documents usage in README.
  • Adds an airgap package for resolving official/custom bundle artifacts, caching downloads, and checksum verification helpers.
  • Adds a new AirgapBundles phase and wires it into apply with 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.

Comment thread phase/airgap_bundles.go
Comment thread action/apply.go Outdated
Comment thread action/apply_test.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Comment thread pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/airgap.go Outdated
Comment thread pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/airgap.go
Comment thread phase/airgap_bundles.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Comment thread pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/k0s.go
Comment thread pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/airgap.go
Comment thread pkg/airgap/airgap.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Comment thread pkg/airgap/airgap.go
Comment thread pkg/airgap/airgap.go Outdated
Comment thread pkg/airgap/airgap.go
Comment thread pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/k0s.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Comment thread action/apply_test.go Outdated
Comment thread pkg/airgap/airgap.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Comment thread pkg/airgap/airgap.go
Comment thread phase/airgap_bundles.go
Comment thread pkg/apis/k0sctl.k0sproject.io/v1beta1/cluster/k0s.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Comment thread pkg/airgap/airgap.go Outdated
Comment thread pkg/airgap/airgap.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Comment thread phase/airgap_bundles.go
Comment thread pkg/airgap/airgap_test.go Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 3 comments.

Comment thread phase/airgap_bundles.go
Comment thread phase/airgap_bundles.go Outdated
Comment thread pkg/airgap/airgap.go
@kke kke requested a review from Copilot May 8, 2026 13:36
@kke kke marked this pull request as ready for review May 8, 2026 13:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 5 comments.

Comment thread internal/download/download.go
Comment thread internal/download/download.go Outdated
Comment thread pkg/airgap/airgap.go
Comment thread pkg/airgap/airgap.go Outdated
Comment thread phase/airgap_bundles.go

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.

Comment thread internal/download/download.go Outdated
Comment thread action/apply.go
kke added 10 commits May 8, 2026 17:04
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>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.

Comment thread internal/download/download.go
Signed-off-by: Kimmo Lehto <klehto@mirantis.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 14 out of 14 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants