summaryrefslogtreecommitdiffhomepage
path: root/pkg/v2
diff options
context:
space:
mode:
authorjmillikin-stripe <jmillikin@stripe.com>2019-03-28 22:00:49 -0700
committerIan Lewis <ianlewis@google.com>2019-03-29 14:00:49 +0900
commit5ff5bb636db4c16eea8887f1ff2d6c15581fa1bb (patch)
tree5d12a46f725fbec1ec439924ec7040f34ec776db /pkg/v2
parentb7015c1a46fbea47ad8e7985583b30bd918ddc4b (diff)
Support task creation options passed by ContainerD 1.2.4 (#20)
When ContainerD v1.2.4 creates a task, it may pass a *runctypes.CreateOptions in the request options field. This currently causes the gvisor-containerd-shim to reject the request. This PR allows the shim to handle requests with creation options set, and also slightly improves the error message so future failures of this kind are easier to localize to the shim. Fixes #19
Diffstat (limited to 'pkg/v2')
-rw-r--r--pkg/v2/service.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/pkg/v2/service.go b/pkg/v2/service.go
index 912798e23..3116c09fe 100644
--- a/pkg/v2/service.go
+++ b/pkg/v2/service.go
@@ -240,6 +240,10 @@ func (s *service) Create(ctx context.Context, r *taskAPI.CreateTaskRequest) (_ *
}
var path string
switch o := v.(type) {
+ case *runctypes.CreateOptions: // containerd 1.2.x
+ opts.IoUid = o.IoUid
+ opts.IoGid = o.IoGid
+ opts.ShimCgroup = o.ShimCgroup
case *runctypes.RuncOptions: // containerd 1.2.x
root := proc.RunscRoot
if o.RuntimeRoot != "" {
@@ -262,7 +266,7 @@ func (s *service) Create(ctx context.Context, r *taskAPI.CreateTaskRequest) (_ *
}
path = o.ConfigPath
default:
- return nil, errors.Errorf("unsupported option type")
+ return nil, errors.Errorf("unsupported option type %q", r.Options.TypeUrl)
}
if path != "" {
if _, err = toml.DecodeFile(path, &opts); err != nil {