Add no_shim
config for not running with a shim
This reuses the exiting shim code and services to let containerd run as the reaper for all container processes without the use of a shim. Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
@@ -36,6 +36,8 @@ func init() {
|
||||
type Config struct {
|
||||
// Runtime is a path or name of an OCI runtime used by the shim
|
||||
Runtime string `toml:"runtime"`
|
||||
// NoShim calls runc directly from within the pkg
|
||||
NoShim bool `toml:"no_shim"`
|
||||
}
|
||||
|
||||
func New(ic *plugin.InitContext) (interface{}, error) {
|
||||
@@ -50,6 +52,7 @@ func New(ic *plugin.InitContext) (interface{}, error) {
|
||||
c, cancel := context.WithCancel(ic.Context)
|
||||
return &Runtime{
|
||||
root: path,
|
||||
remote: !cfg.NoShim,
|
||||
runtime: cfg.Runtime,
|
||||
events: make(chan *containerd.Event, 2048),
|
||||
eventsContext: c,
|
||||
@@ -60,6 +63,7 @@ func New(ic *plugin.InitContext) (interface{}, error) {
|
||||
type Runtime struct {
|
||||
root string
|
||||
runtime string
|
||||
remote bool
|
||||
|
||||
events chan *containerd.Event
|
||||
eventsContext context.Context
|
||||
@@ -71,7 +75,7 @@ func (r *Runtime) Create(ctx context.Context, id string, opts containerd.CreateO
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s, err := newShim(path)
|
||||
s, err := newShim(path, r.remote)
|
||||
if err != nil {
|
||||
os.RemoveAll(path)
|
||||
return nil, err
|
||||
@@ -205,7 +209,7 @@ func (r *Runtime) deleteBundle(id string) error {
|
||||
|
||||
func (r *Runtime) loadContainer(path string) (*Container, error) {
|
||||
id := filepath.Base(path)
|
||||
s, err := loadShim(path)
|
||||
s, err := loadShim(path, r.remote)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user