Skip to content

nodeup: stream verified image bytes into ctr import#18278

Merged
k8s-ci-robot merged 1 commit into
kubernetes:masterfrom
hakman:stream-container-images
May 6, 2026
Merged

nodeup: stream verified image bytes into ctr import#18278
k8s-ci-robot merged 1 commit into
kubernetes:masterfrom
hakman:stream-container-images

Conversation

@hakman

@hakman hakman commented May 6, 2026

Copy link
Copy Markdown
Member

Replace the download → ungzip-to-disk → reference-by-path flow with a single streaming pipeline: download to a hash-named cache file with inline hash verification, then re-open and stream (transparently gunzipping via magic-byte detection) straight into ctr images import over stdin. This avoids materializing an extracted tar on disk and prevents hash-mismatched bytes from ever reaching containerd's image store, since ctr atomically commits image references from the archive's manifest at import time.

fi.DownloadURL now streams through a MultiWriter hasher with atomic rename, and a new fi.OpenURL helper exposes the hardened HTTP GET stream that the image import path reuses.

  • Reject non-2xx HTTP responses
  • Wait for containerd readiness via TryAgainLaterError, bounded by a 5s probe
  • Skip the global download backoff for ctr-side failures
  • Detect gzip by magic bytes rather than file suffix
  • Key LoadImageTask by source filename and reject sources-less images at config load

Assisted by Claude Opus

/cc @ameukam @rifelpet

@k8s-ci-robot k8s-ci-robot requested review from ameukam and rifelpet May 6, 2026 06:50
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. area/nodeup labels May 6, 2026
@hakman hakman force-pushed the stream-container-images branch from 2dde5f0 to f349d34 Compare May 6, 2026 08:47
Replace the download → ungzip-to-disk → reference-by-path flow with a
single streaming pipeline: download to a hash-named cache file with
inline hash verification, then re-open and stream (transparently
gunzipping via magic-byte detection) straight into ctr images import
over stdin. This avoids materializing an extracted tar on disk and
prevents hash-mismatched bytes from ever reaching containerd's image
store, since ctr atomically commits image references from the
archive's manifest at import time.
fi.DownloadURL now streams through a MultiWriter hasher with atomic
rename, and a new fi.OpenURL helper exposes the hardened HTTP GET
stream that the image import path reuses.
- Reject non-2xx HTTP responses
- Wait for containerd readiness via TryAgainLaterError, bounded by a
  5s probe
- Skip the global download backoff for ctr-side failures
- Detect gzip by magic bytes rather than file suffix
- Key LoadImageTask by source filename and reject sources-less images
  at config load

Signed-off-by: Ciprian Hacman <ciprian@hakman.dev>
@hakman hakman force-pushed the stream-container-images branch from f349d34 to 30d83e0 Compare May 6, 2026 10:53
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 6, 2026
@ameukam

ameukam commented May 6, 2026

Copy link
Copy Markdown
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 6, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rifelpet

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 6, 2026
@k8s-ci-robot k8s-ci-robot merged commit 15b43e1 into kubernetes:master May 6, 2026
26 checks passed
@hakman hakman deleted the stream-container-images branch May 6, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/nodeup cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants