mirror of https://github.com/k3s-io/k3s
Skip checking when failSwapOn=false
parent
34001d8c6a
commit
32c265f60c
|
@ -200,19 +200,22 @@ func NewContainerManager(mountUtil mount.Interface, cadvisorInterface cadvisor.I
|
||||||
return nil, fmt.Errorf("failed to get mounted cgroup subsystems: %v", err)
|
return nil, fmt.Errorf("failed to get mounted cgroup subsystems: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether swap is enabled. The Kubelet does not support running with swap enabled.
|
if failSwapOn {
|
||||||
swapData, err := ioutil.ReadFile("/proc/swaps")
|
// Check whether swap is enabled. The Kubelet does not support running with swap enabled.
|
||||||
if err != nil {
|
swapData, err := ioutil.ReadFile("/proc/swaps")
|
||||||
return nil, err
|
if err != nil {
|
||||||
}
|
return nil, err
|
||||||
swapData = bytes.TrimSpace(swapData) // extra trailing \n
|
}
|
||||||
swapLines := strings.Split(string(swapData), "\n")
|
swapData = bytes.TrimSpace(swapData) // extra trailing \n
|
||||||
|
swapLines := strings.Split(string(swapData), "\n")
|
||||||
|
|
||||||
// If there is more than one line (table headers) in /proc/swaps, swap is enabled and we should
|
// If there is more than one line (table headers) in /proc/swaps, swap is enabled and we should
|
||||||
// error out unless --fail-swap-on is set to false.
|
// error out unless --fail-swap-on is set to false.
|
||||||
if failSwapOn && len(swapLines) > 1 {
|
if len(swapLines) > 1 {
|
||||||
return nil, fmt.Errorf("Running with swap on is not supported, please disable swap! or set --fail-swap-on flag to false. /proc/swaps contained: %v", swapLines)
|
return nil, fmt.Errorf("Running with swap on is not supported, please disable swap! or set --fail-swap-on flag to false. /proc/swaps contained: %v", swapLines)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var capacity = v1.ResourceList{}
|
var capacity = v1.ResourceList{}
|
||||||
// It is safe to invoke `MachineInfo` on cAdvisor before logically initializing cAdvisor here because
|
// It is safe to invoke `MachineInfo` on cAdvisor before logically initializing cAdvisor here because
|
||||||
// machine info is computed and cached once as part of cAdvisor object creation.
|
// machine info is computed and cached once as part of cAdvisor object creation.
|
||||||
|
|
Loading…
Reference in New Issue