Skip to content

Adapt the Helm Chart to support the next Token Architecture

Romuald Atchadé requested to merge remove-runner-registration-token into main

What does this MR do?

When an Authentication token is provided (prefixed with glrt-), arguments listed below should not the set during the registration:

  • --locked
  • RUNNER_TAG_LIST as envvar
  • --run-untaged
  • --access-level

Why was this MR needed?

To allow support of Authentication Token

What's the best way to test this MR?

Legacy Registration Token

  • Update the values.yaml with the diff below
diff --git a/values.yaml b/values.yaml
index 649295488..c4dff2d44 100644
--- a/values.yaml
+++ b/values.yaml
@@ -58,7 +58,7 @@ imagePullPolicy: IfNotPresent
 ## ref: https://docs.gitlab.com/ce/ci/runners/index.html
 ## ref: https://docs.gitlab.com/runner/register/
 ##
-# runnerRegistrationToken: ""
+runnerRegistrationToken: "xxxxxx"
 
 ## The Runner Token for adding new Runners to the GitLab Server. This must
 ## be retrieved from your GitLab Instance. It is token of already registered runner.
@@ -335,7 +335,7 @@ runners:
 
   ## Specify the name for the runner.
   ##
-  # name: ""
+  name: "my-name"
 
   ## Specify the maximum timeout (in seconds) that will be set for job when using this Runner
   ##
  • From the project folder run
helm template gitlab-runner . -f values.yaml
  • The generated template will have the following info
...
---
# Source: gitlab-runner/templates/configmap.yaml
apiVersion: v1
kind: ConfigMap
...
register-the-runner: |
    #!/bin/bash
    MAX_REGISTER_ATTEMPTS=30

    echo false

    for i in $(seq 1 "${MAX_REGISTER_ATTEMPTS}"); do
      echo "Registration attempt ${i} of ${MAX_REGISTER_ATTEMPTS}"
      /entrypoint register \
        --name="my-name"\
        --template-config /configmaps/config.template.toml \
        --non-interactive
...
---
# Source: gitlab-runner/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
...
        env:
                
        - name: CI_SERVER_URL
          value: 
        - name: RUNNER_EXECUTOR
          value: "kubernetes"
        - name: REGISTER_LOCKED
          value: "true"
        - name: RUNNER_TAG_LIST
          value: ""

Authentication token

  • Update the values.yaml with the diff below
diff --git a/values.yaml b/values.yaml
index 649295488..c4dff2d44 100644
--- a/values.yaml
+++ b/values.yaml
@@ -58,7 +58,7 @@ imagePullPolicy: IfNotPresent
 ## ref: https://docs.gitlab.com/ce/ci/runners/index.html
 ## ref: https://docs.gitlab.com/runner/register/
 ##
-# runnerRegistrationToken: ""
+runnerRegistrationToken: "glrt-"
 
 ## The Runner Token for adding new Runners to the GitLab Server. This must
 ## be retrieved from your GitLab Instance. It is token of already registered runner.
@@ -335,7 +335,7 @@ runners:
 
   ## Specify the name for the runner.
   ##
-  # name: ""
+  name: "my-name"
 
   ## Specify the maximum timeout (in seconds) that will be set for job when using this Runner
   ##
  • From the project folder run
helm template gitlab-runner . -f values.yaml
  • The generated template won't have any references to the arguments we are avoiding

What are the relevant issue numbers?

close #436 (closed)

Edited by Romuald Atchadé

Merge request reports

Loading