Add a kubelet /runningpods endpoint

/runningpods returns a list of pods currently running on the kubelet. The list
is composed by examining the container runtime, and may be different from the
desired pods to run known by kubelet.

This is useful for tests to verify that pods are indeed deleted on nodes.
This commit is contained in:
Yu-Ju Hong
2015-06-23 16:01:12 -07:00
parent 819b78087c
commit de75a42cb2
4 changed files with 71 additions and 4 deletions

View File

@@ -47,6 +47,7 @@ type fakeKubelet struct {
rawInfoFunc func(query *cadvisorApi.ContainerInfoRequest) (map[string]*cadvisorApi.ContainerInfo, error)
machineInfoFunc func() (*cadvisorApi.MachineInfo, error)
podsFunc func() []*api.Pod
runningPodsFunc func() ([]*api.Pod, error)
logFunc func(w http.ResponseWriter, req *http.Request)
runFunc func(podFullName string, uid types.UID, containerName string, cmd []string) ([]byte, error)
containerVersionFunc func() (kubecontainer.Version, error)
@@ -91,6 +92,10 @@ func (fk *fakeKubelet) GetPods() []*api.Pod {
return fk.podsFunc()
}
func (fk *fakeKubelet) GetRunningPods() ([]*api.Pod, error) {
return fk.runningPodsFunc()
}
func (fk *fakeKubelet) ServeLogs(w http.ResponseWriter, req *http.Request) {
fk.logFunc(w, req)
}