Unverified Commit 7320a45f authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #57054 from dims/use_cadvisor_constant_cri_endpoint

Automatic merge from submit-queue (batch tested with PRs 56529, 57054). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. kubelet should use the value of the cri container runtime endpoint fr… …om cadvisor **What this PR does / why we need it**: To make cri container runtime endpoint consistent, kubelet (currently using "/var/run/crio.sock" ) should use value of CrioSocket exactly as defined in cadvisor. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes #57005 **Special notes for your reviewer**: **Release note**: ```release-note Use the same value for cri container runtime endpoint as defined in cadivsor/crio ```
parents a54c5fdb 7b4311e5
...@@ -43,7 +43,7 @@ func (i *imageFsInfoProvider) ImageFsInfoLabel() (string, error) { ...@@ -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 ( ...@@ -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 ...@@ -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
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment