Skip to content

Commit

Permalink
Merge pull request moby#48251 from thaJeztah/daemon_reduce_c8d_imports
Browse files Browse the repository at this point in the history
daemon: isPermissibleC8dRuntimeName: use local utility to reduce c8d deps
  • Loading branch information
vvoland authored Jul 29, 2024
2 parents c1b7972 + 7a92f21 commit 92e10e8
Show file tree
Hide file tree
Showing 26 changed files with 13 additions and 5,495 deletions.
16 changes: 13 additions & 3 deletions daemon/runtime_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (

"github.com/containerd/containerd/plugin"
v2runcoptions "github.com/containerd/containerd/runtime/v2/runc/options"
"github.com/containerd/containerd/runtime/v2/shim"
"github.com/containerd/log"
"github.com/docker/docker/daemon/config"
"github.com/docker/docker/errdefs"
Expand Down Expand Up @@ -265,6 +264,17 @@ func isPermissibleC8dRuntimeName(name string) bool {
// "containerd-shim---".
//
// https://github.com/containerd/containerd/blob/11ded166c15f92450958078cd13c6d87131ec563/runtime/v2/manager.go#L297-L317
// https://github.com/containerd/containerd/blob/11ded166c15f92450958078cd13c6d87131ec563/runtime/v2/shim/util.go#L83-L93
return !filepath.IsAbs(name) && !strings.ContainsRune(name, '/') && shim.BinaryName(name) != ""
if filepath.IsAbs(name) || strings.ContainsRune(name, '/') {
return false
}

// runtime name should format like $prefix.name.version
// see: https://github.com/containerd/containerd/blob/11ded166c15f92450958078cd13c6d87131ec563/runtime/v2/shim/util.go#L83-L93
//
// FIXME(thaJeztah): add a utility to the containerd module for this; some parts (like [shim.BinaryName]) are in the shim package, which comes with a large number of dependencies.
if prefix, _, ok := strings.Cut(name, "."); !ok || prefix == "" {
return false
}

return true
}
17 changes: 0 additions & 17 deletions vendor/github.com/containerd/containerd/api/runtime/task/v2/doc.go

This file was deleted.

Loading

0 comments on commit 92e10e8

Please sign in to comment.