mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 06:02:18 +00:00
Kubelet: support retrieving stats using UID of mirror pod
Kubelet supports retrieving stats for pods/containers with and without UID. This does not always work for the static pods because users may get the UIDs of the mirror pods from the API server, and use them to query Kubelet. In this case, Kubelet would fail to locate the containers due to mismatched UIDs. This change adds a intenral mirror to static pod UID mapping and teaches all public-facing functions to perform UID lookup before proceeding. This allows users to use either mirror or static pod's UID to retrieve stats.
This commit is contained in:
@@ -37,7 +37,6 @@ import (
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/httplog"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/types"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/httpstream/spdy"
|
||||
"github.com/golang/glog"
|
||||
@@ -83,7 +82,7 @@ type HostInterface interface {
|
||||
GetRootInfo(req *cadvisorApi.ContainerInfoRequest) (*cadvisorApi.ContainerInfo, error)
|
||||
GetDockerVersion() ([]uint, error)
|
||||
GetCachedMachineInfo() (*cadvisorApi.MachineInfo, error)
|
||||
GetPods() ([]api.Pod, util.StringSet)
|
||||
GetPods() ([]api.Pod, mirrorPods)
|
||||
GetPodByName(namespace, name string) (*api.Pod, bool)
|
||||
GetPodStatus(name string, uid types.UID) (api.PodStatus, error)
|
||||
RunInContainer(name string, uid types.UID, container string, cmd []string) ([]byte, error)
|
||||
|
Reference in New Issue
Block a user