Skip to content

Commit 3af50cc

Browse files
authored
Feat/decouple-system (#30)
* feat: decouple the runner and controller * fix docker runner path
1 parent 46f6f5f commit 3af50cc

File tree

4 files changed

+65
-9
lines changed

4 files changed

+65
-9
lines changed

modules/gha-runner-scale-set/main.tf

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ locals {
3030
github_app_private_key = var.github_app_private_key
3131
github_token = var.github_token
3232

33-
container_mode_type = var.container_mode_type
34-
template_spec = yamlencode(var.custom_podspec_map)
33+
container_mode_type = var.container_mode_type
34+
listener_template_spec = yamlencode(var.listener_podspec_map)
35+
template_spec = yamlencode(var.custom_podspec_map)
36+
controller_service_account = yamlencode(var.controller_service_account)
3537
}
3638

3739
}

modules/gha-runner-scale-set/templates/values.yaml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,25 @@ containerMode:
8585
# storage: 1Gi
8686
%{ endif }
8787

88+
## template is the PodSpec for each listener Pod
89+
## For reference: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodSpec
90+
listenerTemplate:
91+
${indent(2,listener_template_spec)}
92+
# listenerTemplate:
93+
# spec:
94+
# containers:
95+
# # Use this section to append additional configuration to the listener container.
96+
# # If you change the name of the container, the configuration will not be applied to the listener,
97+
# # and it will be treated as a side-car container.
98+
# - name: listener
99+
# securityContext:
100+
# runAsUser: 1000
101+
# # Use this section to add the configuration of a side-car container.
102+
# # Comment it out or remove it if you don't need it.
103+
# # Spec for this container will be applied as is without any modifications.
104+
# - name: side-car
105+
# image: example-sidecar
106+
88107
## template is the PodSpec for each runner Pod
89108
%{ if container_mode_type == "" }
90109
template:
@@ -173,6 +192,7 @@ template:
173192
## In case the helm chart can't find the right service account, you can explicitly pass in the following value
174193
## to help it finish RoleBinding with the right service account.
175194
## Note: if your controller is installed to only watch a single namespace, you have to pass these values explicitly.
176-
# controllerServiceAccount:
195+
controllerServiceAccount:
196+
${indent(2,controller_service_account)}
177197
# namespace: arc-system
178198
# name: test-arc-gha-runner-scale-set-controller

modules/gha-runner-scale-set/variables.tf

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ variable "chart_version" {
2828
variable "chart_namespace" {
2929
description = "Namespace to install the chart into."
3030
type = string
31-
default = "arc-systems"
31+
default = "arc-runners"
3232
}
3333

3434
variable "chart_namespace_create" {
@@ -123,6 +123,31 @@ variable "runner_scale_set_name" {
123123
default = "arc-runner-set"
124124
}
125125

126+
variable "listener_podspec_map" {
127+
description = "Listener podspec map"
128+
type = object({
129+
metadata = any
130+
spec = any
131+
})
132+
default = {
133+
metadata = {
134+
annotations = {
135+
"prometheus.io/scrape" = "true"
136+
"prometheus.io/path" = "/metrics"
137+
"prometheus.io/port" = "8080"
138+
}
139+
labels = {}
140+
}
141+
spec = {
142+
containers = [
143+
{
144+
name = "listener"
145+
}
146+
]
147+
}
148+
}
149+
}
150+
126151
# Default spec map for dind container mode
127152
variable "custom_podspec_map" {
128153
description = "Custom podspec map"
@@ -166,7 +191,7 @@ variable "custom_podspec_map" {
166191
env = [
167192
{
168193
name = "DOCKER_HOST",
169-
value = "unix:///run/docker/docker.sock"
194+
value = "unix:///var/run/docker.sock"
170195
}
171196
],
172197
volumeMounts = [
@@ -176,15 +201,15 @@ variable "custom_podspec_map" {
176201
},
177202
{
178203
name = "dind-sock",
179-
mountPath = "/run/docker",
204+
mountPath = "/var/run",
180205
readOnly = true
181206
}
182207
]
183208
},
184209
{
185210
name = "dind",
186211
image = "docker:dind",
187-
args = ["dockerd", "--host=unix:///run/docker/docker.sock", "--group=$(DOCKER_GROUP_GID)"],
212+
args = ["dockerd", "--host=unix:///var/run/docker.sock", "--group=$(DOCKER_GROUP_GID)"],
188213
env = [
189214
{
190215
name = "DOCKER_GROUP_GID",
@@ -228,3 +253,12 @@ variable "custom_podspec_map" {
228253
}
229254

230255
}
256+
257+
variable "controller_service_account" {
258+
description = "Service account for the controller."
259+
type = map(any)
260+
default = {
261+
namespace = "arc-systems"
262+
name = "actions-runner-controller"
263+
}
264+
}

variables.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
variable "action_runner_scale_set_controller_chart_version" {
22
description = "ARC Controller chart version"
33
type = string
4-
default = "0.6.1"
4+
default = "0.9.3"
55
}
66

77
variable "action_runner_scale_set_chart_version" {
88
description = "ARC Scale set chart version"
99
type = string
10-
default = "0.6.1"
10+
default = "0.9.3"
1111
}
1212

1313
variable "controller_helm_release_name" {

0 commit comments

Comments
 (0)