memory manager: specify the container cpuset.memory during the creation
Set the container cpuset.memory during the creation and avoid an additional call to the resources update of the container. Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
This commit is contained in:
@@ -19,6 +19,9 @@ limitations under the License.
|
||||
package cm
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
|
||||
)
|
||||
@@ -31,5 +34,16 @@ func (i *internalContainerLifecycleImpl) PreCreateContainer(pod *v1.Pod, contain
|
||||
}
|
||||
}
|
||||
|
||||
if i.memoryManager != nil {
|
||||
numaNodes := i.memoryManager.GetMemoryNUMANodes(pod, container)
|
||||
if numaNodes.Len() > 0 {
|
||||
var affinity []string
|
||||
for _, numaNode := range numaNodes.List() {
|
||||
affinity = append(affinity, strconv.Itoa(numaNode))
|
||||
}
|
||||
containerConfig.Linux.Resources.CpusetMems = strings.Join(affinity, ",")
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user