Add runtimeArgs to pass to shim

This allows you to pass options like:

```bash
containerd --debug --runtime-args "--debug" --runtime-args
"--systemd-cgroup"
```

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
Michael Crosby 2016-03-24 13:30:27 -07:00
parent 5f0f162c62
commit 6e4d5b385c
7 changed files with 65 additions and 49 deletions

View file

@ -20,7 +20,7 @@ type StartTask struct {
func (s *Supervisor) start(t *StartTask) error {
start := time.Now()
container, err := runtime.New(s.stateDir, t.ID, t.BundlePath, s.runtime, t.Labels)
container, err := runtime.New(s.stateDir, t.ID, t.BundlePath, s.runtime, s.runtimeArgs, t.Labels)
if err != nil {
return err
}

View file

@ -18,7 +18,7 @@ const (
)
// New returns an initialized Process supervisor.
func New(stateDir string, runtimeName string) (*Supervisor, error) {
func New(stateDir string, runtimeName string, runtimeArgs []string) (*Supervisor, error) {
startTasks := make(chan *startTask, 10)
if err := os.MkdirAll(stateDir, 0755); err != nil {
return nil, err
@ -40,6 +40,7 @@ func New(stateDir string, runtimeName string) (*Supervisor, error) {
tasks: make(chan Task, defaultBufferSize),
monitor: monitor,
runtime: runtimeName,
runtimeArgs: runtimeArgs,
}
if err := setupEventLog(s); err != nil {
return nil, err
@ -105,9 +106,10 @@ type Supervisor struct {
// stateDir is the directory on the system to store container runtime state information.
stateDir string
// name of the OCI compatible runtime used to execute containers
runtime string
containers map[string]*containerInfo
startTasks chan *startTask
runtime string
runtimeArgs []string
containers map[string]*containerInfo
startTasks chan *startTask
// we need a lock around the subscribers map only because additions and deletions from
// the map are via the API so we cannot really control the concurrency
subscriberLock sync.RWMutex
@ -196,10 +198,11 @@ func (s *Supervisor) notifySubscribers(e Event) {
// state of the Supervisor
func (s *Supervisor) Start() error {
logrus.WithFields(logrus.Fields{
"stateDir": s.stateDir,
"runtime": s.runtime,
"memory": s.machine.Memory,
"cpus": s.machine.Cpus,
"stateDir": s.stateDir,
"runtime": s.runtime,
"runtimeArgs": s.runtimeArgs,
"memory": s.machine.Memory,
"cpus": s.machine.Cpus,
}).Debug("containerd: supervisor running")
go func() {
for i := range s.tasks {