From 754c8d44a7df9706c3d483e2c66f449df0395616 Mon Sep 17 00:00:00 2001 From: Brad Rydzewski Date: Mon, 27 Jan 2020 14:32:12 -0800 Subject: [PATCH] do not override pipeline-defined resource limits --- engine/compiler/compiler.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/engine/compiler/compiler.go b/engine/compiler/compiler.go index 6d12a52..94b59b1 100644 --- a/engine/compiler/compiler.go +++ b/engine/compiler/compiler.go @@ -351,8 +351,15 @@ func (c *Compiler) Compile(ctx context.Context, args runtime.CompilerArgs) runti // append global resource limits to steps for _, step := range spec.Steps { - step.MemSwapLimit = c.Resources.MemorySwap - step.MemLimit = c.Resources.Memory + // the resource limits defined in the yaml currently + // take precedence over global values. This is something + // we should re-think in a future release. + if step.MemSwapLimit != 0 { + step.MemSwapLimit = c.Resources.MemorySwap + } + if step.MemLimit != 0 { + step.MemLimit = c.Resources.Memory + } step.CPUPeriod = c.Resources.CPUPeriod step.CPUQuota = c.Resources.CPUQuota step.CPUShares = c.Resources.CPUShares