1. Make kubelet default to 10ms for CPU quota if limit < 10m for

backwards compat.
2. Update documentation to reflect minimum CPU limits.

Signed-off-by: Vishnu kannan <vishnuk@google.com>
This commit is contained in:
Vishnu kannan
2016-03-17 12:10:04 -07:00
parent 6cd8e5c0e6
commit 516559022c
3 changed files with 23 additions and 1 deletions

View File

@@ -50,7 +50,8 @@ const (
milliCPUToCPU = 1000
// 100000 is equivalent to 100ms
quotaPeriod = 100000
quotaPeriod = 100000
minQuotaPerod = 1000
)
// DockerInterface is an abstract interface for testability. It abstracts the interface of docker.Client.
@@ -317,6 +318,11 @@ func milliCPUToQuota(milliCPU int64) (quota int64, period int64) {
// we then convert your milliCPU to a value normalized over a period
quota = (milliCPU * quotaPeriod) / milliCPUToCPU
// quota needs to be a minimum of 1ms.
if quota < minQuotaPerod {
quota = minQuotaPerod
}
return
}