mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 21:12:07 +00:00
Configure resource-only container with memory limit
Fixed: #68928 The docker memory limit should base on the memory capacity of machine. Currently CgroupManager specify wrong memory limit.
This commit is contained in:
parent
5dc2c13e74
commit
6af9e97fa5
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user