Skip to content

Allow user to specify any runner configuraton

Georgi N. Georgiev requested to merge config_template into master

Things to check

Taken from #106 (closed):


Introduce the configuration template, freezing anything new under the runners, something similar to what we did in 717506c7

The template can be passed in runners.config. In the proposal, it's in runners.config.template but I don't think the extra nesting is necessary, just like in 717506c7.


Direct all users to use the configuration template, by updating the docs

See gitlab-org/gitlab-runner!2503 (merged)


Deprecate the runners, if it's possible print a warning message to the user if they are still specifying these values. In GitLab Runner chart 1.0 we remove runners and have the user completely rely on the configuration template.

The best I could come up with is printing a warning if the template isn't being used.


Since command-line arguments take precedence over the template the old values in values.yaml had to be commented out. This led to some other minor changes since some default values couldn't be parsed so I had to surround them with Ifs.

Testing

TIP:

If you get permission errors make sure to either give the proper permissions to the default service account or just allow the chart to create a service account itself:

rbac:
  create: true
  ## Define specific rbac permissions.
  # resources: ["pods", "pods/exec", "secrets"]
  # verbs: ["get", "list", "watch", "create", "patch", "delete"]

  ## Run the gitlab-bastion container with the ability to deploy/manage containers of jobs
  ## cluster-wide or only within namespace
  clusterWideAccess: false

  ## Use the following Kubernetes Service Account name if RBAC is disabled in this Helm chart (see rbac.create)
  ##
  serviceAccountName: runner

Make sure that the template is rendering properly

helm template --values values.yaml .

Make sure that the template config is being passed properly to the final pod

helm install -f values.yaml  --set gitlabUrl=https://gitlab.com,runnerRegistrationToken=<TOKEN> runner .
kubectl get pods| grep runner
kubectl exec -it runner-gitlab-runner-5d4dff5bf7-k8ls7 bash
cat /scripts/config.template.toml

Verify that the pod is running correctly

helm install -f values.yaml --set gitlabUrl=https://gitlab.com,runnerRegistrationToken=<TOKEN> runner .
kubectl get pods| grep runner
kubectl logs -f runner-gitlab-runner-5d4dff5bf7-k8ls7

In the logs you should see Merging configuration from template file "/scripts/config.template.toml"

Try removing the config and making sure that the template doesn't exist

Closes #106 (closed)

Edited by Georgi N. Georgiev

Merge request reports