Fix density spec generation
Fixes
@@ -31,7 +31,6 @@ import (
"github.com/containerd/containerd"
"github.com/containerd/containerd/cio"
- "github.com/containerd/containerd/containers"
"github.com/containerd/containerd/namespaces"
"github.com/containerd/containerd/oci"
"github.com/sirupsen/logrus"
@@ -76,11 +75,6 @@ var densityCommand = cli.Command{
s := make(chan os.Signal, 1)
signal.Notify(s, syscall.SIGTERM, syscall.SIGINT)
- spec, err := oci.GenerateSpec(ctx, client,
- &containers.Container{},
- oci.WithImageConfig(image),
- oci.WithProcessArgs("sleep", "120m"),
- )
if err != nil {
return err
}
@@ -95,11 +89,13 @@ var densityCommand = cli.Command{
break loop
default:
id := fmt.Sprintf("density-%d", i)
- spec.Linux.CgroupsPath = filepath.Join("/", "density", id)
c, err := client.NewContainer(ctx, id,
containerd.WithNewSnapshot(id, image),
- containerd.WithSpec(spec, oci.WithUsername("games")),
+ containerd.WithNewSpec(
+ oci.WithImageConfig(image),
+ oci.WithProcessArgs("sleep", "120m"),
+ oci.WithUsername("games")),
)
if err != nil {
return err
