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