mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 12:32:03 +00:00
kubelet: don't use cadvisor stats if PodAndContainerStatsFromCRI feature is enabled
As the feature mitigates the limitations of CRI stats provider for CRI-O Signed-off-by: Peter Hunt <pehunt@redhat.com>
This commit is contained in:
parent
eb729d1db7
commit
3d3ba6f898
@ -23,7 +23,9 @@ import (
|
||||
cadvisorapi2 "github.com/google/cadvisor/info/v2"
|
||||
"k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
v1helper "k8s.io/kubernetes/pkg/apis/core/v1/helper"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -73,5 +75,11 @@ func EphemeralStorageCapacityFromFsInfo(info cadvisorapi2.FsInfo) v1.ResourceLis
|
||||
// be removed. Related issue:
|
||||
// https://github.com/kubernetes/kubernetes/issues/51798
|
||||
func UsingLegacyCadvisorStats(runtimeEndpoint string) bool {
|
||||
// If PodAndContainerStatsFromCRI feature is enabled, then assume the user
|
||||
// wants to use CRI stats, as the aforementioned workaround isn't needed
|
||||
// when this feature is enabled.
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.PodAndContainerStatsFromCRI) {
|
||||
return false
|
||||
}
|
||||
return strings.HasSuffix(runtimeEndpoint, CrioSocketSuffix)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user