Skip to content

Add a better handling of signal on both Helper and Build container for k8s executor in exec mode

Romuald Atchadé requested to merge k8s-signal-pid-1-exec-mode into main

What does this MR do?

This MR continues the work started in !4443 (merged) and adds support for the exec mode

Why was this MR needed?

What's the best way to test this MR?

  • k8s integration tests passing locally
  • Any random job which used to pass should still pass
config.toml
concurrent = 1
check_interval = 1
log_level = "debug"
shutdown_timeout = 0

listen_address = ':9252'

[session_server]
  session_timeout = 1800

[[runners]]
  name = ""
  url = "https://gitlab.com/"
  id = 0
  token = "glrt-REDACTED"
  token_obtained_at = "0001-01-01T00:00:00Z"
  token_expires_at = "0001-01-01T00:00:00Z"
  executor = "kubernetes"
  shell = "bash"
  [runners.kubernetes]
    host = ""
    bearer_token_overwrite_allowed = false
    image = "alpine"
    memory_request = "128Mi"
    cpu_request = "1"
    namespace = ""
    namespace_overwrite_allowed = ""
    pod_labels_overwrite_allowed = ""
    service_account_overwrite_allowed = ""
    pod_annotations_overwrite_allowed = ""
    node_selector_overwrite_allowed = ".*"
    allow_privilege_escalation = false
    [[runners.kubernetes.services]]
    [runners.kubernetes.dns_config]
    [runners.kubernetes.pod_labels]
gitlab-ci
variables:
  FF_USE_LEGACY_KUBERNETES_EXECUTION_STRATEGY: "true"
  FF_PRINT_POD_EVENTS: "true"
  FF_USE_POWERSHELL_PATH_RESOLVER: "true"
  FF_SCRIPT_SECTIONS: "true"
  FF_USE_POD_ACTIVE_DEADLINE_SECONDS: "false"
  FF_USE_DUMB_INIT_WITH_KUBERNETES_EXECUTOR: "true"

job:
  image: ubuntu:23.10
  script:
    - sleep 120s

Top extract on the build container

top - 01:36:42 up 32 days,  8:44,  0 user,  load average: 0.22, 0.49, 0.35
Tasks:   7 total,   1 running,   6 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1.4 us,  0.7 sy,  0.0 ni, 97.4 id,  0.4 wa,  0.0 hi,  0.0 si,  0.1 st 
MiB Mem :  16006.2 total,  13142.4 free,   1184.3 used,   2061.4 buff/cache     
MiB Swap:      0.0 total,      0.0 free,      0.0 used.  14821.8 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                                                                                                                                                                                                                                                                                                                                                                                  
      1 root      20   0     220      8      0 S   0.0   0.0   0:00.01 dumb-init                                                                                                                                                                                                                                                                                                                                                                                                                                                
      7 root      20   0    4296   1420   1260 S   0.0   0.0   0:00.00 bash                                                                                                                                                                                                                                                                                                                                                                                                                                                     
      8 root      20   0    4560   3872   3316 S   0.0   0.0   0:00.00 bash                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     16 root      20   0    8876   5088   2888 R   0.0   0.0   0:00.00 top                                                                                                                                                                                                                                                                                                                                                                                                                                                      
     17 root      20   0    4456   3488   3072 S   0.0   0.0   0:00.03 bash                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     26 root      20   0    4588   2764   2212 S   0.0   0.0   0:00.00 bash                                                                                                                                                                                                                                                                                                                                                                                                                                                     
     33 root      20   0    2684   1096    996 S   0.0   0.0   0:00.00 sleep                                                                                                                                                                                                                                                                                                                                                                                                                                                    

What are the relevant issue numbers?

fixes #36996 (closed)

Edited by Romuald Atchadé

Merge request reports