You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Check whether swap is enabled. The Kubelet does not support running with swap enabled.
218
-
swapData, err:=ioutil.ReadFile("/proc/swaps")
218
+
swapFile:="/proc/swaps"
219
+
swapData, err:=ioutil.ReadFile(swapFile)
219
220
iferr!=nil {
220
-
returnnil, err
221
-
}
222
-
swapData=bytes.TrimSpace(swapData) // extra trailing \n
223
-
swapLines:=strings.Split(string(swapData), "\n")
221
+
ifos.IsNotExist(err) {
222
+
klog.Warningf("file %v does not exist, assuming that swap is disabled", swapFile)
223
+
} else {
224
+
returnnil, err
225
+
}
226
+
} else {
227
+
swapData=bytes.TrimSpace(swapData) // extra trailing \n
228
+
swapLines:=strings.Split(string(swapData), "\n")
224
229
225
-
// If there is more than one line (table headers) in /proc/swaps, swap is enabled and we should
226
-
// error out unless --fail-swap-on is set to false.
227
-
iflen(swapLines) >1 {
228
-
returnnil, 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)
230
+
// If there is more than one line (table headers) in /proc/swaps, swap is enabled and we should
231
+
// error out unless --fail-swap-on is set to false.
232
+
iflen(swapLines) >1 {
233
+
returnnil, 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)
0 commit comments