mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
Merge pull request #101708 from joelsmith/master
Fix log spam for du failure on pod etc-hosts metrics
This commit is contained in:
commit
ae3250165a
@ -18,6 +18,7 @@ package stats
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
cadvisorapiv2 "github.com/google/cadvisor/info/v2"
|
cadvisorapiv2 "github.com/google/cadvisor/info/v2"
|
||||||
@ -84,6 +85,10 @@ func (h hostStatsProvider) getPodEtcHostsStats(podUID types.UID, rootFsInfo *cad
|
|||||||
if !isEtcHostsSupported {
|
if !isEtcHostsSupported {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
// Some pods have an explicit /etc/hosts mount and the Kubelet will not create an etc-hosts file for them
|
||||||
|
if _, err := os.Stat(podEtcHostsPath); os.IsNotExist(err) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
metrics := volume.NewMetricsDu(podEtcHostsPath)
|
metrics := volume.NewMetricsDu(podEtcHostsPath)
|
||||||
hostMetrics, err := metrics.GetMetrics()
|
hostMetrics, err := metrics.GetMetrics()
|
||||||
|
Loading…
Reference in New Issue
Block a user