mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-23 18:40:53 +00:00
kubelet should use the value of the cri container runtime endpoint from cadvisor
This commit is contained in:
parent
6a633378b3
commit
7b4311e518
@ -43,7 +43,7 @@ func (i *imageFsInfoProvider) ImageFsInfoLabel() (string, error) {
|
|||||||
// This is a temporary workaround to get stats for cri-o from cadvisor
|
// This is a temporary workaround to get stats for cri-o from cadvisor
|
||||||
// and should be removed.
|
// and should be removed.
|
||||||
// Related to https://github.com/kubernetes/kubernetes/issues/51798
|
// Related to https://github.com/kubernetes/kubernetes/issues/51798
|
||||||
if i.runtimeEndpoint == "/var/run/crio.sock" {
|
if i.runtimeEndpoint == CrioSocket {
|
||||||
return cadvisorfs.LabelCrioImages, nil
|
return cadvisorfs.LabelCrioImages, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,12 @@ import (
|
|||||||
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
kubetypes "k8s.io/kubernetes/pkg/kubelet/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Please keep this in sync with the one in:
|
||||||
|
// github.com/google/cadvisor/container/crio/client.go
|
||||||
|
CrioSocket = "/var/run/crio/crio.sock"
|
||||||
|
)
|
||||||
|
|
||||||
func CapacityFromMachineInfo(info *cadvisorapi.MachineInfo) v1.ResourceList {
|
func CapacityFromMachineInfo(info *cadvisorapi.MachineInfo) v1.ResourceList {
|
||||||
c := v1.ResourceList{
|
c := v1.ResourceList{
|
||||||
v1.ResourceCPU: *resource.NewMilliQuantity(
|
v1.ResourceCPU: *resource.NewMilliQuantity(
|
||||||
@ -71,5 +77,5 @@ func EphemeralStorageCapacityFromFsInfo(info cadvisorapi2.FsInfo) v1.ResourceLis
|
|||||||
func UsingLegacyCadvisorStats(runtime, runtimeEndpoint string) bool {
|
func UsingLegacyCadvisorStats(runtime, runtimeEndpoint string) bool {
|
||||||
return runtime == kubetypes.RktContainerRuntime ||
|
return runtime == kubetypes.RktContainerRuntime ||
|
||||||
(runtime == kubetypes.DockerContainerRuntime && goruntime.GOOS == "linux") ||
|
(runtime == kubetypes.DockerContainerRuntime && goruntime.GOOS == "linux") ||
|
||||||
runtimeEndpoint == "/var/run/crio.sock"
|
runtimeEndpoint == CrioSocket
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user