Refactor image management to use transfer service#4583
Conversation
285c273 to
156a92a
Compare
b5584fe to
18b0448
Compare
a49ea0a to
f66db0d
Compare
|
Thanks @ChengyuZhu6
2 in the long term, 1 in the short term |
d36732a to
c5552d0
Compare
c5552d0 to
95e03e0
Compare
f2e210d to
d3b9cab
Compare
Switch image operations to the transfer API with structured progress reporting and improved TLS/HTTP fallback behavior. Introduce shared helpers for credentials, error classification, progress rendering, and transfer-based import/tag/save flows, updating tests to reflect the new UX. Signed-off-by: ChengyuZhu6 <hudson@cyzhu.com>
d099f97 to
3341fbd
Compare
| enable_remote_snapshot_annotations = "true" | ||
| [[plugins."io.containerd.transfer.v1.local".unpack_config]] | ||
| platform = "linux" | ||
| snapshotter = "overlayfs" |
There was a problem hiding this comment.
What happens if this config is not specified?
i.e., what happens with the default config?
There was a problem hiding this comment.
By default, it would be
[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux/amd64"(matches the host's OS/Architecture)
snapshotter = "overlayfs"
differ = "walking"
| "github.com/containerd/containerd/v2/pkg/progress" | ||
| ) | ||
|
|
||
| // From https://github.com/containerd/containerd/blob/v2.2.0-rc.0/cmd/ctr/commands/image/pull.go#L240-L473 |
There was a problem hiding this comment.
Can't we import the package from containerd/containerd to reduce code clones?
There was a problem hiding this comment.
The progress handling code is in cmd/ctr/commands/images, not in pkg/ or core/, so it cannot be imported directly.
And I removed displayName() function that splits names by '-':
func displayName(name string) string {
parts := strings.Split(name, "-")
for i := range parts {
parts[i] = shortenName(parts[i])
}
return strings.Join(parts, " ")
}
which would break display for image names containing - (e.g., ubuntu-base )
| } | ||
|
|
||
| // SupportsFullTransferService checks if the containerd version fully supports the Transfer service. | ||
| // While containerd 1.7 has Transfer service, full support is only available in 2.0+. |
There was a problem hiding this comment.
| // While containerd 1.7 has Transfer service, full support is only available in 2.0+. | |
| // While containerd 1.7 has Transfer service, full support is only available in 2.0+. | |
| // The following features are missing in containerd 1.7: | |
| // - [ADD MISSING FEATURES] |
| snapshotter = "fuse-overlayfs" | ||
| [[plugins."io.containerd.transfer.v1.local".unpack_config]] | ||
| platform = "linux" | ||
| snapshotter = "overlayfs" |
There was a problem hiding this comment.
Not a fan of complicating the config.
What happens if these lines are missing?
ctr doesn't need them AFAICS?
There was a problem hiding this comment.
By default, it would be
[[plugins."io.containerd.transfer.v1.local".unpack_config]]
platform = "linux/amd64"(matches the host's OS/Architecture)
snapshotter = "overlayfs"
differ = "walking"
There was a problem hiding this comment.
This config is required to specify which snapshotter the transfer service should use when unpacking images. We define multiple unpack targets:
- overlayfs for standard OCI images
- stargz / soci for lazy-pulling support
Without this, containerd defaults to basic unpacking and won't leverage stargz/soci snapshotters needed for lazy-pulling.
And if we only configure stargz in unpack_config, then all images would be forced to use the stargz snapshotter during transfer/unpacking, even standard OCI images that don't support lazy-pulling.
There was a problem hiding this comment.
Can you add that as comment lines, and update the relevant docs?
What about soci, nydus, etc?
Add remote snapshot annotations and transfer unpack config for stargz, soci, and fuse-overlayfs snapshotter plugins. Signed-off-by: ChengyuZhu6 <hudson@cyzhu.com>
Add version detection to automatically select Transfer service (2.0+) or legacy resolver methods (< 2.0) for better compatibility. Signed-off-by: ChengyuZhu6 <hudson@cyzhu.com>
Fixes: #4573