Allow custom naming of service container for the k8s executor
What does this MR do?
This MR is a take over of the Community contribution !4273 (closed)
When a service is configured and an alias is given, the alias is used as the service name instead of the usual svc-N
Documentation update MRs
Why was this MR needed?
Make it more practical to use pod_spec
on service container as their name is an unique identifier allowing strategic patch strategy
What's the best way to test this MR?
gitlab-ci
variables:
FF_USE_POWERSHELL_PATH_RESOLVER: "true"
FF_RETRIEVE_POD_WARNING_EVENTS: "true"
FF_PRINT_POD_EVENTS: "true"
FF_SCRIPT_SECTIONS: "true"
job:
image: alpine:latest
script: |
sleep 10
services:
- name: alpine:latest
alias: alpine,alpine-latest
- name: alpine:latest
alias: alpine,alpine-latest
- name: mysql:latest
alias: mysql, mysql-latest
- name: mysql:latest
alias: mysql, mysql-latest
config.toml
listen_address = ":9252"
concurrent = 3
check_interval = 1
# log_level = "debug"
log_format = "runner"
connection_max_age = "15m0s"
shutdown_timeout = 0
[session_server]
session_timeout = 1800
[[runners]]
name = "investigation"
limit = 50
url = "https://gitlab.com/"
id = 0
token = "glrt-REDACTED"
token_obtained_at = 2024-09-30T14:38:04.623237Z
executor = "kubernetes"
shell = "bash"
[runners.feature_flags]
FF_USE_ADVANCED_POD_SPEC_CONFIGURATION = true
FF_USE_POD_ACTIVE_DEADLINE_SECONDS = true
FF_PRINT_POD_EVENTS = true
FF_USE_FASTZIP = true
[runners.kubernetes]
host = ""
bearer_token_overwrite_allowed = false
image = ""
namespace = ""
namespace_overwrite_allowed = ""
namespace_per_job = false
privileged = true
node_selector_overwrite_allowed = ".*"
node_tolerations_overwrite_allowed = ""
pod_labels_overwrite_allowed = ""
service_account_overwrite_allowed = ""
[runners.kubernetes.pod_labels]
[[runners.kubernetes.volumes.empty_dir]]
name = "docker-certs"
mount_path = "/certs/client"
medium = "Memory"
[runners.kubernetes.dns_config]
The job will pass and the service container names can be seen in the job log:
[...]
Normal Pulled Successfully pulled image "alpine:latest" in 132ms (132ms including waiting). Image size: 3652536 bytes.
Normal Created Created container alpine <================= Container name : alpine
Normal Started Started container alpine
Normal Pulling Pulling image "alpine:latest"
Normal Pulled Successfully pulled image "alpine:latest" in 116ms (116ms including waiting). Image size: 3652536 bytes.
Normal Created Created container alpine-latest <================= Container name : alpine-latest
Normal Started Started container alpine-latest
Normal Pulling Pulling image "mysql:latest"
Normal Pulled Successfully pulled image "mysql:latest" in 127ms (127ms including waiting). Image size: 241164695 bytes.
Normal Created Created container mysql <================= Container name : mysql
Normal Started Started container mysql
Normal Pulling Pulling image "mysql:latest"
Normal Pulled Successfully pulled image "mysql:latest" in 139ms (139ms including waiting). Image size: 241164695 bytes.
Normal Created Created container mysql-latest <================= Container name : mysql-latest
[...]
What are the relevant issue numbers?
fixes gitlab#421131 (closed)
Edited by Romuald Atchadé