Skip to content

Commit 4bcea74

Browse files
dmcgowank8s-infra-cherrypick-robot
authored andcommitted
Update differ selection in transfer service to prefer default
Currently the erofs differ will be chosen and cause pulls to fail with not implemented errors. Signed-off-by: Derek McGowan <[email protected]>
1 parent 0c3cd8a commit 4bcea74

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

plugins/transfer/plugin.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"github.com/containerd/containerd/v2/core/metadata"
3131
"github.com/containerd/containerd/v2/core/transfer/local"
3232
"github.com/containerd/containerd/v2/core/unpack"
33+
"github.com/containerd/containerd/v2/defaults"
3334
"github.com/containerd/containerd/v2/internal/kmutex"
3435
"github.com/containerd/containerd/v2/pkg/imageverifier"
3536
"github.com/containerd/containerd/v2/plugins"
@@ -115,6 +116,7 @@ func init() {
115116
}
116117
applier = inst.(diff.Applier)
117118
} else {
119+
var applierID string
118120
for name, plugin := range ic.GetAll() {
119121
if plugin.Registration.Type != plugins.DiffPlugin {
120122
continue
@@ -129,14 +131,25 @@ func init() {
129131
continue
130132
}
131133
if applier != nil {
132-
log.G(ic.Context).Warnf("multiple differs match for platform, set `differ` option to choose, skipping %q", plugin.Registration.ID)
133-
continue
134+
skippedApplier := plugin.Registration.ID
135+
136+
// Prefer the default when multiple plugins match
137+
if skippedApplier == defaults.DefaultDiffer {
138+
skippedApplier = applierID
139+
}
140+
141+
log.G(ic.Context).Warnf("multiple differs match for platform, set `differ` option to choose, skipping %q", skippedApplier)
142+
143+
if plugin.Registration.ID == skippedApplier {
144+
continue
145+
}
134146
}
135147
inst, err := plugin.Instance()
136148
if err != nil {
137149
return nil, fmt.Errorf("failed to get instance for diff plugin %q: %w", name, err)
138150
}
139151
applier = inst.(diff.Applier)
152+
applierID = plugin.Registration.ID
140153
}
141154
}
142155
if applier == nil {

0 commit comments

Comments
 (0)