Fixes new golint errors in pkg/kubelet after merge

This commit is contained in:
Yuki Sonoda (Yugui)
2014-07-16 18:46:22 +09:00
parent 07b8be4d4c
commit a702be8e63

View File

@@ -48,8 +48,8 @@ const defaultChanSize = 1024
// taken from lmctfy https://github.com/google/lmctfy/blob/master/lmctfy/controllers/cpu_controller.cc // taken from lmctfy https://github.com/google/lmctfy/blob/master/lmctfy/controllers/cpu_controller.cc
const minShares = 2 const minShares = 2
const sharesPerCpu = 1024 const sharesPerCPU = 1024
const milliCpuToCpu = 1000 const milliCPUToCPU = 1000
// CadvisorInterface is an abstract interface for testability. It abstracts the interface of "github.com/google/cadvisor/client".Client. // CadvisorInterface is an abstract interface for testability. It abstracts the interface of "github.com/google/cadvisor/client".Client.
type CadvisorInterface interface { type CadvisorInterface interface {
@@ -274,9 +274,9 @@ func makePortsAndBindings(container *api.Container) (map[docker.Port]struct{}, m
return exposedPorts, portBindings return exposedPorts, portBindings
} }
func milliCpuToShares(milliCpu int) int { func milliCPUToShares(milliCPU int) int {
// Conceptually (milliCpu / milliCpuToCpu) * sharesPerCpu, but factored to improve rounding. // Conceptually (milliCPU / milliCPUToCPU) * sharesPerCPU, but factored to improve rounding.
shares := (milliCpu * sharesPerCpu) / milliCpuToCpu shares := (milliCPU * sharesPerCPU) / milliCPUToCPU
if shares < minShares { if shares < minShares {
return minShares return minShares
} }
@@ -298,7 +298,7 @@ func (kl *Kubelet) runContainer(manifest *api.ContainerManifest, container *api.
Hostname: container.Name, Hostname: container.Name,
Image: container.Image, Image: container.Image,
Memory: int64(container.Memory), Memory: int64(container.Memory),
CpuShares: int64(milliCpuToShares(container.CPU)), CpuShares: int64(milliCPUToShares(container.CPU)),
Volumes: volumes, Volumes: volumes,
WorkingDir: container.WorkingDir, WorkingDir: container.WorkingDir,
}, },
@@ -864,7 +864,7 @@ func (kl *Kubelet) statsFromContainerPath(containerPath string, req *info.Contai
return cinfo, nil return cinfo, nil
} }
// GetContainerStats returns stats (from Cadvisor) for a container. // GetContainerInfo returns stats (from Cadvisor) for a container.
func (kl *Kubelet) GetContainerInfo(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 { if kl.CadvisorClient == nil {
return nil, nil return nil, nil