Pod labels overwrite not being applied
Summary
Overwriting pod labels with pod_labels_overwrite_allowed and KUBERNETES_POD_LABELS_* variables is not working as expected following documentation.
Steps to reproduce
.gitlab-ci.yml
variables:
KUBERNETES_POD_LABELS_1: "Key1=Val1"
KUBERNETES_POD_LABELS_2: "Key2=Val2"
KUBERNETES_POD_LABELS_3: "Key3=Val3"
Actual behavior
Labels from .gitlab-ci.yml are not applied to the job pod.
Expected behavior
Labels from .gitlab-ci.yml are applied to the job pod.
Relevant logs and/or screenshots
job log
"PodLabels" "Key1" overwritten with "Val1" job=__REDACTED__ project=__REDACTED__ runner=__REDACTED__
"PodLabels" "Key2" overwritten with "Val2" job=__REDACTED__ project=__REDACTED__ runner=__REDACTED__
"PodLabels" "Key3" overwritten with "Val3" job=__REDACTED__ project=__REDACTED__ runner=__REDACTED__
kubectl output
kubectl get pods __REDACTED__ --show-labels
NAME READY STATUS RESTARTS AGE LABELS
__REDACTED__ 2/2 Running 0 6s job_id=__REDACTED__,job_name=__REDACTED__,pod=__REDACTED__,project_id=__REDACTED__,release=__REDACTED__
Environment description
config.toml contents
[[runners]]
builds_dir = "/builds"
environment = ["GIT_CLONE_PATH=$CI_BUILDS_DIR/$CI_RUNNER_ID/$CI_CONCURRENT_ID/$CI_PROJECT_NAME"]
[runners.kubernetes]
pod_labels_overwrite_allowed = ".*"
service_account = "gitlab-ci"
namespace = "gitlab-ci"
image = "alpine:latest"
poll_timeout = 720
[runners.kubernetes.pod_labels]
job_id = "$CI_JOB_ID"
job_name = "$CI_JOB_NAME"
project_id = "$CI_PROJECT_ID"
[runners.custom_build_dir]
enabled = true
[runners.cache]
Type = "s3"
Path = "gitlab-ci"
Shared = true
Used GitLab Runner version
command output
Version: 15.1.0
Git revision: 76984217
Git branch: 15-1-stable
GO version: go1.17.7
Built: 2022-06-20T10:10:54+0000
OS/Arch: linux/amd64
Edited by toto