Skip to content

Fix millicpu comparison for maxOverwrite

What does this MR do?

  • Fix millicpu comparison for maxOverwrite
  • Update error message to be more clear

Why was this MR needed?

Users can set KUBERNETES_CPU_LIMIT to 600m whilst cpu_limit_overwrite_max_allowed was set to 400m which allows the user to use more resources than allowed. More detail in #25409 (closed)

Testing

config.toml
[[runners]]
  name = "kubernetes"
  url = "http://192.168.144.160:3000"
  token = "xxxx"
  executor = "kubernetes"
  [runners.kubernetes]
    image = "alpine:3.11"
    privileged = true
    bearer_token = ""
    namespace = "default"
    namespace_overwrite_allowed = ""
    cpu_limit = "200m"
    cpu_limit_overwrite_max_allowed = "400m"
    memory_limit = "256Mi"
    memory_limit_overwrite_max_allowed = "512Mi"
    cpu_request = "100m"
    cpu_request_overwrite_max_allowed = "200m"
    memory_request = "128Mi"
    memory_request_overwrite_max_allowed = "256Mi"
    poll_timeout = 180
.gitlab-ci.yml
variables:
  IMAGE: alpine:3.11
  
job:
  variables:
    KUBERNETES_CPU_REQUEST: 400m
    KUBERNETES_CPU_LIMIT: 600m
    KUBERNETES_MEMORY_REQUEST: 500Mi
    KUBERNETES_MEMORY_LIMIT: 4Gi
  image: ${IMAGE}
  script:
  - echo -n "things are breaking"

Before

Screen_Shot_2020-04-17_at_11.00.33

After

Screen_Shot_2020-04-17_at_11.02.26

Does this MR meet the acceptance criteria?

  • Documentation created/updated
  • Added tests for this feature/bug
  • In case of conflicts with master - branch was rebased

What are the relevant issue numbers?

Closes #25409 (closed)

Merge request reports

Loading