snapshotter: support "remap-ids" capability for overlayfs
Previously remapping of a snapshotter has been done using
recursive chown.
Commit
31a6449734 added a support
for "remap-ids" capability which allows snapshotter internals do
remappings in case of idmapped mounts support to avoid recursive
chown and creating a new remapped snapshot.
Signed-off-by: Ilya Hanov <ilya.hanov@huawei-partners.com>
This commit is contained in:
@@ -24,6 +24,11 @@ import (
|
||||
"github.com/containerd/containerd/platforms"
|
||||
"github.com/containerd/containerd/plugin"
|
||||
"github.com/containerd/containerd/snapshots/overlay"
|
||||
"github.com/containerd/containerd/snapshots/overlay/overlayutils"
|
||||
)
|
||||
|
||||
const (
|
||||
capaRemapIds = "remap-ids"
|
||||
)
|
||||
|
||||
// Config represents configuration for the overlay plugin.
|
||||
@@ -66,6 +71,10 @@ func init() {
|
||||
if len(config.MountOptions) > 0 {
|
||||
oOpts = append(oOpts, overlay.WithMountOptions(config.MountOptions))
|
||||
}
|
||||
if ok, err := overlayutils.SupportsIDMappedMounts(); err == nil && ok {
|
||||
oOpts = append(oOpts, overlay.WithRemapIds)
|
||||
ic.Meta.Capabilities = append(ic.Meta.Capabilities, capaRemapIds)
|
||||
}
|
||||
|
||||
ic.Meta.Exports["root"] = root
|
||||
return overlay.NewSnapshotter(root, oOpts...)
|
||||
|
||||
Reference in New Issue
Block a user