Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 52 additions & 10 deletions terraform/layer2-k8s/eks-gitlab-runner.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,59 @@ locals {
enabled = local.helm_releases[index(local.helm_releases.*.id, "gitlab-runner")].enabled
chart = local.helm_releases[index(local.helm_releases.*.id, "gitlab-runner")].chart
repository = local.helm_releases[index(local.helm_releases.*.id, "gitlab-runner")].repository
chart_version = local.helm_releases[index(local.helm_releases.*.id, "gitlab-runner")].version
chart_version = local.helm_releases[index(local.helm_releases.*.id, "gitlab-runner")].chart_version
namespace = local.helm_releases[index(local.helm_releases.*.id, "gitlab-runner")].namespace
}
gitlab_runner_template = templatefile("${path.module}/templates/gitlab-runner-values.yaml",
{
registration_token = local.gitlab_registration_token
namespace = local.gitlab_runner.enabled ? module.gitlab_runner_namespace[0].name : "default"
role_arn = local.gitlab_runner.enabled ? module.aws_iam_gitlab_runner[0].role_arn : ""
bucket_name = local.gitlab_runner.enabled ? aws_s3_bucket.gitlab_runner_cache[0].id : "bucket_name"
region = local.region
})
gitlab_runner_values = <<VALUES
gitlabUrl: "https://gitlab.com/"
runnerRegistrationToken: "${local.gitlab_registration_token}"
concurrent: 4
checkInterval: 30

rbac:
create: true
clusterWideAccess: true
serviceAccountAnnotations:
eks.amazonaws.com/role-arn: ${local.gitlab_runner.enabled ? module.aws_iam_gitlab_runner[0].role_arn : ""}

runners:
image: ubuntu:18.04
privileged: true
namespace: ${local.gitlab_runner.enabled ? module.gitlab_runner_namespace[0].name : "default"}
tags: "eks-k8s"
runUntagged: false
nodeTolerations:
- key: "nodegroup"
operator: "Equal"
value: "ci"
effect: "NoSchedule"
nodeSelector:
nodegroup: ci
cache:
cacheType: s3
cachePath: "gitlab_runner"
cacheShared: false
s3ServerAddress: s3.amazonaws.com
s3BucketName: ${local.gitlab_runner.enabled ? aws_s3_bucket.gitlab_runner_cache[0].id : "bucket_name"}
s3BucketLocation: ${local.region}
s3CacheInsecure: false

builds:
cpuLimit: 950m
memoryLimit: 2500Mi
cpuRequests: 250m
memoryRequests: 512Mi
services:
cpuLimit: 950m
memoryLimit: 2500Mi
cpuRequests: 250m
memoryRequests: 128Mi
helpers:
cpuLimit: 950m
memoryLimit: 2500Mi
cpuRequests: 250m
memoryRequests: 512Mi
VALUES
}

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

values = [
local.gitlab_runner_template
local.gitlab_runner_values
]

}
Expand Down
2 changes: 1 addition & 1 deletion terraform/layer2-k8s/helm-releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ releases:
enabled: false
chart: gitlab-runner
repository: https://charts.gitlab.io
version: 0.26.0
chart_version: 0.26.0
namespace: gitlab-runner
- id: ingress-nginx
enabled: true
Expand Down
53 changes: 0 additions & 53 deletions terraform/layer2-k8s/templates/gitlab-runner-values.yaml

This file was deleted.