This module provides an easy way to deploy GitLab Runners on Kubernetes using Terraform. It is designed to replace the functionality of terraform-kubernetes-gitlab-runner while addressing some key limitations.
GitLab has been systematically moving configuration attributes to TOML format. To accommodate this shift and provide a more flexible solution, this new module leverages the Tobotimus/toml
provider. This allows for easier management of TOML configurations within Terraform.
We call this module "lazy" because it uses a simple approach, unlike the more complex solutions in the old project. Here's why:
-
Easy Setup: We keep things consistent between Terraform and GitLab. For example, if GitLab uses camelCase, we use it in Terraform too. This:
- Makes things simpler
- Matches GitLab's own instructions better
- Helps users switch between GitLab's docs and our module easily
-
Straightforward Design: What you put into Terraform is directly reflected in the GitLab Runner setup. This makes it easier to understand and fix if needed.
-
Clear Structure: I've removed unnecessary complications, making the module easier to understand and fix problems.
This "lazy" way focuses on keeping things simple and clear. It makes the module easier to use, especially for people who already know how to set up GitLab Runners.
- Simplified deployment of GitLab Runners on Kubernetes
- Utilizes the
Tobotimus/toml
provider for TOML encoding - Designed to be more adaptable to GitLab's evolving configuration standards
The first stable version of this module is now available (since v0.2.0)! You can find example configurations in the samples
directory.
- Core functionality implementation
- Testing and validation
- Documentation
- Example configurations
- First stable release
We appreciate your interest in this project. If you'd like to contribute or stay updated on its progress, please:
- Star this repository to show your support
- Watch this repository for updates
- Check the Issues tab for current development tasks and known issues
Contributions are welcome! Just write an issue and create a pull request.
Name | Version |
---|---|
terraform | >= 1.8.0 |
helm | >= 2.15.0 |
kubernetes | >= 2.23.0 |
toml | >= 0.3.0 |
Name | Version |
---|---|
helm | 2.15.0 |
No modules.
Name | Type |
---|---|
helm_release.gitlab_runner | resource |
Name | Description | Type | Default | Required |
---|---|---|---|---|
affinity | Affinity for runner pod assignment. | object({ |
{} |
no |
automountServiceAccountToken | Automount service account token in the deployment.. | bool |
false |
no |
certSecretName | Set the certsSecretName in order to pass custom certficates for GitLab Runner to use. | string |
null |
no |
checkInterval | Defines in seconds how often to check GitLab for a new builds. | number |
3 |
no |
concurrent | Configure the maximum number of concurrent jobs | number |
10 |
no |
configMaps | Additional ConfiMaps to be mounted. | map(any) |
null |
no |
connectionMaxAge | Configure GitLab Runner's maximum connection age for TLS keepalive connections. | string |
"15m0s" |
no |
deploymentAnnotations | Annotations to be added to the runner deployment. | map(string) |
{} |
no |
deploymentLabels | Labels to be added to the runner deployment. | map(string) |
{} |
no |
deploymentLifecycle | Configure the lifecycle of the runner deployment. | map(any) |
{} |
no |
envVars | Configure environment variables that will be present when the registration command runs. | list(object({ |
null |
no |
extraEnv | Extra environment variables to be added to the runner pods. | map(string) |
{} |
no |
extraEnvFrom | Additional environment variables from other data sources (k8s secrets). | map(object({ |
{} |
no |
extraObjects | Additional k8s objects to be created. | list(map(any)) |
[] |
no |
fullnameOverride | Override the full name of the k8s resources. | string |
null |
no |
gitlabUrl | The GitLab Server URL (with protocol) that want to register the runner against. | string |
n/a | yes |
helm_settings | The settings for the Helm chart. | object({ |
{} |
no |
hostAliases | List of hosts and IPs that will be injected into the pod's hosts file. | list(object({ |
[] |
no |
hpa | Horizontal Pod Autoscaling with API limited to metrics specification only (api/version: autoscaling/v2). | object({ |
null |
no |
image | The docker gitlab runner image. | object({ |
{} |
no |
imagePullPolicy | Specify the job images pull policy: Never, IfNotPresent, Always. | string |
"IfNotPresent" |
no |
imagePullSecrets | A array of secrets that are used to authenticate Docker image pulling. | list(object({ |
null |
no |
livenessProbe | n/a | object({ |
{} |
no |
logFormat | Specifies the log format. Options are runner, text, and json. This setting has lower priority than the format set by command-line argument --log-format. The default value is runner, which contains ANSI escape codes for coloring. | string |
"runner" |
no |
logLevel | Configure GitLab Runner's logging level. Available values are: debug, info, warn, error, fatal, panic. | string |
"info" |
no |
metrics | Configure integrated Prometheus metrics exporter. | object({ |
{} |
no |
nodeSelector | A map of node selectors to apply to the pods | map(string) |
{} |
no |
podAnnotations | Annotations to be added to the runner pods. | map(string) |
{} |
no |
podLabels | Labels to be added to the runner pods. | map(string) |
{} |
no |
podSecurityContext | Runner ecurity context for the whole POD. | object({ |
{} |
no |
preEntryScript | A custom bash script that will be executed prior to the invocation of the gitlab-runner process | string |
null |
no |
priorityClassName | Configure priorityClassName for the runner pod. If not set, globalDefault priority class is used. | string |
"" |
no |
rbac | RBAC support. | object({ |
{} |
no |
readinessProbe | n/a | object({ |
{} |
no |
replicas | The number of runner pods to create. | number |
1 |
no |
resources | The CPU and memory resources given to the runner. | object({ |
null |
no |
runnerToken | The Runner Token for adding new Runners to the GitLab Server. | string |
n/a | yes |
runners | n/a | object({ |
n/a | yes |
schedulerName | The name of the scheduler to use. | string |
null |
no |
secrets | Secrets to be additionally mounted to the containers. | list(object({ |
[] |
no |
securityContext | Runner container security context. | object({ |
{} |
no |
sentryDsn | Configure GitLab Runner's Sentry DSN. | string |
null |
no |
service | Configure a service resource e.g., to allow scraping metrics via prometheus-operator serviceMonitor. | object({ |
{} |
no |
serviceAccount | The name of the k8s service account to create (since 17.x.x) | object({ |
{} |
no |
sessionServer | Configuration for the session server | object({ |
{} |
no |
shutdown_timeout | Number of seconds until the forceful shutdown operation times out and exits the process. The default value is 30. If set to 0 or lower, the default value is used. | number |
0 |
no |
strategy | Configure update strategy for multi-replica deployments | object({ |
null |
no |
terminationGracePeriodSeconds | When stopping the runner, give it time (in seconds) to wait for its jobs to terminate. | number |
3600 |
no |
tolerations | List of node taints to tolerate by the runner PODs. | list(object({ |
[] |
no |
topologySpreadConstraints | TopologySpreadConstraints for pod assignment. | list(object({ |
null |
no |
unregisterRunners | Unregister runners before termination. | bool |
true |
no |
useTiny | Use the tiny runner image | bool |
false |
no |
values | Additional values to be passed to the gitlab-runner helm chart | map(any) |
{} |
no |
values_file | Path to Values file to be passed to gitlab-runner helm chart | string |
null |
no |
volumeMounts | Additional volumeMounts to add to the runner container. | list(object({ |
[] |
no |
volumes | List of volumes to be attached to the pod | list(object({ |
[] |
no |
Name | Description |
---|---|
helm_release | n/a |
helm_values | n/a |
runners | n/a |
This project is free to use and distribute under the MIT License. See LICENSE for more information.