Default config (deprecated) of gitlab-runner disrupts explicit non-deprecated config.
Summary
The configuration of the gitlab-runner subchart contain outdated default values that are now deprecated. By having these set by default, environment variables like CACHE_TYPE are defined, which in turn override the new configuration under gitlab-runner.runners.config
.
Here are the GitLab helm chart 4.8.0 defaults.
gitlab-runner:
runners:
cache:
cacheType: s3
s3BucketName: runner-cache
cacheShared: true
s3BucketLocation: us-east-1
s3CachePath: gitlab-runner
s3CacheInsecure: false
Steps to reproduce
helm template gitlab gitlab/gitlab --version v4.8.0 --show-only charts/gitlab-runner/templates/deployment.yaml --set certmanager-issuer.email=dummy | grep -A 1 CACHE_
- name: CACHE_TYPE
value: "s3"
- name: CACHE_PATH
value: "gitlab-runner"
- name: CACHE_SHARED
value: "true"
- name: CACHE_S3_SERVER_ADDRESS
value: "minio.example.com"
- name: CACHE_S3_BUCKET_NAME
value: "runner-cache"
- name: CACHE_S3_BUCKET_LOCATION
value: "us-east-1"
Configuration used
gitlab-runner:
runners:
config: |
[[runners]]
[runners.kubernetes]
image = "ubuntu:18.04"
helper_cpu_request = "100m"
helper_memory_request = "128Mi"
service_cpu_request = "100m"
service_memory_request = "128Mi"
[runners.kubernetes.pod_labels]
component = "gitlab-ci-job"
[runners.kubernetes.node_selector]
role = "ci"
[runners.kubernetes.node_tolerations]
"dedicated_role=ci" = "NoSchedule"
[runners.cache]
Type = "gcs"
Path = "runner"
Shared = true
[runners.cache.gcs]
BucketName = "redacted-bucket-name"
Versions
- Chart: v4.8.0
- Platform:
- Cloud: GKE
- Kubernetes: (
kubectl version
)- Client: v.18.5
- Server: v.17.14
- Helm: (
helm version
)- Client: v3.5.0
Workaround
Forcefully unset the default values.
gitlab-runner:
runners:
cache:
cacheType: null
s3BucketName: null
cacheShared: null
s3BucketLocation: null
s3CachePath: null
s3CacheInsecure: null
Solution
We can stop setting the default values, but if the gitlab helm chart wants such defaults, perhaps we need to provide them in the non-deprecated way of configuring things?
I'm not sure what approach you would like to take here. It is complicated to modify runners.config
because it is a string. There may be a long term solution involving using toToml
to render such string while letting the passed Helm chart configuration be the YAML non-string representation of the TOML to be rendered. Then, you would be able to merge various parts of the configuration but still render a valid TOML file as a final result.
PS: for a longer reflection about these choices in the past and toToml
and the absence of fromToml
etc, see gitlab-runner!153 (comment 218096745).