Skip to content

Commit ebef815

Browse files
committed
Remove sandbox mode
1 parent bf83532 commit ebef815

File tree

10 files changed

+8
-436
lines changed

10 files changed

+8
-436
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ Tork is a highly-scalable, general-purpose workflow engine.
5353
- [For-Each Task](https://www.tork.run/tasks#each-task)
5454
- [Subjob Task](https://www.tork.run/tasks#sub-job-task)
5555
- [Task Priority](https://www.tork.run/tasks#priority)
56-
- [Sandbox Mode](https://www.tork.run/runtime#sandbox-mode-experimental)
5756
- [Secrets](https://www.tork.run/tasks#secrets)
5857
- [Scheduled Jobs](https://tork.run/jobs#scheduled-jobs)
5958
- [Web UI](https://www.tork.run/web-ui)

configs/sample.config.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,5 @@ gid = "" # set the gid for the the task process (recommended)
119119

120120
[runtime.docker]
121121
config = ""
122-
sandbox = false
123-
busybox.image = "busybox:stable"
124122

125123
[runtime.podman]
126-
sandbox = false

engine/worker.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@ func (e *Engine) initRuntime() (runtime.Runtime, error) {
7676
docker.WithMounter(mounter),
7777
docker.WithConfig(conf.String("runtime.docker.config")),
7878
docker.WithBroker(e.brokerRef),
79-
docker.WithSandbox(conf.BoolDefault("runtime.docker.sandbox", false)),
80-
docker.WithBusyboxImage(conf.StringDefault("runtime.docker.busybox.image", "busybox:stable")),
8179
)
8280
case runtime.Shell:
8381
return shell.NewShellRuntime(shell.Config{
@@ -101,7 +99,6 @@ func (e *Engine) initRuntime() (runtime.Runtime, error) {
10199
return podman.NewPodmanRuntime(
102100
podman.WithBroker(e.brokerRef),
103101
podman.WithMounter(mounter),
104-
podman.WithSandbox(conf.BoolDefault("runtime.podman.sandbox", false)),
105102
), nil
106103
default:
107104
return nil, errors.Errorf("unknown runtime type: %s", runtimeType)

go.mod

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ require (
2121
github.com/labstack/echo/v4 v4.13.3
2222
github.com/lib/pq v1.10.9
2323
github.com/lithammer/shortuuid/v4 v4.0.0
24-
github.com/moby/moby v27.0.3+incompatible
2524
github.com/pkg/errors v0.9.1
2625
github.com/rabbitmq/amqp091-go v1.9.0
2726
github.com/robfig/cron/v3 v3.0.1
@@ -40,7 +39,6 @@ require (
4039
require (
4140
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
4241
github.com/Microsoft/go-winio v0.6.2 // indirect
43-
github.com/containerd/containerd v1.7.18 // indirect
4442
github.com/containerd/log v0.1.0 // indirect
4543
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
4644
github.com/davecgh/go-spew v1.1.1 // indirect
@@ -59,7 +57,6 @@ require (
5957
github.com/gogo/protobuf v1.3.2 // indirect
6058
github.com/google/go-cmp v0.6.0 // indirect
6159
github.com/jonboulle/clockwork v0.4.0 // indirect
62-
github.com/klauspost/compress v1.17.9 // indirect
6360
github.com/knadh/koanf/maps v0.1.1 // indirect
6461
github.com/kr/pretty v0.3.0 // indirect
6562
github.com/labstack/gommon v0.4.2 // indirect
@@ -71,9 +68,6 @@ require (
7168
github.com/mitchellh/copystructure v1.2.0 // indirect
7269
github.com/mitchellh/reflectwalk v1.0.2 // indirect
7370
github.com/moby/docker-image-spec v1.3.1 // indirect
74-
github.com/moby/patternmatcher v0.6.0 // indirect
75-
github.com/moby/sys/sequential v0.5.0 // indirect
76-
github.com/moby/sys/user v0.1.0 // indirect
7771
github.com/moby/term v0.5.0 // indirect
7872
github.com/morikuni/aec v1.0.0 // indirect
7973
github.com/opencontainers/go-digest v1.0.0 // indirect

go.sum

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU=
2-
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8=
31
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0=
42
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
53
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
64
github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY=
75
github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU=
86
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
97
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
10-
github.com/containerd/containerd v1.7.18 h1:jqjZTQNfXGoEaZdW1WwPU0RqSn1Bm2Ay/KJPUuO8nao=
11-
github.com/containerd/containerd v1.7.18/go.mod h1:IYEk9/IO6wAPUz2bCMVUbsfXjzw5UNP5fLz4PsUygQ4=
128
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
139
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
1410
github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
@@ -78,8 +74,6 @@ github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST
7874
github.com/jonboulle/clockwork v0.4.0/go.mod h1:xgRqUGwRcjKCO1vbZUEtSLrqKoPSsUpK7fnezOII0kc=
7975
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
8076
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
81-
github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
82-
github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
8377
github.com/knadh/koanf/maps v0.1.1 h1:G5TjmUh2D7G2YWf5SQQqSiHRJEjaicvU0KpypqB3NIs=
8478
github.com/knadh/koanf/maps v0.1.1/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI=
8579
github.com/knadh/koanf/parsers/toml v0.1.0 h1:S2hLqS4TgWZYj4/7mI5m1CQQcWurxUz6ODgOub/6LCI=
@@ -126,14 +120,6 @@ github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zx
126120
github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw=
127121
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=
128122
github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo=
129-
github.com/moby/moby v27.0.3+incompatible h1:lnUi7z7EFl1VkcahJOdvkI5QDEHJyib4CHbQK3MCQsw=
130-
github.com/moby/moby v27.0.3+incompatible/go.mod h1:fDXVQ6+S340veQPv35CzDahGBmHsiclFwfEygB/TWMc=
131-
github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk=
132-
github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc=
133-
github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc=
134-
github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo=
135-
github.com/moby/sys/user v0.1.0 h1:WmZ93f5Ux6het5iituh9x2zAG7NFY9Aqi49jjE1PaQg=
136-
github.com/moby/sys/user v0.1.0/go.mod h1:fKJhFOnsCN6xZ5gSfbM6zaHGgDJMrqt9/reuj4T7MmU=
137123
github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0=
138124
github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
139125
github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A=
@@ -269,7 +255,6 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
269255
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
270256
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
271257
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
272-
google.golang.org/genproto v0.0.0-20230920204549-e6e6cdab5c13 h1:vlzZttNJGVqTsRFU9AmdnrcO1Znh8Ew9kCD//yjigk0=
273258
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0=
274259
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8=
275260
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4=

runtime/docker/docker.go

Lines changed: 8 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import (
1111
"io"
1212
"math/big"
1313
"os"
14-
"regexp"
1514
"strconv"
1615
"strings"
1716
"time"
@@ -38,22 +37,17 @@ import (
3837
// defaultWorkdir is the directory where `Task.File`s are
3938
// written to by default, should `Task.Workdir` not be set
4039
const (
41-
defaultWorkdir = "/tork/workdir"
42-
defaultSandboxUser = "1000:1000"
40+
defaultWorkdir = "/tork/workdir"
4341
)
4442

45-
var rootUserPattern = regexp.MustCompile(`^(|root|0|root(:root)?|root:0|0:root|0:0)$`)
46-
4743
type DockerRuntime struct {
48-
client *client.Client
49-
tasks *syncx.Map[string, string]
50-
images *syncx.Map[string, bool]
51-
pullq chan *pullRequest
52-
mounter runtime.Mounter
53-
broker broker.Broker
54-
config string
55-
sandbox bool
56-
busyboxImage string
44+
client *client.Client
45+
tasks *syncx.Map[string, string]
46+
images *syncx.Map[string, bool]
47+
pullq chan *pullRequest
48+
mounter runtime.Mounter
49+
broker broker.Broker
50+
config string
5751
}
5852

5953
type dockerLogsReader struct {
@@ -93,18 +87,6 @@ func WithConfig(config string) Option {
9387
}
9488
}
9589

96-
func WithSandbox(val bool) Option {
97-
return func(rt *DockerRuntime) {
98-
rt.sandbox = val
99-
}
100-
}
101-
102-
func WithBusyboxImage(name string) Option {
103-
return func(rt *DockerRuntime) {
104-
rt.busyboxImage = name
105-
}
106-
}
107-
10890
func NewDockerRuntime(opts ...Option) (*DockerRuntime, error) {
10991
dc, err := client.NewClientWithOpts(client.FromEnv)
11092
if err != nil {
@@ -119,9 +101,6 @@ func NewDockerRuntime(opts ...Option) (*DockerRuntime, error) {
119101
for _, o := range opts {
120102
o(rt)
121103
}
122-
if rt.busyboxImage == "" {
123-
rt.busyboxImage = "busybox:stable"
124-
}
125104
// setup a default mounter
126105
if rt.mounter == nil {
127106
vmounter, err := NewVolumeMounter()
@@ -142,16 +121,6 @@ func (d *DockerRuntime) Run(ctx context.Context, t *tork.Task) error {
142121
if err != nil {
143122
return err
144123
}
145-
if d.sandbox && mnt.Type == tork.MountTypeVolume {
146-
// add a pre-task to adjust volume permissions
147-
// to allow access to the tork user
148-
t.Pre = append([]*tork.Task{{
149-
Internal: true,
150-
Image: d.busyboxImage,
151-
CMD: []string{"sh", "-c", fmt.Sprintf("chmod 777 %s", mnt.Target)},
152-
Mounts: []tork.Mount{mnt},
153-
}}, t.Pre...)
154-
}
155124
defer func(m tork.Mount) {
156125
uctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
157126
defer cancel()
@@ -307,18 +276,6 @@ func (d *DockerRuntime) doRun(ctx context.Context, t *tork.Task, logger io.Write
307276
Cmd: cmd,
308277
Entrypoint: entrypoint,
309278
}
310-
if d.sandbox && !t.Internal {
311-
imageInspect, _, err := d.client.ImageInspectWithRaw(ctx, t.Image)
312-
if err != nil {
313-
return err
314-
}
315-
user := imageInspect.Config.User
316-
if rootUserPattern.MatchString(user) {
317-
// set a sandboxed (non-root) user
318-
// only if the default user is root
319-
containerConf.User = defaultSandboxUser
320-
}
321-
}
322279
// we want to override the default
323280
// image WORKDIR only if the task
324281
// introduces work files _or_ if the

0 commit comments

Comments
 (0)