chunked: allow to disable partial images feature

enable partial pulls only when it is explicitely configured in the
storage.conf file:

[storage.options]

pull_options = {enable_partial_images = "true"}

This is to prevent the experimental feature to leak into CRI-O.

The default value will change in future once the feature is stable.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2021-08-16 15:29:12 +02:00
parent 6cb4208a54
commit e5b1bbd274
1 changed files with 7 additions and 1 deletions

View File

@ -654,8 +654,14 @@ func (d *chunkedZstdDiffer) ApplyDiff(dest string, options *archive.TarOptions)
return output, err
}
const trueVal = "true"
if value := storeOpts.PullOptions["enable_partial_images"]; strings.ToLower(value) != trueVal {
return output, errors.New("enable_partial_images not configured")
}
enableHostDedup := false
if value := storeOpts.PullOptions["enable_host_deduplication"]; strings.ToLower(value) == "true" {
if value := storeOpts.PullOptions["enable_host_deduplication"]; strings.ToLower(value) == trueVal {
enableHostDedup = true
}