Skip to content

Commit

Permalink
fix kubeletSocket scope (#941)
Browse files Browse the repository at this point in the history
The kubeletSocket in the function is scoping the const kubeletSocket
which causing resource api to fail with

"stat /var/lib/kubelet/pod-resources/.sock: no such file or directory"

Signed-off-by: Moshe Levi <moshele@nvidia.com>

Signed-off-by: Moshe Levi <moshele@nvidia.com>
  • Loading branch information
moshe010 authored Oct 26, 2022
1 parent e43ed92 commit f530d3e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/kubeletclient/kubeletclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
)

const (
kubeletSocket = "kubelet" // which is defined in k8s.io/kubernetes/pkg/kubelet/apis/podresources
defaultkubeletSocket = "kubelet" // which is defined in k8s.io/kubernetes/pkg/kubelet/apis/podresources
kubeletConnectionTimeout = 10 * time.Second
defaultKubeletSocketFile = "kubelet.sock"
defaultPodResourcesMaxSize = 1024 * 1024 * 16 // 16 Mb
Expand All @@ -40,7 +40,7 @@ func LocalEndpoint(path, file string) (string, error) {
// GetResourceClient returns an instance of ResourceClient interface initialized with Pod resource information
func GetResourceClient(kubeletSocket string) (types.ResourceClient, error) {
if kubeletSocket == "" {
kubeletSocket, _ = LocalEndpoint(defaultPodResourcesPath, kubeletSocket)
kubeletSocket, _ = LocalEndpoint(defaultPodResourcesPath, defaultkubeletSocket)
}
// If Kubelet resource API endpoint exist use that by default
// Or else fallback with checkpoint file
Expand Down

0 comments on commit f530d3e

Please sign in to comment.