Skip to content

Commit 81409e9

Browse files
committed
Add a default differ that matches the snapshotter
Signed-off-by: James Sturtevant <[email protected]>
1 parent 4f3a026 commit 81409e9

File tree

4 files changed

+68
-8
lines changed

4 files changed

+68
-8
lines changed

defaults/defaults_snapshotter_windows.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ const (
2121
// This will be based on the client compilation target, so take that into
2222
// account when choosing this value.
2323
DefaultSnapshotter = "windows"
24+
DefaultDiffer = "windows"
2425
)

plugins/transfer/plugin.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"github.com/containerd/containerd/v2/core/diff"
2323
"github.com/containerd/containerd/v2/core/leases"
2424
"github.com/containerd/containerd/v2/core/metadata"
25-
"github.com/containerd/containerd/v2/defaults"
2625
"github.com/containerd/containerd/v2/pkg/imageverifier"
2726
"github.com/containerd/containerd/v2/pkg/transfer/local"
2827
"github.com/containerd/containerd/v2/pkg/unpack"
@@ -81,12 +80,7 @@ func init() {
8180
// If UnpackConfiguration is not defined, set the default.
8281
// If UnpackConfiguration is defined and empty, ignore.
8382
if config.UnpackConfiguration == nil {
84-
config.UnpackConfiguration = []unpackConfiguration{
85-
{
86-
Platform: platforms.Format(platforms.DefaultSpec()),
87-
Snapshotter: defaults.DefaultSnapshotter,
88-
},
89-
}
83+
config.UnpackConfiguration = defaultUnpackConfig()
9084
}
9185
for _, uc := range config.UnpackConfiguration {
9286
p, err := platforms.Parse(uc.Platform)
@@ -122,7 +116,7 @@ func init() {
122116
continue
123117
}
124118
if applier != nil {
125-
log.G(ic.Context).Warnf("multiple differs match for platform, set `differ` option to choose, skipping %q", name)
119+
log.G(ic.Context).Warnf("multiple differs match for platform, set `differ` option to choose, skipping %q", plugin.Registration.ID)
126120
continue
127121
}
128122
inst, err := plugin.Instance()
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//go:build !windows
2+
3+
/*
4+
Copyright The containerd Authors.
5+
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
*/
18+
19+
package transfer
20+
21+
import (
22+
"github.com/containerd/containerd/v2/defaults"
23+
"github.com/containerd/platforms"
24+
)
25+
26+
func defaultUnpackConfig() []unpackConfiguration {
27+
return []unpackConfiguration{
28+
{
29+
Platform: platforms.Format(platforms.DefaultSpec()),
30+
Snapshotter: defaults.DefaultSnapshotter,
31+
},
32+
}
33+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
Copyright The containerd Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package transfer
18+
19+
import (
20+
"github.com/containerd/containerd/v2/defaults"
21+
"github.com/containerd/platforms"
22+
)
23+
24+
func defaultUnpackConfig() []unpackConfiguration {
25+
return []unpackConfiguration{
26+
{
27+
Platform: platforms.Format(platforms.DefaultSpec()),
28+
Snapshotter: defaults.DefaultSnapshotter,
29+
Differ: defaults.DefaultDiffer,
30+
},
31+
}
32+
}

0 commit comments

Comments
 (0)