Merge pull request #626 from mrunalp/pod_infra_oom
sandbox: Adjust OOM score of infra container to a low value
This commit is contained in:
commit
f3f8b67b76
1 changed files with 12 additions and 0 deletions
|
@ -25,6 +25,14 @@ import (
|
||||||
"k8s.io/kubernetes/pkg/kubelet/network/hostport"
|
"k8s.io/kubernetes/pkg/kubelet/network/hostport"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// PodInfraOOMAdj is the value that we set for oom score adj for
|
||||||
|
// the pod infra container.
|
||||||
|
// TODO: Remove this const once this value is provided over CRI
|
||||||
|
// See https://github.com/kubernetes/kubernetes/issues/47938
|
||||||
|
PodInfraOOMAdj int = -998
|
||||||
|
)
|
||||||
|
|
||||||
// privilegedSandbox returns true if the sandbox configuration
|
// privilegedSandbox returns true if the sandbox configuration
|
||||||
// requires additional host privileges for the sandbox.
|
// requires additional host privileges for the sandbox.
|
||||||
func (s *Server) privilegedSandbox(req *pb.RunPodSandboxRequest) bool {
|
func (s *Server) privilegedSandbox(req *pb.RunPodSandboxRequest) bool {
|
||||||
|
@ -393,6 +401,10 @@ func (s *Server) RunPodSandbox(ctx context.Context, req *pb.RunPodSandboxRequest
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set OOM score adjust of the infra container to be very low
|
||||||
|
// so it doesn't get killed.
|
||||||
|
g.SetLinuxResourcesOOMScoreAdj(PodInfraOOMAdj)
|
||||||
|
|
||||||
hostNetwork := req.GetConfig().GetLinux().GetSecurityContext().GetNamespaceOptions().HostNetwork
|
hostNetwork := req.GetConfig().GetLinux().GetSecurityContext().GetNamespaceOptions().HostNetwork
|
||||||
|
|
||||||
// set up namespaces
|
// set up namespaces
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue