add global resource limmits

This commit is contained in:
Brad Rydzewski
2019-10-29 13:08:42 -07:00
parent 3c1ae23a1e
commit 3761bd0df4
10 changed files with 49 additions and 64 deletions

View File

@@ -41,13 +41,12 @@ var Privileged = []string{
// Resources defines container resource constraints. These
// constraints are per-container, not per-pipeline.
type Resources struct {
MemLimit int64
MemSwapLimit int64
ShmSize int64
CPUQuota int64
CPUPeriod int64
CPUShares int64
CPUSet []string
Memory int64
MemorySwap int64
CPUQuota int64
CPUPeriod int64
CPUShares int64
CPUSet []string
}
// Args provides compiler arguments.
@@ -373,9 +372,8 @@ func (c *Compiler) Compile(ctx context.Context, args Args) *engine.Spec {
// append global resource limits to steps
for _, step := range spec.Steps {
step.MemSwapLimit = c.Resources.MemSwapLimit
step.MemLimit = c.Resources.MemLimit
step.ShmSize = c.Resources.ShmSize
step.MemSwapLimit = c.Resources.MemorySwap
step.MemLimit = c.Resources.Memory
step.CPUPeriod = c.Resources.CPUPeriod
step.CPUQuota = c.Resources.CPUQuota
step.CPUShares = c.Resources.CPUShares