Merge pull request #68929 from FengyunPan2/fix-memoryLimit

Configure resource-only container with memory limit
This commit is contained in:
k8s-ci-robot 2018-09-27 06:06:39 -07:00 committed by GitHub
commit 12787275f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,8 +101,15 @@ func (m *containerManager) doWork() {
func createCgroupManager(name string) (*fs.Manager, error) {
var memoryLimit uint64
memoryCapacity, err := getMemoryCapacity()
if err != nil || memoryCapacity*dockerMemoryLimitThresholdPercent/100 < minDockerMemoryLimit {
if err != nil {
glog.Errorf("Failed to get the memory capacity on machine: %v", err)
} else {
memoryLimit = memoryCapacity * dockerMemoryLimitThresholdPercent / 100
}
if err != nil || memoryLimit < minDockerMemoryLimit {
memoryLimit = minDockerMemoryLimit
}
glog.V(2).Infof("Configure resource-only container %q with memory limit: %d", name, memoryLimit)