-
Notifications
You must be signed in to change notification settings - Fork 0
/
runrunc.go
51 lines (43 loc) · 1.47 KB
/
runrunc.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package runrunc
import (
"os/exec"
"code.cloudfoundry.org/commandrunner"
)
const DefaultRootPath = "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
const DefaultPath = "PATH=/usr/local/bin:/usr/bin:/bin"
// da doo
type RunRunc struct {
commandRunner commandrunner.CommandRunner
runc RuncBinary
*Execer
*Creator
*OomWatcher
*Statser
*Stater
*Killer
*Deleter
}
//go:generate counterfeiter . RuncBinary
type RuncBinary interface {
ExecCommand(id, processJSONPath, pidFilePath string) *exec.Cmd
EventsCommand(id string) *exec.Cmd
StateCommand(id, logFile string) *exec.Cmd
StatsCommand(id, logFile string) *exec.Cmd
KillCommand(id, signal, logFile string) *exec.Cmd
DeleteCommand(id string, force bool, logFile string) *exec.Cmd
}
func New(
runner commandrunner.CommandRunner, runcCmdRunner RuncCmdRunner,
runc RuncBinary, dadooPath, runcPath string, runcExtraArgs []string, bundleLoader BundleLoader, processBuilder ProcessBuilder,
mkdirer Mkdirer, userLookuper UserLookupper, execRunner ExecRunner, uidGenerator UidGenerator,
) *RunRunc {
return &RunRunc{
Creator: NewCreator(runcPath, runcExtraArgs, runner),
Execer: NewExecer(bundleLoader, processBuilder, mkdirer, userLookuper, execRunner, uidGenerator),
OomWatcher: NewOomWatcher(runner, runc),
Statser: NewStatser(runcCmdRunner, runc),
Stater: NewStater(runcCmdRunner, runc),
Killer: NewKiller(runcCmdRunner, runc),
Deleter: NewDeleter(runcCmdRunner, runc),
}
}