Skip to content

Option for Kubernetes executor to not break builds when "cpu_limit_overwrite_max_allowed" is exceeded

Description

We are operating a fleet of runners using the Kubernetes executor (hosted on AWS EKS). In our runner config, we have CPU request override rules set up as follows:

cpu_request_overwrite_max_allowed = "4"

cpu_limit_overwrite_max_allowed = "4"

If now one of our users run jobs with the following config:

job1: [...] variables: KUBERNETES_CPU_REQUEST: "4" KUBERNETES_CPU_LIMIT: "8"

their job fails with CPULimit" requested "8" is higher than limit allowed "4". This in itself is not ideal, as we don't see a reason to break a build just because of an invalid CPU limit. For a CPU request, it certainly makes sense to not accept a value higher than the defined max, but for a limit we don't see the need.

What makes it worse for us is that the limit was added to a pipeline template a while ago and before we added support for overwriting CPU limits in the runner config (via cpu_limit_overwrite_max_allowed). The template is used by many teams who cannot update their configs for compatibility reasons, so we cannot have the setting changed there easily.

Proposal

We'd love to see a warning in the build log instead of an error in such cases. The limit could set to cpu_limit_overwrite_max_allowed in the background and the job being processed normally with that setting. If necessary, an option could be introduced to achieve that, defaulting to the current behavior for compatibility.

Links to related issues and merge requests / references