mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-18 16:21:13 +00:00
Merge pull request #126488 from haircommander/cri-stats-suffix-hack
kubelet: don't use cadvisor stats if PodAndContainerStatsFromCRI feature is enabled
This commit is contained in:
commit
7ee17ce9b7
@ -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