Skip to content

Commit

Permalink
rootless: refactor libcontainer_specconv
Browse files Browse the repository at this point in the history
Signed-off-by: Akihiro Suda <[email protected]>
  • Loading branch information
AkihiroSuda committed Jul 4, 2018
1 parent 7bddb1d commit 7232772
Show file tree
Hide file tree
Showing 19 changed files with 1,576 additions and 2,268 deletions.
14 changes: 7 additions & 7 deletions executor/runcexecutor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"github.com/moby/buildkit/executor"
"github.com/moby/buildkit/executor/oci"
"github.com/moby/buildkit/identity"
"github.com/moby/buildkit/util/libcontainer_specconv"
rootlessspecconv "github.com/moby/buildkit/util/rootless/specconv"
"github.com/moby/buildkit/util/system"
"github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
Expand Down Expand Up @@ -84,6 +84,8 @@ func New(opt Opt) (executor.Executor, error) {
LogFormat: runc.JSON,
PdeathSignal: syscall.SIGKILL,
Setpgid: true,
// we don't execute runc with --rootless=(true|false) explicitly,
// so as to support non-runc runtimes
}

w := &runcExecutor{
Expand Down Expand Up @@ -169,13 +171,11 @@ func (w *runcExecutor) Exec(ctx context.Context, meta executor.Meta, root cache.
return errors.Wrapf(err, "failed to create working directory %s", newp)
}

if err := setOOMScoreAdj(spec); err != nil {
return err
}
if w.rootless {
specconv.ToRootless(spec, nil)
// TODO(AkihiroSuda): keep Cgroups enabled if /sys/fs/cgroup/cpuset/buildkit exists and writable
spec.Linux.CgroupsPath = ""
// TODO(AkihiroSuda): ToRootless removes netns, but we should readd netns here
// if either SUID or userspace NAT is configured on the host.
if err := setOOMScoreAdj(spec); err != nil {
if err := rootlessspecconv.ToRootless(spec); err != nil {
return err
}
}
Expand Down
1 change: 0 additions & 1 deletion util/libcontainer_specconv/README.md

This file was deleted.

190 changes: 0 additions & 190 deletions util/libcontainer_specconv/example.go

This file was deleted.

Loading

0 comments on commit 7232772

Please sign in to comment.