Kubernetes runner: Service does not honor pull policy
Summary
According to https://docs.gitlab.com/ee/ci/yaml/index.html#servicespull_policy setting a pull policy for services is supported, however it does not work.
Steps to reproduce
.gitlab-ci.yml
bug-demo:
services:
- name: postgres:11.6
pull_policy: always
image: alpine:3.19.1
script:
- sleep 5m
Actual behavior
When looking at the pod spawning in our Kubernetes cluster, imagePullPolicy for the service image is set to IfNotPresent
:
image: postgres:11.6
imagePullPolicy: IfNotPresent
name: svc-0
Expected behavior
imagePullPolicy of Always
for the service image
Environment description
GitLab: 16.11.0
on Kubernetes
GitLab Runner: gitlab-runner:alpine-v16.11.0
on Kubernetes
K8s Rev: v1.27.11-eks-b9c9ed7
config.toml contents
gitlab-runner-gp-858c7759f9-8qhlq:/$ cat /configmaps/config.template.toml
# this is a gitlab-runner TEMPLATE_CONFIG file.
# the restrictions here are:
# - only a single runners section
# - no global options
# global options are configured via the helm chart values.
# this file is for handling specific options for the runner executors
[[runners]]
[runners.kubernetes]
image = "buildpack-deps:bullseye-scm"
privileged = false
service_account = "default"
cpu_limit = ""
memory_limit = ""
cpu_request = "3"
memory_request = "6Gi"
image_pull_secrets = ["iris-devops-private-registry-auth"]
poll_timeout = 600
allowed_pull_policies = ["always", "if-not-present"]
pull_policy = ["if-not-present"]
[runners.kubernetes.pod_labels]
app = "gitlab-job"
"velero.io/exclude-from-backup" = "true"
[runners.kubernetes.node_selector]
"ci-runner" = "gp"
[runners.kubernetes.node_tolerations]
"ci-gp=true" = "NoSchedule"
[runners.kubernetes.pod_annotations]
"pod-cleanup.gitlab.com/ttl" = "12h"
"cluster-autoscaler.kubernetes.io/safe-to-evict" = "false"
[runners.cache]
Type = "s3"
Path = "/"
Shared = true
[runners.cache.s3]
BucketName = "iris-devops-gitlab-runner-gp-shared-cache"
BucketLocation = "eu-central-1"
Used GitLab Runner version
gitlab-runner --version
Version: 16.11.0
Git revision: 91a27b2a
Git branch: 16-11-stable
GO version: go1.21.9
Built: 2024-04-18T19:21:08+0000
OS/Arch: linux/arm64
Edited by Jasper Ben Orschulko