ctr: FetchConfig: allow setting additional []containerd.RemoteOpt

The additional []containerd.RemoteOpt is not used by ctr currently,
but planned to be used by nerdctl and also probably by stargz's ctr-remote.

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
This commit is contained in:
Akihiro Suda 2020-12-09 16:09:16 +09:00
parent 1e624fa3de
commit 1febce4ca8
No known key found for this signature in database
GPG Key ID: 49524C6F9F638F1A

View File

@ -108,6 +108,8 @@ type FetchConfig struct {
Platforms []string
// Whether or not download all metadata
AllMetadata bool
// RemoteOpts is not used by ctr, but can be used by other CLI tools
RemoteOpts []containerd.RemoteOpt
}
// NewFetchConfig returns the default FetchConfig from cli flags
@ -172,6 +174,7 @@ func Fetch(ctx context.Context, client *containerd.Client, ref string, config *F
containerd.WithImageHandler(h),
containerd.WithSchema1Conversion,
}
opts = append(opts, config.RemoteOpts...)
if config.AllMetadata {
opts = append(opts, containerd.WithAllMetadata())