Fix cgroups path for base OCI spec
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
parent
df8d6c5b7b
commit
17c61e36cb
@ -313,7 +313,10 @@ func (c *criService) runtimeSpec(id string, baseSpecFile string, opts ...oci.Spe
|
||||
return nil, errors.Wrap(err, "failed to clone OCI spec")
|
||||
}
|
||||
|
||||
if err := oci.ApplyOpts(ctx, nil, container, &spec, opts...); err != nil {
|
||||
// Fix up cgroups path
|
||||
applyOpts := append([]oci.SpecOpts{oci.WithNamespacedCgroup()}, opts...)
|
||||
|
||||
if err := oci.ApplyOpts(ctx, nil, container, &spec, applyOpts...); err != nil {
|
||||
return nil, errors.Wrap(err, "failed to apply OCI options")
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,7 @@ import (
|
||||
runtime "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
|
||||
|
||||
"github.com/containerd/cri/pkg/config"
|
||||
"github.com/containerd/cri/pkg/constants"
|
||||
"github.com/containerd/cri/pkg/containerd/opts"
|
||||
)
|
||||
|
||||
@ -401,4 +402,6 @@ func TestBaseRuntimeSpec(t *testing.T) {
|
||||
// Make sure original base spec not changed
|
||||
assert.NotEqual(t, out, c.baseOCISpecs["/etc/containerd/cri-base.json"])
|
||||
assert.Equal(t, c.baseOCISpecs["/etc/containerd/cri-base.json"].Hostname, "old")
|
||||
|
||||
assert.Equal(t, filepath.Join("/", constants.K8sContainerdNamespace, "id1"), out.Linux.CgroupsPath)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user