mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 11:50:44 +00:00
Merge pull request #87390 from mattjmcnaughton/mattjmcnaughton/refactor-docker-specific-oom-out-of-qos-pkg
Refactor docker specific oom const out of qos pkg
This commit is contained in:
commit
8af70aeafc
@ -51,7 +51,6 @@ go_library(
|
||||
"//pkg/kubelet/dockershim/network/kubenet:go_default_library",
|
||||
"//pkg/kubelet/kuberuntime:go_default_library",
|
||||
"//pkg/kubelet/leaky:go_default_library",
|
||||
"//pkg/kubelet/qos:go_default_library",
|
||||
"//pkg/kubelet/server/streaming:go_default_library",
|
||||
"//pkg/kubelet/types:go_default_library",
|
||||
"//pkg/kubelet/util/cache:go_default_library",
|
||||
|
@ -18,7 +18,6 @@ go_library(
|
||||
"@io_bazel_rules_go//go/platform:android": [
|
||||
"//pkg/kubelet/cm:go_default_library",
|
||||
"//pkg/kubelet/dockershim/libdocker:go_default_library",
|
||||
"//pkg/kubelet/qos:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
||||
"//vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs:go_default_library",
|
||||
@ -40,7 +39,6 @@ go_library(
|
||||
"@io_bazel_rules_go//go/platform:linux": [
|
||||
"//pkg/kubelet/cm:go_default_library",
|
||||
"//pkg/kubelet/dockershim/libdocker:go_default_library",
|
||||
"//pkg/kubelet/qos:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",
|
||||
"//vendor/github.com/opencontainers/runc/libcontainer/cgroups/fs:go_default_library",
|
||||
|
@ -31,7 +31,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/klog"
|
||||
kubecm "k8s.io/kubernetes/pkg/kubelet/cm"
|
||||
"k8s.io/kubernetes/pkg/kubelet/qos"
|
||||
|
||||
"k8s.io/kubernetes/pkg/kubelet/dockershim/libdocker"
|
||||
)
|
||||
@ -45,8 +44,10 @@ const (
|
||||
// The minimum memory limit allocated to docker container: 150Mi
|
||||
minDockerMemoryLimit = 150 * 1024 * 1024
|
||||
|
||||
// The Docker OOM score adjustment.
|
||||
dockerOOMScoreAdj = qos.DockerOOMScoreAdj
|
||||
// The OOM score adjustment for the docker process (i.e. the docker
|
||||
// daemon). Essentially, makes docker very unlikely to experience an oom
|
||||
// kill.
|
||||
dockerOOMScoreAdj = -999
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -34,7 +34,6 @@ import (
|
||||
"k8s.io/kubernetes/pkg/kubelet/checkpointmanager/errors"
|
||||
kubecontainer "k8s.io/kubernetes/pkg/kubelet/container"
|
||||
"k8s.io/kubernetes/pkg/kubelet/dockershim/libdocker"
|
||||
"k8s.io/kubernetes/pkg/kubelet/qos"
|
||||
"k8s.io/kubernetes/pkg/kubelet/types"
|
||||
)
|
||||
|
||||
@ -44,6 +43,13 @@ const (
|
||||
// Various default sandbox resources requests/limits.
|
||||
defaultSandboxCPUshares int64 = 2
|
||||
|
||||
// defaultSandboxOOMAdj is the oom score adjustment for the docker
|
||||
// sandbox container. Using this OOM adj makes it very unlikely, but not
|
||||
// impossible, that the defaultSandox will experience an oom kill. -998
|
||||
// is chosen to signify sandbox should be OOM killed before other more
|
||||
// vital processes like the docker daemon, the kubelet, etc...
|
||||
defaultSandboxOOMAdj int = -998
|
||||
|
||||
// Name of the underlying container runtime
|
||||
runtimeName = "docker"
|
||||
)
|
||||
@ -643,8 +649,7 @@ func (ds *dockerService) makeSandboxDockerConfig(c *runtimeapi.PodSandboxConfig,
|
||||
createConfig.Config.ExposedPorts = exposedPorts
|
||||
hc.PortBindings = portBindings
|
||||
|
||||
// TODO: Get rid of the dependency on kubelet internal package.
|
||||
hc.OomScoreAdj = qos.PodInfraOOMAdj
|
||||
hc.OomScoreAdj = defaultSandboxOOMAdj
|
||||
|
||||
// Apply resource options.
|
||||
if err := ds.applySandboxResources(hc, c.GetLinux()); err != nil {
|
||||
|
@ -23,15 +23,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
// PodInfraOOMAdj is very docker specific. For arbitrary runtime, it may not make
|
||||
// sense to set sandbox level oom score, e.g. a sandbox could only be a namespace
|
||||
// without a process.
|
||||
// TODO: Handle infra container oom score adj in a runtime agnostic way.
|
||||
PodInfraOOMAdj int = -998
|
||||
// KubeletOOMScoreAdj is the OOM score adjustment for Kubelet
|
||||
KubeletOOMScoreAdj int = -999
|
||||
// DockerOOMScoreAdj is the OOM score adjustment for Docker
|
||||
DockerOOMScoreAdj int = -999
|
||||
// KubeProxyOOMScoreAdj is the OOM score adjustment for kube-proxy
|
||||
KubeProxyOOMScoreAdj int = -999
|
||||
guaranteedOOMScoreAdj int = -998
|
||||
|
Loading…
Reference in New Issue
Block a user