Skip to content

Commit

Permalink
Deploy github actions runner scale set without network policy
Browse files Browse the repository at this point in the history
  • Loading branch information
Valentin Khramtsov committed Aug 16, 2024
1 parent 5a5c2ca commit 4ba9824
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 1 deletion.
78 changes: 78 additions & 0 deletions terraform/modules/k8s-addons/eks-gha-runner-scale-set.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
locals {
gha_runner_scale_set = {
name = local.helm_releases[index(local.helm_releases.*.id, "gha-runner-scale-set")].id
enabled = local.helm_releases[index(local.helm_releases.*.id, "gha-runner-scale-set")].enabled
chart = local.helm_releases[index(local.helm_releases.*.id, "gha-runner-scale-set")].chart
chart_version = local.helm_releases[index(local.helm_releases.*.id, "gha-runner-scale-set")].chart_version
namespace = local.helm_releases[index(local.helm_releases.*.id, "gha-runner-scale-set")].namespace
}

gha_runner_scale_set_values = <<VALUES
githubConfigUrl: "https://github.com/kvvit/actions"
githubConfigSecret:
github_token: "my_super_puper_secret_token"
maxRunners: 5
minRunners: 0
runnerGroup: "default"
# runnerScaleSetName: ""
containerMode:
type: "dind" ## type can be set to dind or kubernetes
template:
spec:
initContainers:
- name: init-dind-externals
image: ghcr.io/actions/actions-runner:latest
command: ["cp", "-r", "-v", "/home/runner/externals/.", "/home/runner/tmpDir/"]
containers:
- name: runner
image: ghcr.io/actions/actions-runner:latest
command: ["/home/runner/run.sh"]
env:
- name: DOCKER_HOST
value: unix:///var/run/docker.sock
volumeMounts:
- name: dind-sock
mountPath: /var/run
- name: dind
image: docker:dind
args:
- dockerd
- --host=unix:///var/run/docker.sock
- --group=$(DOCKER_GROUP_GID)
env:
- name: DOCKER_GROUP_GID
value: "123"
securityContext:
privileged: true
volumeMounts:
- name: dind-sock
mountPath: /var/run
volumes:
- name: dind-sock
emptyDir: {}
controllerServiceAccount:
namespace: arc-system
name: gha-runner-scale-set-controller-gha-rs-controller
VALUES
}

resource "helm_release" "gha_runner_scale_set" {
count = local.gha_runner_scale_set.enabled ? 1 : 0

name = local.gha_runner_scale_set.name
chart = local.gha_runner_scale_set.chart
version = local.gha_runner_scale_set.chart_version
namespace = module.gha_runner_scale_set_controller_namespace[count.index].name
max_history = var.helm_release_history_size

values = [
local.gha_runner_scale_set_values
]
depends_on = [module.gha_runner_scale_set_controller_namespace]
}
8 changes: 7 additions & 1 deletion terraform/modules/k8s-addons/helm-releases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,10 @@ releases:
chart: oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set-controller
repository:
chart_version: 0.9.3
namespace: arc-systems
namespace: github-runner
- id: gha-runner-scale-set
enabled: true
chart: oci://ghcr.io/actions/actions-runner-controller-charts/gha-runner-scale-set
repository:
chart_version: 0.9.3
namespace: github-runner

0 comments on commit 4ba9824

Please sign in to comment.