Revert "Setting containerd shim cgroup same as pod cgroup"
This reverts commit 59008c608e
.
Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
parent
d0126752d2
commit
c3cb1cfde8
@ -1,22 +0,0 @@
|
|||||||
package opts
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/containerd/containerd"
|
|
||||||
"github.com/containerd/containerd/linux/runcopts"
|
|
||||||
)
|
|
||||||
|
|
||||||
// WithContainerdShimCgroup returns function that sets the containerd
|
|
||||||
// shim cgroup path
|
|
||||||
func WithContainerdShimCgroup(path string) containerd.NewTaskOpts {
|
|
||||||
return func(_ context.Context, _ *containerd.Client, r *containerd.TaskInfo) error {
|
|
||||||
r.Options = &runcopts.CreateOptions{
|
|
||||||
ShimCgroup: path,
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: Since Options is an interface different WithXXX will be needed to set different
|
|
||||||
// combinations of CreateOptions.
|
|
@ -27,7 +27,6 @@ import (
|
|||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
"k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
||||||
|
|
||||||
criopts "github.com/kubernetes-incubator/cri-containerd/pkg/opts"
|
|
||||||
cio "github.com/kubernetes-incubator/cri-containerd/pkg/server/io"
|
cio "github.com/kubernetes-incubator/cri-containerd/pkg/server/io"
|
||||||
containerstore "github.com/kubernetes-incubator/cri-containerd/pkg/store/container"
|
containerstore "github.com/kubernetes-incubator/cri-containerd/pkg/store/container"
|
||||||
)
|
)
|
||||||
@ -143,11 +142,8 @@ func (c *criContainerdService) startContainer(ctx context.Context,
|
|||||||
}
|
}
|
||||||
return cntr.IO, nil
|
return cntr.IO, nil
|
||||||
}
|
}
|
||||||
var taskOpts []containerd.NewTaskOpts
|
|
||||||
if cgroup := sandboxConfig.GetLinux().GetCgroupParent(); cgroup != "" {
|
task, err := container.NewTask(ctx, ioCreation)
|
||||||
taskOpts = append(taskOpts, criopts.WithContainerdShimCgroup(cgroup))
|
|
||||||
}
|
|
||||||
task, err := container.NewTask(ctx, ioCreation, taskOpts...)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to create containerd task: %v", err)
|
return fmt.Errorf("failed to create containerd task: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,6 @@ import (
|
|||||||
"golang.org/x/sys/unix"
|
"golang.org/x/sys/unix"
|
||||||
"k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
"k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
|
||||||
|
|
||||||
criopts "github.com/kubernetes-incubator/cri-containerd/pkg/opts"
|
|
||||||
sandboxstore "github.com/kubernetes-incubator/cri-containerd/pkg/store/sandbox"
|
sandboxstore "github.com/kubernetes-incubator/cri-containerd/pkg/store/sandbox"
|
||||||
"github.com/kubernetes-incubator/cri-containerd/pkg/util"
|
"github.com/kubernetes-incubator/cri-containerd/pkg/util"
|
||||||
)
|
)
|
||||||
@ -182,11 +181,7 @@ func (c *criContainerdService) RunPodSandbox(ctx context.Context, r *runtime.Run
|
|||||||
glog.V(5).Infof("Create sandbox container (id=%q, name=%q).",
|
glog.V(5).Infof("Create sandbox container (id=%q, name=%q).",
|
||||||
id, name)
|
id, name)
|
||||||
// We don't need stdio for sandbox container.
|
// We don't need stdio for sandbox container.
|
||||||
var taskOpts []containerd.NewTaskOpts
|
task, err := container.NewTask(ctx, containerd.NullIO)
|
||||||
if cgroup := config.GetLinux().GetCgroupParent(); cgroup != "" {
|
|
||||||
taskOpts = append(taskOpts, criopts.WithContainerdShimCgroup(cgroup))
|
|
||||||
}
|
|
||||||
task, err := container.NewTask(ctx, containerd.NullIO, taskOpts...)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to create task for sandbox %q: %v", id, err)
|
return nil, fmt.Errorf("failed to create task for sandbox %q: %v", id, err)
|
||||||
}
|
}
|
||||||
@ -258,6 +253,7 @@ func (c *criContainerdService) generateSandboxContainerSpec(id string, config *r
|
|||||||
// When cgroup parent is not set, containerd-shim will create container in a child cgroup
|
// When cgroup parent is not set, containerd-shim will create container in a child cgroup
|
||||||
// of the cgroup itself is in.
|
// of the cgroup itself is in.
|
||||||
// TODO(random-liu): [P2] Set default cgroup path if cgroup parent is not specified.
|
// TODO(random-liu): [P2] Set default cgroup path if cgroup parent is not specified.
|
||||||
|
|
||||||
// Set namespace options.
|
// Set namespace options.
|
||||||
securityContext := config.GetLinux().GetSecurityContext()
|
securityContext := config.GetLinux().GetSecurityContext()
|
||||||
nsOptions := securityContext.GetNamespaceOptions()
|
nsOptions := securityContext.GetNamespaceOptions()
|
||||||
|
Loading…
Reference in New Issue
Block a user