Add max concurrent downloads support.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
994cea830b
commit
c78caf902d
@ -76,6 +76,9 @@ version = 2
|
|||||||
# This is useful when the containerd does not have permission to decrease OOMScoreAdj.
|
# This is useful when the containerd does not have permission to decrease OOMScoreAdj.
|
||||||
restrict_oom_score_adj = false
|
restrict_oom_score_adj = false
|
||||||
|
|
||||||
|
# max_concurrent_downloads restricts the number of concurrent downloads for each image.
|
||||||
|
max_concurrent_downloads = 3
|
||||||
|
|
||||||
# 'plugins."io.containerd.grpc.v1.cri".containerd' contains config related to containerd
|
# 'plugins."io.containerd.grpc.v1.cri".containerd' contains config related to containerd
|
||||||
[plugins."io.containerd.grpc.v1.cri".containerd]
|
[plugins."io.containerd.grpc.v1.cri".containerd]
|
||||||
|
|
||||||
|
@ -177,6 +177,8 @@ type PluginConfig struct {
|
|||||||
// current OOMScoreADj.
|
// current OOMScoreADj.
|
||||||
// This is useful when the containerd does not have permission to decrease OOMScoreAdj.
|
// This is useful when the containerd does not have permission to decrease OOMScoreAdj.
|
||||||
RestrictOOMScoreAdj bool `toml:"restrict_oom_score_adj" json:"restrictOOMScoreAdj"`
|
RestrictOOMScoreAdj bool `toml:"restrict_oom_score_adj" json:"restrictOOMScoreAdj"`
|
||||||
|
// MaxConcurrentDownloads restricts the number of concurrent downloads for each image.
|
||||||
|
MaxConcurrentDownloads int `toml:"max_concurrent_downloads" json:"maxConcurrentDownloads"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// X509KeyPairStreaming contains the x509 configuration for streaming
|
// X509KeyPairStreaming contains the x509 configuration for streaming
|
||||||
@ -242,6 +244,7 @@ func DefaultConfig() PluginConfig {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
MaxConcurrentDownloads: 3,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +108,7 @@ func (c *criService) PullImage(ctx context.Context, r *runtime.PullImageRequest)
|
|||||||
containerd.WithPullSnapshotter(c.config.ContainerdConfig.Snapshotter),
|
containerd.WithPullSnapshotter(c.config.ContainerdConfig.Snapshotter),
|
||||||
containerd.WithPullUnpack,
|
containerd.WithPullUnpack,
|
||||||
containerd.WithPullLabel(imageLabelKey, imageLabelValue),
|
containerd.WithPullLabel(imageLabelKey, imageLabelValue),
|
||||||
|
containerd.WithMaxConcurrentDownloads(c.config.MaxConcurrentDownloads),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrapf(err, "failed to pull and unpack image %q", ref)
|
return nil, errors.Wrapf(err, "failed to pull and unpack image %q", ref)
|
||||||
|
Loading…
Reference in New Issue
Block a user