Skip to content

Commit 1d772d2

Browse files
committed
add hard memory limit
1 parent 51c9f26 commit 1d772d2

File tree

8 files changed

+120
-106
lines changed

8 files changed

+120
-106
lines changed

cluster/calcium/create_container.go

+1
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ func (c *calcium) makeContainerOptions(quota map[string]int, specs types.Specs,
593593
}
594594
} else {
595595
resource = enginecontainer.Resources{
596+
Memory: opts.Memory,
596597
CPUPeriod: utils.CpuPeriodBase,
597598
CPUQuota: int64(opts.CPUQuota * float64(utils.CpuPeriodBase)),
598599
Ulimits: ulimits,

cluster/calcium/remove_container.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ func (c *calcium) removeOneContainer(container *types.Container) error {
104104

105105
// if total cpu of container > 0, then we need to release these core resource
106106
// but if it's 0, just ignore to save 1 time write on etcd.
107-
log.WithFields(log.Fields{"nodename": node.Name, "cpumap": container.CPU}).Debugln("Restore node CPU:")
108107
if container.CPU.Total() > 0 {
108+
log.WithFields(log.Fields{"nodename": node.Name, "cpumap": container.CPU}).Debugln("Restore node CPU:")
109109
if err := c.store.UpdateNodeCPU(node.Podname, node.Name, container.CPU, "+"); err != nil {
110110
return err
111111
}

devtools/client.py

+1
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ def create_container(ctx):
210210
entrypoint='web',
211211
cpu_quota=1,
212212
count=2,
213+
memory=0,
213214
networks={'zzz': ''}, # 如果不需要指定IP就写空字符串, 写其他的错误的格式会报错失败
214215
env=['ENV_A=1', 'ENV_B=2'])
215216

devtools/core_pb2.py

+33-26
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)