1
0
mirror of https://github.com/containers/podman.git synced 2026-02-05 15:45:08 +01:00

Merge pull request #26174 from fpoirotte/kube_cpuset_cgroup

Support --cpuset-cpus and --cpuset-mems in podman kube play
This commit is contained in:
openshift-merge-bot[bot]
2025-05-30 14:37:57 +00:00
committed by GitHub
5 changed files with 69 additions and 0 deletions

View File

@@ -393,6 +393,28 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener
}
}
if cpuset, ok := annotations[define.CpusetAnnotation+"/"+opts.Container.Name]; ok {
s.Annotations[define.CpusetAnnotation] = cpuset
if s.ResourceLimits == nil {
s.ResourceLimits = &spec.LinuxResources{}
}
if s.ResourceLimits.CPU == nil {
s.ResourceLimits.CPU = &spec.LinuxCPU{}
}
s.ResourceLimits.CPU.Cpus = cpuset
}
if memNodes, ok := annotations[define.MemoryNodesAnnotation+"/"+opts.Container.Name]; ok {
s.Annotations[define.MemoryNodesAnnotation] = memNodes
if s.ResourceLimits == nil {
s.ResourceLimits = &spec.LinuxResources{}
}
if s.ResourceLimits.CPU == nil {
s.ResourceLimits.CPU = &spec.LinuxCPU{}
}
s.ResourceLimits.CPU.Mems = memNodes
}
if label, ok := opts.Annotations[define.InspectAnnotationLabel+"/"+opts.Container.Name]; ok {
if label == "nested" {
s.ContainerSecurityConfig.LabelNested = &localTrue