Skip to content

Commit f33c190

Browse files
authored
refactor: do not use templates/gitlab-runner-values.yaml and set necessary values in the eks-gitlab-runner.tf file (#202)
1 parent 08f189a commit f33c190

File tree

3 files changed

+53
-64
lines changed

3 files changed

+53
-64
lines changed

terraform/layer2-k8s/eks-gitlab-runner.tf

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,59 @@ locals {
44
enabled = local.helm_releases[index(local.helm_releases.*.id, "gitlab-runner")].enabled
55
chart = local.helm_releases[index(local.helm_releases.*.id, "gitlab-runner")].chart
66
repository = local.helm_releases[index(local.helm_releases.*.id, "gitlab-runner")].repository
7-
chart_version = local.helm_releases[index(local.helm_releases.*.id, "gitlab-runner")].version
7+
chart_version = local.helm_releases[index(local.helm_releases.*.id, "gitlab-runner")].chart_version
88
namespace = local.helm_releases[index(local.helm_releases.*.id, "gitlab-runner")].namespace
99
}
10-
gitlab_runner_template = templatefile("${path.module}/templates/gitlab-runner-values.yaml",
11-
{
12-
registration_token = local.gitlab_registration_token
13-
namespace = local.gitlab_runner.enabled ? module.gitlab_runner_namespace[0].name : "default"
14-
role_arn = local.gitlab_runner.enabled ? module.aws_iam_gitlab_runner[0].role_arn : ""
15-
bucket_name = local.gitlab_runner.enabled ? aws_s3_bucket.gitlab_runner_cache[0].id : "bucket_name"
16-
region = local.region
17-
})
10+
gitlab_runner_values = <<VALUES
11+
gitlabUrl: "https://gitlab.com/"
12+
runnerRegistrationToken: "${local.gitlab_registration_token}"
13+
concurrent: 4
14+
checkInterval: 30
15+
16+
rbac:
17+
create: true
18+
clusterWideAccess: true
19+
serviceAccountAnnotations:
20+
eks.amazonaws.com/role-arn: ${local.gitlab_runner.enabled ? module.aws_iam_gitlab_runner[0].role_arn : ""}
21+
22+
runners:
23+
image: ubuntu:18.04
24+
privileged: true
25+
namespace: ${local.gitlab_runner.enabled ? module.gitlab_runner_namespace[0].name : "default"}
26+
tags: "eks-k8s"
27+
runUntagged: false
28+
nodeTolerations:
29+
- key: "nodegroup"
30+
operator: "Equal"
31+
value: "ci"
32+
effect: "NoSchedule"
33+
nodeSelector:
34+
nodegroup: ci
35+
cache:
36+
cacheType: s3
37+
cachePath: "gitlab_runner"
38+
cacheShared: false
39+
s3ServerAddress: s3.amazonaws.com
40+
s3BucketName: ${local.gitlab_runner.enabled ? aws_s3_bucket.gitlab_runner_cache[0].id : "bucket_name"}
41+
s3BucketLocation: ${local.region}
42+
s3CacheInsecure: false
43+
44+
builds:
45+
cpuLimit: 950m
46+
memoryLimit: 2500Mi
47+
cpuRequests: 250m
48+
memoryRequests: 512Mi
49+
services:
50+
cpuLimit: 950m
51+
memoryLimit: 2500Mi
52+
cpuRequests: 250m
53+
memoryRequests: 128Mi
54+
helpers:
55+
cpuLimit: 950m
56+
memoryLimit: 2500Mi
57+
cpuRequests: 250m
58+
memoryRequests: 512Mi
59+
VALUES
1860
}
1961

2062
#tfsec:ignore:kubernetes-network-no-public-egress tfsec:ignore:kubernetes-network-no-public-ingress
@@ -163,7 +205,7 @@ resource "helm_release" "gitlab_runner" {
163205
max_history = var.helm_release_history_size
164206

165207
values = [
166-
local.gitlab_runner_template
208+
local.gitlab_runner_values
167209
]
168210

169211
}

terraform/layer2-k8s/helm-releases.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ releases:
6363
enabled: false
6464
chart: gitlab-runner
6565
repository: https://charts.gitlab.io
66-
version: 0.26.0
66+
chart_version: 0.26.0
6767
namespace: gitlab-runner
6868
- id: ingress-nginx
6969
enabled: true

terraform/layer2-k8s/templates/gitlab-runner-values.yaml

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)