Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update kubelet package to use most recent cAdvisor's code #480

Merged
merged 2 commits into from
Jul 16, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
gofmt -r "GetContainerStats->GetContainerInfo"
  • Loading branch information
monnand committed Jul 15, 2014
commit 30bc2af9f1bffe0db825e93b9be50334f91bf97b
2 changes: 1 addition & 1 deletion pkg/kubelet/kubelet.go
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ func (kl *Kubelet) statsFromContainerPath(containerPath string, req *info.Contai
}

// GetContainerStats returns stats (from Cadvisor) for a container.
func (kl *Kubelet) GetContainerStats(podID, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error) {
func (kl *Kubelet) GetContainerInfo(podID, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error) {
if kl.CadvisorClient == nil {
return nil, nil
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/kubelet/kubelet_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type KubeletServer struct {
// kubeletInterface contains all the kubelet methods required by the server.
// For testablitiy.
type kubeletInterface interface {
GetContainerStats(podID, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
GetContainerInfo(podID, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
GetMachineStats(req *info.ContainerInfoRequest) (*info.ContainerInfo, error)
GetPodInfo(name string) (api.PodInfo, error)
}
Expand Down Expand Up @@ -133,7 +133,7 @@ func (s *KubeletServer) serveStats(w http.ResponseWriter, req *http.Request) {
// TODO(monnand) Implement this
errors.New("pod level status currently unimplemented")
case 3:
stats, err = s.Kubelet.GetContainerStats(components[1], components[2], &query)
stats, err = s.Kubelet.GetContainerInfo(components[1], components[2], &query)
default:
http.Error(w, "unknown resource.", http.StatusNotFound)
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubelet/kubelet_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (fk *fakeKubelet) GetPodInfo(name string) (api.PodInfo, error) {
return fk.infoFunc(name)
}

func (fk *fakeKubelet) GetContainerStats(podID, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error) {
func (fk *fakeKubelet) GetContainerInfo(podID, containerName string, req *info.ContainerInfoRequest) (*info.ContainerInfo, error) {
return fk.containerStatsFunc(podID, containerName, req)
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/kubelet/kubelet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ func TestGetContainerStats(t *testing.T) {
},
}

stats, err := kubelet.GetContainerStats("qux", "foo", req)
stats, err := kubelet.GetContainerInfo("qux", "foo", req)
if err != nil {
t.Errorf("unexpected error: %v", err)
}
Expand Down Expand Up @@ -1054,7 +1054,7 @@ func TestGetContainerStatsWithoutCadvisor(t *testing.T) {
},
}

stats, _ := kubelet.GetContainerStats("qux", "foo", nil)
stats, _ := kubelet.GetContainerInfo("qux", "foo", nil)
// When there's no cAdvisor, the stats should be either nil or empty
if stats == nil {
return
Expand Down Expand Up @@ -1092,7 +1092,7 @@ func TestGetContainerStatsWhenCadvisorFailed(t *testing.T) {
},
}

stats, err := kubelet.GetContainerStats("qux", "foo", req)
stats, err := kubelet.GetContainerInfo("qux", "foo", req)
if stats != nil {
t.Errorf("non-nil stats on error")
}
Expand All @@ -1113,7 +1113,7 @@ func TestGetContainerStatsOnNonExistContainer(t *testing.T) {
kubelet.CadvisorClient = mockCadvisor
fakeDocker.containerList = []docker.APIContainers{}

stats, _ := kubelet.GetContainerStats("qux", "foo", nil)
stats, _ := kubelet.GetContainerInfo("qux", "foo", nil)
if stats != nil {
t.Errorf("non-nil stats on non exist container")
}
Expand Down