const KubeletOOMScoreAdj … const KubeProxyOOMScoreAdj … const guaranteedOOMScoreAdj … const besteffortOOMScoreAdj … // GetContainerOOMScoreAdjust returns the amount by which the OOM score of all processes in the // container should be adjusted. // The OOM score of a process is the percentage of memory it consumes // multiplied by 10 (barring exceptional cases) + a configurable quantity which is between -1000 // and 1000. Containers with higher OOM scores are killed if the system runs out of memory. // See https://lwn.net/Articles/391222/ for more information. // OOMScoreAdjust should be calculated based on the allocated resources, so the pod argument should // contain the allocated resources in the spec. func GetContainerOOMScoreAdjust(pod *v1.Pod, container *v1.Container, memoryCapacity int64) int { … } // isSidecarContainer returns a boolean indicating whether a container is a sidecar or not. // Since v1.Container does not directly specify whether a container is a sidecar, // this function uses available indicators (container.RestartPolicy == v1.ContainerRestartPolicyAlways) // to make that determination. func isSidecarContainer(pod *v1.Pod, container *v1.Container) bool { … }