Skip to content

Commit cb87112

Browse files
committed
add annotation to control /dev/shm size
Signed-off-by: Maksim An <[email protected]>
1 parent 6398a3b commit cb87112

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

pkg/server/container_create_windows.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,15 @@ func (c *criService) CreateContainer(ctx context.Context, r *runtime.CreateConta
192192
}
193193
}
194194

195+
var specOpts []oci.SpecOpts
196+
if val, ok := config.Annotations["io.microsoft.container.storage.shm.size-kb"]; ok {
197+
sz, err := strconv.ParseInt(val, 10, 64)
198+
if err != nil {
199+
sz = 64*1024
200+
}
201+
specOpts = append(specOpts, oci.WithDevShmSize(sz))
202+
}
203+
195204
snapshotterOpt := snapshots.WithLabels(config.Annotations)
196205
// Set snapshotter before any other options.
197206
opts := []containerd.NewContainerOpts{
@@ -232,7 +241,7 @@ func (c *criService) CreateContainer(ctx context.Context, r *runtime.CreateConta
232241
return nil, errors.Wrap(err, "failed to get runtime options")
233242
}
234243
opts = append(opts,
235-
containerd.WithSpec(spec),
244+
containerd.WithSpec(spec, specOpts...),
236245
containerd.WithContainerLabels(containerLabels),
237246
containerd.WithContainerExtension(containerMetadataExtension, &meta),
238247
containerd.WithRuntime(sandboxInfo.Runtime.Name, runtimeOptions))

0 commit comments

Comments
 (0)