Skip to content

infinite-automations/terraform-kubectl-github-actions-runner

Repository files navigation

terraform-kubectl-github-actions-runner

Setup the a GitHub Actions Runner in an existing kubernetes cluster

To setup the runner controller see the actions runner controller module from the terraform-kubectl-github-actions-runner-controller repository.

Module Usage

module "actions_runner" {
  source = "../.."

  repo_owner = "infinite-automations"
  repo_name  = "terraform-kubectl-github-actions-runner"
  labels     = var.labels

  namespace        = "github-actions-runner"
  create_namespace = true

  name                        = "github-actions-runner"
  runner_service_account_name = "github-actions-runner"
  job_service_account_name    = "github-actions-job"

  runner_image = "summerwind/actions-runner:latest"
  ephemeral    = true

  min_count                = 1
  max_count                = 3
  scale_down_delay_seconds = 300
  metrics = [
    {
      type               = "PercentageRunnersBusy"
      scaleUpThreshold   = "0.75"
      scaleDownThreshold = "0.25"
      scaleUpFactor      = "2"
      scaleDownFactor    = "0.5"
    },
    {
      "type"       = "TotalNumberOfQueuedAndInProgressWorkflowRuns"
      "repository" = "infinite-automations/terraform-kubectl-github-actions-runner"
      "name"       = "total"
    }
  ]

  storage_class_name = "standard"
  storage_size       = "100Mi"

  depends_on = [module.actions_runner_controller]
}

Requirements

Name Version
terraform >= 0.13
kubectl >= 1.14.0
kubernetes >= 2.23.0

Providers

Name Version
kubectl >= 1.14.0
kubernetes >= 2.23.0

Resources

Name Type
kubectl_manifest.runner resource
kubectl_manifest.runner_autoscaler resource
kubernetes_config_map.job-template resource
kubernetes_namespace.this resource
kubernetes_role.runner resource
kubernetes_role_binding.runner resource
kubernetes_secret.job resource
kubernetes_secret.runner resource
kubernetes_service_account.job resource
kubernetes_service_account.runner resource

Inputs

Name Description Type Default Required
repo_name The name of the repository string n/a yes
repo_owner The owner of the repository string n/a yes
create_namespace If true, the namespace will be created bool true no
ephemeral If true, the runner will be ephemeral bool true no
job_service_account_name The name of the service account for the job string "github-actions-job" no
labels The labels for the runner list(string)
[
"k8s",
"arc"
]
no
max_count The maximum number of runners number 3 no
metrics The metrics for the runner list(map(string))
[
{
"scaleDownFactor": "0.5",
"scaleDownThreshold": "0.25",
"scaleUpFactor": "2",
"scaleUpThreshold": "0.75",
"type": "PercentageRunnersBusy"
}
]
no
min_count The minimum number of runners number 1 no
name The name of the runner deployment string "github-actions-runner" no
namespace The namespace to deploy the runner controller into string "github-actions-runner" no
runner_image The image for the runner string "summerwind/actions-runner:latest" no
runner_service_account_name The name of the service account for the runner string "github-actions-runner" no
scale_down_delay_seconds The number of seconds from scaling out to wait before scaling down number 300 no
storage_class_name The storage class name for the runner string "default" no
storage_size The storage size for the runner string "100Mi" no

About

Setup the a GitHub Actions Runner in an existing kubernetes cluster

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages