-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploy github actions runner scale set without network policy
- Loading branch information
Valentin Khramtsov
committed
Aug 16, 2024
1 parent
5a5c2ca
commit 4ba9824
Showing
2 changed files
with
85 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters