mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-29 21:35:50 +00:00
Merge pull request #27209 from ronnielai/disk-check
Automatic merge from submit-queue Logging for OutOfDisk when file system info is not available #26566 1. Adding logs for file system info being not available. 2. Reporting outOfDisk when file system info is not available.
This commit is contained in:
commit
8f5d081194
@ -2348,21 +2348,23 @@ func hasHostPortConflicts(pods []*api.Pod) bool {
|
|||||||
|
|
||||||
// handleOutOfDisk detects if pods can't fit due to lack of disk space.
|
// handleOutOfDisk detects if pods can't fit due to lack of disk space.
|
||||||
func (kl *Kubelet) isOutOfDisk() bool {
|
func (kl *Kubelet) isOutOfDisk() bool {
|
||||||
outOfDockerDisk := false
|
|
||||||
outOfRootDisk := false
|
|
||||||
// Check disk space once globally and reject or accept all new pods.
|
// Check disk space once globally and reject or accept all new pods.
|
||||||
withinBounds, err := kl.diskSpaceManager.IsRuntimeDiskSpaceAvailable()
|
withinBounds, err := kl.diskSpaceManager.IsRuntimeDiskSpaceAvailable()
|
||||||
// Assume enough space in case of errors.
|
// Assume enough space in case of errors.
|
||||||
if err == nil && !withinBounds {
|
if err != nil {
|
||||||
outOfDockerDisk = true
|
glog.Errorf("Failed to check if disk space is available for the runtime: %v", err)
|
||||||
|
} else if !withinBounds {
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
withinBounds, err = kl.diskSpaceManager.IsRootDiskSpaceAvailable()
|
withinBounds, err = kl.diskSpaceManager.IsRootDiskSpaceAvailable()
|
||||||
// Assume enough space in case of errors.
|
// Assume enough space in case of errors.
|
||||||
if err == nil && !withinBounds {
|
if err != nil {
|
||||||
outOfRootDisk = true
|
glog.Errorf("Failed to check if disk space is available on the root partition: %v", err)
|
||||||
|
} else if !withinBounds {
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
return outOfDockerDisk || outOfRootDisk
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// matchesNodeSelector returns true if pod matches node's labels.
|
// matchesNodeSelector returns true if pod matches node's labels.
|
||||||
|
Loading…
Reference in New Issue
Block a user