Refactor offline image management to use skopeo and OCI archives#13312
Refactor offline image management to use skopeo and OCI archives#13312Kibakus wants to merge 2 commits into
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Kibakus The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @Kibakus. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
0fab5ca to
57238cb
Compare
57238cb to
6c2763f
Compare
|
/ok-to-test |
|
https://gitlab.com/kargo-ci/kubernetes-sigs-kubespray/-/jobs/14898252406 Uploading cache.zip to http://minio.minio.svc.cluster.local:9000/runner-cache/project/9659330/pre-commit-2-4-protected |
|
The failing CI jobs appear unrelated to this change. Waiting for review. |
| echo " create - download files and nginx image" | ||
| echo " serve - start nginx server" | ||
| ;; | ||
| esac No newline at end of file |
There was a problem hiding this comment.
HI @Kibakus
Thanks for checking. The MinIO 503 happened after the job had already failed. The actual failure is end-of-file-fixer: it added missing trailing newlines to the two offline scripts.
Could you please run pre-commit run --all-files locally and push the fix?
There was a problem hiding this comment.
Pull request overview
This PR refactors the contrib/offline tooling to improve offline portability and multi-arch image handling by switching image transfer logic to skopeo with OCI artifacts, and simplifying local registry / nginx configuration.
Changes:
- Switch offline container image collection/registration to
skopeo copywithoci-archiveto preserve manifest lists and platform metadata. - Add basic OS/arch detection and use
localhost:5000for local registry configuration. - Harden scripts with
set -euo pipefailand simplify nginx configuration by removing default includes.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| contrib/offline/registries.conf | Update insecure registry entry to localhost:5000. |
| contrib/offline/nginx.conf | Remove includes that could unintentionally load extra server blocks. |
| contrib/offline/manage-offline-files.sh | Refactor into create/serve modes; add skopeo-based nginx image handling and stricter bash settings. |
| contrib/offline/manage-offline-container-images.sh | Replace runtime pull/save/push flow with skopeo OCI archive workflow; add platform detection and stricter bash settings. |
| contrib/offline/docker-daemon.json | Update insecure registry entry to localhost:5000. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Kibakus The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
73983f8 to
3406420
Compare
|
Hi @yankay @ErikJiang , just a gentle ping on this when you have a chance. |
|
Hi @yankay, I wanted to follow up on this PR. It's been waiting for about a week now. The Kubespray CI Pipeline check is still showing "Waiting for status to be reported", while the other checks have already completed. Is there anything I should do on my side to trigger it again, or is this something that needs attention from a maintainer? |
|
HI @Kibakus Thanks for following up, and thanks for the work on this PR. I think we should discuss the compatibility impact before moving forward. This PR introduces a fairly large refactor of the offline workflow, and one breaking change is switching the image handling path from the existing container runtimes ( That means users would need to install
Docker can have similar installation concerns, but it is much more widely used and users generally have more existing experience installing and operating it. So my main concern is that this is a big user-facing change: target machines may not have |
| TARGET_OS="linux" | ||
|
|
||
| echo "[INFO] Downloading nginx:alpine image" | ||
| if command -v skopeo &>/dev/null 2>&1; then |
There was a problem hiding this comment.
nit: The nginx:alpine image is downloaded during create , but only used in serve .
For users who only need offline files without running an nginx server, this adds unnecessary download and package bloat.
Suggest moving the nginx image download into serve_offline_files() where it actually belongs.
|
@yankay Check pls, good? |
|
@yankay |
1 similar comment
|
@yankay |
|
@Kibakus good job ! /lgtm |
|
Quick question: do you think I should go through the new Copilot recommendations? As far as I remember, I already addressed the earlier comments, and the PR has already received |
|
@ErikJiang, @yankay |
|
HI @Kibakus The main blocker is that the shared registry config change can break the existing offline workflow. There is also an offline correctness issue with the skopeo-created docker archives. Both A few smaller things:
Once the two blockers are fixed, this should be much closer. I also think the High and Medium findings from the Copilot review are worth checking before approval, especially the legacy workflow regression and the README/script behavior mismatch. |
|
New changes are detected. LGTM label has been removed. |
…lity - Replace docker/podman/nerdctl with skopeo for image operations (OCI format) - Add architecture detection (amd64/arm64) for cross-platform support - Use localhost instead of hostname for local registry - Improve error handling with set -euo pipefail - Simplify nginx.conf and config files - Introduce optional nginx download via DOWNLOAD_NGINX variable Add new scripts: - manage-offline-skopeo-files.sh: alternative to manage-offline-files.sh using skopeo - manage-offline-skopeo-container-images.sh: alternative to manage-offline-container-images.sh
|
@yankay Blocker 1 - Legacy workflow regression (
|
…rify, wget layout, container state - Fix registry container port mapping (host:5000) in skopeo container images script - Add SRC_TLS_VERIFY env var for skopeo TLS verification control - Fix wget -nH to -x in skopeo files script to preserve URL directory structure - Fail on wget download errors instead of masking them - Fix container state check in serve subcommand (detect stopped containers) - Update README to reflect optional skopeo requirement and separate create/serve steps
|
@yankay |
2 similar comments
|
@yankay |
|
@yankay |
/kind feature
What this PR does / why we need it:
This PR refactors the offline image and file management scripts to improve portability, reliability, and cross-platform support.
Main changes include:
docker/podman/nerdctlimage operations withskopeoand OCI archives to preserve image metadata and manifest lists during offline transfers.amd64/arm64) and Linux platform selection to improve cross-platform compatibility.localhostinstead of the system hostname when configuring and accessing the local registry.set -euo pipefail.nginx.confand related configuration files used by the offline file server.The previous offline image workflow relied on
docker saveanddocker load, which do not preserve OCI manifest lists and platform descriptors associated with multi-architecture images. As a result, some images could not be pushed to the destination registry after being transferred through the offline workflow.Using OCI archives with
skopeopreserves manifest lists and platform metadata throughout the transfer process, allowing both single-platform and multi-platform images to be transferred and registered consistently.In addition, the previous nginx configuration loaded default server definitions from the container image through
conf.danddefault.dinclude directives. Depending on the image contents, this could result in multiple server blocks being loaded simultaneously, causing unexpected behavior and configuration conflicts. The configuration has been simplified to ensure that only the intended offline file server configuration is used.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
During validation, issues were observed with Kubernetes images distributed as OCI manifest lists.
With the previous implementation, the following scenario could be reproduced:
The issue occurs because
docker save/docker loadlose the OCI manifest list information required to determine which platform-specific manifest should be pushed to the destination registry.The OCI-based workflow implemented in this PR preserves manifest lists and platform metadata, eliminating these failures and providing consistent behavior across supported environments.
The changes were validated using both single-platform images and multi-architecture images represented by OCI manifest lists.
Does this PR introduce a user-facing change?: