Pass snapshotter opts during Pull
For remote snapshotter cases it's quite often there is need to pass extra info from client (for instance - registry URL to query remote layer from, credentials, etc). This commit slightly extends WithPullSnapshotter to pass extra labels to a snapshotter. Signed-off-by: Maksym Pavlenko <makpav@amazon.com>
This commit is contained in:
@@ -355,10 +355,17 @@ type Cleaner interface {
|
||||
// Opt allows setting mutable snapshot properties on creation
|
||||
type Opt func(info *Info) error
|
||||
|
||||
// WithLabels adds labels to a created snapshot
|
||||
// WithLabels appends labels to a created snapshot
|
||||
func WithLabels(labels map[string]string) Opt {
|
||||
return func(info *Info) error {
|
||||
info.Labels = labels
|
||||
if info.Labels == nil {
|
||||
info.Labels = make(map[string]string)
|
||||
}
|
||||
|
||||
for k, v := range labels {
|
||||
info.Labels[k] = v
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user