mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Merge pull request #687 from rjnagal/master
Fix handling of default cpu shares.
This commit is contained in:
commit
a21cec0fc4
@ -242,6 +242,10 @@ func makePortsAndBindings(container *api.Container) (map[docker.Port]struct{}, m
|
|||||||
}
|
}
|
||||||
|
|
||||||
func milliCPUToShares(milliCPU int) int {
|
func milliCPUToShares(milliCPU int) int {
|
||||||
|
if milliCPU == 0 {
|
||||||
|
// zero milliCPU means unset. Use kernel default.
|
||||||
|
return 0
|
||||||
|
}
|
||||||
// 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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user