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:
parent
5f0f162c62
commit
6e4d5b385c
7 changed files with 65 additions and 49 deletions
|
@ -83,14 +83,15 @@ func NewStdio(stdin, stdout, stderr string) Stdio {
|
|||
}
|
||||
|
||||
// New returns a new container
|
||||
func New(root, id, bundle, runtimeName string, labels []string) (Container, error) {
|
||||
func New(root, id, bundle, runtimeName string, runtimeArgs, labels []string) (Container, error) {
|
||||
c := &container{
|
||||
root: root,
|
||||
id: id,
|
||||
bundle: bundle,
|
||||
labels: labels,
|
||||
processes: make(map[string]*process),
|
||||
runtime: runtimeName,
|
||||
root: root,
|
||||
id: id,
|
||||
bundle: bundle,
|
||||
labels: labels,
|
||||
processes: make(map[string]*process),
|
||||
runtime: runtimeName,
|
||||
runtimeArgs: runtimeArgs,
|
||||
}
|
||||
if err := os.Mkdir(filepath.Join(root, id), 0755); err != nil {
|
||||
return nil, err
|
||||
|
@ -101,9 +102,10 @@ func New(root, id, bundle, runtimeName string, labels []string) (Container, erro
|
|||
}
|
||||
defer f.Close()
|
||||
if err := json.NewEncoder(f).Encode(state{
|
||||
Bundle: bundle,
|
||||
Labels: labels,
|
||||
Runtime: runtimeName,
|
||||
Bundle: bundle,
|
||||
Labels: labels,
|
||||
Runtime: runtimeName,
|
||||
RuntimeArgs: runtimeArgs,
|
||||
}); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -121,12 +123,13 @@ func Load(root, id string) (Container, error) {
|
|||
return nil, err
|
||||
}
|
||||
c := &container{
|
||||
root: root,
|
||||
id: id,
|
||||
bundle: s.Bundle,
|
||||
labels: s.Labels,
|
||||
runtime: s.Runtime,
|
||||
processes: make(map[string]*process),
|
||||
root: root,
|
||||
id: id,
|
||||
bundle: s.Bundle,
|
||||
labels: s.Labels,
|
||||
runtime: s.Runtime,
|
||||
runtimeArgs: s.RuntimeArgs,
|
||||
processes: make(map[string]*process),
|
||||
}
|
||||
dirs, err := ioutil.ReadDir(filepath.Join(root, id))
|
||||
if err != nil {
|
||||
|
@ -166,13 +169,14 @@ func readProcessState(dir string) (*ProcessState, error) {
|
|||
|
||||
type container struct {
|
||||
// path to store runtime state information
|
||||
root string
|
||||
id string
|
||||
bundle string
|
||||
runtime string
|
||||
processes map[string]*process
|
||||
labels []string
|
||||
oomFds []int
|
||||
root string
|
||||
id string
|
||||
bundle string
|
||||
runtime string
|
||||
runtimeArgs []string
|
||||
processes map[string]*process
|
||||
labels []string
|
||||
oomFds []int
|
||||
}
|
||||
|
||||
func (c *container) ID() string {
|
||||
|
|
|
@ -35,8 +35,9 @@ func populateProcessStateForEncoding(config *processConfig, uid int, gid int) Pr
|
|||
RootUID: uid,
|
||||
RootGID: gid,
|
||||
},
|
||||
Stdin: config.stdio.Stdin,
|
||||
Stdout: config.stdio.Stdout,
|
||||
Stderr: config.stdio.Stderr,
|
||||
Stdin: config.stdio.Stdin,
|
||||
Stdout: config.stdio.Stdout,
|
||||
Stderr: config.stdio.Stderr,
|
||||
RuntimeArgs: config.c.runtimeArgs,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,20 +53,22 @@ const (
|
|||
)
|
||||
|
||||
type state struct {
|
||||
Bundle string `json:"bundle"`
|
||||
Labels []string `json:"labels"`
|
||||
Stdin string `json:"stdin"`
|
||||
Stdout string `json:"stdout"`
|
||||
Stderr string `json:"stderr"`
|
||||
Runtime string `json:"runtime"`
|
||||
Bundle string `json:"bundle"`
|
||||
Labels []string `json:"labels"`
|
||||
Stdin string `json:"stdin"`
|
||||
Stdout string `json:"stdout"`
|
||||
Stderr string `json:"stderr"`
|
||||
Runtime string `json:"runtime"`
|
||||
RuntimeArgs []string `json:"runtimeArgs"`
|
||||
}
|
||||
|
||||
type ProcessState struct {
|
||||
specs.ProcessSpec
|
||||
Exec bool `json:"exec"`
|
||||
Stdin string `json:"containerdStdin"`
|
||||
Stdout string `json:"containerdStdout"`
|
||||
Stderr string `json:"containerdStderr"`
|
||||
Exec bool `json:"exec"`
|
||||
Stdin string `json:"containerdStdin"`
|
||||
Stdout string `json:"containerdStdout"`
|
||||
Stderr string `json:"containerdStderr"`
|
||||
RuntimeArgs []string `json:"runtimeArgs"`
|
||||
|
||||
PlatformProcessState
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue