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.
219
-
swapData, err:=ioutil.ReadFile("/proc/swaps")
219
+
swapFile:="/proc/swaps"
220
+
swapData, err:=ioutil.ReadFile(swapFile)
220
221
iferr!=nil {
221
-
returnnil, err
222
-
}
223
-
swapData=bytes.TrimSpace(swapData) // extra trailing \n
224
-
swapLines:=strings.Split(string(swapData), "\n")
222
+
ifos.IsNotExist(err) {
223
+
klog.Warningf("file %v does not exist, assuming that swap is disabled", swapFile)
224
+
} else {
225
+
returnnil, err
226
+
}
227
+
} else {
228
+
swapData=bytes.TrimSpace(swapData) // extra trailing \n
229
+
swapLines:=strings.Split(string(swapData), "\n")
225
230
226
-
// If there is more than one line (table headers) in /proc/swaps, swap is enabled and we should
227
-
// error out unless --fail-swap-on is set to false.
228
-
iflen(swapLines) >1 {
229
-
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)
231
+
// If there is more than one line (table headers) in /proc/swaps, swap is enabled and we should
232
+
// error out unless --fail-swap-on is set to false.
233
+
iflen(swapLines) >1 {
234
+
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