mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #17202 from brendandburns/fix2
Auto commit by PR queue bot
This commit is contained in:
commit
1334401888
@ -147,6 +147,8 @@ func setupKernelTunables(option KernelTunableBehavior) error {
|
|||||||
desiredState := map[string]int{
|
desiredState := map[string]int{
|
||||||
utilsysctl.VmOvercommitMemory: utilsysctl.VmOvercommitMemoryAlways,
|
utilsysctl.VmOvercommitMemory: utilsysctl.VmOvercommitMemoryAlways,
|
||||||
utilsysctl.VmPanicOnOOM: utilsysctl.VmPanicOnOOMInvokeOOMKiller,
|
utilsysctl.VmPanicOnOOM: utilsysctl.VmPanicOnOOMInvokeOOMKiller,
|
||||||
|
utilsysctl.KernelPanic: utilsysctl.KernelPanicRebootTimeout,
|
||||||
|
utilsysctl.KernelPanicOnOops: utilsysctl.KernelPanicOnOopsAlways,
|
||||||
}
|
}
|
||||||
|
|
||||||
errList := []error{}
|
errList := []error{}
|
||||||
|
@ -44,7 +44,7 @@ func NewFakeDockerManager(
|
|||||||
httpClient kubetypes.HttpGetter, imageBackOff *util.Backoff) *DockerManager {
|
httpClient kubetypes.HttpGetter, imageBackOff *util.Backoff) *DockerManager {
|
||||||
|
|
||||||
fakeOOMAdjuster := oom.NewFakeOOMAdjuster()
|
fakeOOMAdjuster := oom.NewFakeOOMAdjuster()
|
||||||
fakeProcFs := procfs.NewFakeProcFs()
|
fakeProcFs := procfs.NewFakeProcFS()
|
||||||
dm := NewDockerManager(client, recorder, livenessManager, containerRefManager, machineInfo, podInfraContainerImage, qps,
|
dm := NewDockerManager(client, recorder, livenessManager, containerRefManager, machineInfo, podInfraContainerImage, qps,
|
||||||
burst, containerLogsDir, osInterface, networkPlugin, generator, httpClient, &NativeExecHandler{},
|
burst, containerLogsDir, osInterface, networkPlugin, generator, httpClient, &NativeExecHandler{},
|
||||||
fakeOOMAdjuster, fakeProcFs, false, imageBackOff, true)
|
fakeOOMAdjuster, fakeProcFs, false, imageBackOff, true)
|
||||||
|
@ -133,7 +133,7 @@ type DockerManager struct {
|
|||||||
oomAdjuster *oom.OOMAdjuster
|
oomAdjuster *oom.OOMAdjuster
|
||||||
|
|
||||||
// Get information from /proc mount.
|
// Get information from /proc mount.
|
||||||
procFs procfs.ProcFsInterface
|
procFs procfs.ProcFSInterface
|
||||||
|
|
||||||
// If true, enforce container cpu limits with CFS quota support
|
// If true, enforce container cpu limits with CFS quota support
|
||||||
cpuCFSQuota bool
|
cpuCFSQuota bool
|
||||||
@ -158,7 +158,7 @@ func NewDockerManager(
|
|||||||
httpClient kubetypes.HttpGetter,
|
httpClient kubetypes.HttpGetter,
|
||||||
execHandler ExecHandler,
|
execHandler ExecHandler,
|
||||||
oomAdjuster *oom.OOMAdjuster,
|
oomAdjuster *oom.OOMAdjuster,
|
||||||
procFs procfs.ProcFsInterface,
|
procFs procfs.ProcFSInterface,
|
||||||
cpuCFSQuota bool,
|
cpuCFSQuota bool,
|
||||||
imageBackOff *util.Backoff,
|
imageBackOff *util.Backoff,
|
||||||
serializeImagePulls bool) *DockerManager {
|
serializeImagePulls bool) *DockerManager {
|
||||||
|
@ -334,7 +334,7 @@ func NewMainKubelet(
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
procFs := procfs.NewProcFs()
|
procFs := procfs.NewProcFS()
|
||||||
imageBackOff := util.NewBackOff(resyncInterval, MaxContainerBackOff)
|
imageBackOff := util.NewBackOff(resyncInterval, MaxContainerBackOff)
|
||||||
|
|
||||||
klet.livenessManager = proberesults.NewManager()
|
klet.livenessManager = proberesults.NewManager()
|
||||||
|
@ -24,10 +24,10 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ProcFs struct{}
|
type ProcFS struct{}
|
||||||
|
|
||||||
func NewProcFs() ProcFsInterface {
|
func NewProcFS() ProcFSInterface {
|
||||||
return &ProcFs{}
|
return &ProcFS{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func containerNameFromProcCgroup(content string) (string, error) {
|
func containerNameFromProcCgroup(content string) (string, error) {
|
||||||
@ -44,7 +44,7 @@ func containerNameFromProcCgroup(content string) (string, error) {
|
|||||||
// getFullContainerName gets the container name given the root process id of the container.
|
// getFullContainerName gets the container name given the root process id of the container.
|
||||||
// Eg. If the devices cgroup for the container is stored in /sys/fs/cgroup/devices/docker/nginx,
|
// Eg. If the devices cgroup for the container is stored in /sys/fs/cgroup/devices/docker/nginx,
|
||||||
// return docker/nginx. Assumes that the process is part of exactly one cgroup hierarchy.
|
// return docker/nginx. Assumes that the process is part of exactly one cgroup hierarchy.
|
||||||
func (pfs *ProcFs) GetFullContainerName(pid int) (string, error) {
|
func (pfs *ProcFS) GetFullContainerName(pid int) (string, error) {
|
||||||
filePath := path.Join("/proc", strconv.Itoa(pid), "cgroup")
|
filePath := path.Join("/proc", strconv.Itoa(pid), "cgroup")
|
||||||
content, err := ioutil.ReadFile(filePath)
|
content, err := ioutil.ReadFile(filePath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -16,15 +16,15 @@ limitations under the License.
|
|||||||
|
|
||||||
package procfs
|
package procfs
|
||||||
|
|
||||||
type FakeProcFs struct{}
|
type FakeProcFS struct{}
|
||||||
|
|
||||||
func NewFakeProcFs() ProcFsInterface {
|
func NewFakeProcFS() ProcFSInterface {
|
||||||
return &FakeProcFs{}
|
return &FakeProcFS{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// getFullContainerName gets the container name given the root process id of the container.
|
// GetFullContainerName gets the container name given the root process id of the container.
|
||||||
// Eg. If the devices cgroup for the container is stored in /sys/fs/cgroup/devices/docker/nginx,
|
// Eg. If the devices cgroup for the container is stored in /sys/fs/cgroup/devices/docker/nginx,
|
||||||
// return docker/nginx. Assumes that the process is part of exactly one cgroup hierarchy.
|
// return docker/nginx. Assumes that the process is part of exactly one cgroup hierarchy.
|
||||||
func (fakePfs *FakeProcFs) GetFullContainerName(pid int) (string, error) {
|
func (fakePfs *FakeProcFS) GetFullContainerName(pid int) (string, error) {
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ limitations under the License.
|
|||||||
|
|
||||||
package procfs
|
package procfs
|
||||||
|
|
||||||
type ProcFsInterface interface {
|
type ProcFSInterface interface {
|
||||||
// getFullContainerName gets the container name given the root process id of the container.
|
// GetFullContainerName gets the container name given the root process id of the container.
|
||||||
GetFullContainerName(pid int) (string, error)
|
GetFullContainerName(pid int) (string, error)
|
||||||
}
|
}
|
||||||
|
@ -27,9 +27,14 @@ const (
|
|||||||
sysctlBase = "/proc/sys"
|
sysctlBase = "/proc/sys"
|
||||||
VmOvercommitMemory = "vm/overcommit_memory"
|
VmOvercommitMemory = "vm/overcommit_memory"
|
||||||
VmPanicOnOOM = "vm/panic_on_oom"
|
VmPanicOnOOM = "vm/panic_on_oom"
|
||||||
|
KernelPanic = "kernel/panic"
|
||||||
|
KernelPanicOnOops = "kernel/panic_on_oops"
|
||||||
|
|
||||||
VmOvercommitMemoryAlways = 1 // kernel performs no memory over-commit handling
|
VmOvercommitMemoryAlways = 1 // kernel performs no memory over-commit handling
|
||||||
VmPanicOnOOMInvokeOOMKiller = 0 // kernel calls the oom_killer function when OOM occurs
|
VmPanicOnOOMInvokeOOMKiller = 0 // kernel calls the oom_killer function when OOM occurs
|
||||||
|
|
||||||
|
KernelPanicOnOopsAlways = 1 // kernel panics on kernel oops
|
||||||
|
KernelPanicRebootTimeout = 10 // seconds after a panic for the kernel to reboot
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetSysctl returns the value for the specified sysctl setting
|
// GetSysctl returns the value for the specified sysctl setting
|
||||||
|
Loading…
Reference in New Issue
Block a user