Terraform module with GitHub Actions Runner Controller (ARC) deployed via Helm chart. The module is designed to deploy the GitHub Action Runner scale set Controller and a flexible number of GitHub Actions Runner scale sets, including upscale from 0 and downscale to 0.

NOTE: At the moment of writing, for organization runners only classic personal access tokens can be used by accounts outside of the organization.
If you're not an owner of a public repo managed by the runner (or you're not a member of an organization owning the repo), only classic personal access tokens can have write access to such repositories.
Further information can be found in GitHub docs.

Log in to Corewide IaC registry

Once you have a Corewide Solutions Portal account, this one-time action will use your browser session to retrieve credentials:

 shellterraform login solutions.corewide.com
Provision instructions

Initialize mandatory providers:

Copy and paste into your Terraform configuration and insert the variables:

 hclmodule "tf_k8s_github_actions_runner" {
  source  = "solutions.corewide.com/kubernetes/tf-k8s-github-actions-runner/helm"
  version = "~> 5.2.0"

  # specify module inputs here or try one of the examples below
  ...
}

Initialize the setup:

 shellterraform init
Define update strategy

Corewide DevOps team strictly follows Semantic Versioning Specification to provide our clients with products that have predictable upgrades between versions. We recommend pinning patch versions of our modules using pessimistic constraint operator (~>) to prevent breaking changes during upgrades.

To get new features during the upgrades (without breaking compatibility), use ~> 5.2 and run terraform init -upgrade

For the safest setup, use strict pinning with version = "5.2.0"

GitHub Actions Runner stack for Kubernetes

GitHub Actions Runner stack (Controller/Runners) for Kubernetes deployed from Helm chart
Module
30% off
$1,300
$910
TOTAL $910
BUY
v5.2.0 released 1 month, 3 weeks ago
New version approx. every 24 weeks

Terraform module with GitHub Actions Runner Controller (ARC) deployed via Helm chart. The module is designed to deploy the GitHub Action Runner scale set Controller and a flexible number of GitHub Actions Runner scale sets, including upscale from 0 and downscale to 0.

NOTE: At the moment of writing, for organization runners only classic personal access tokens can be used by accounts outside of the organization.
If you're not an owner of a public repo managed by the runner (or you're not a member of an organization owning the repo), only classic personal access tokens can have write access to such repositories.
Further information can be found in GitHub docs.

Deploy the repository runner with mandatory values only:

 hclmodule "runner_controller" {
  source  = "solutions.corewide.com/kubernetes/tf-k8s-github-actions-runner/helm"
  version = "~> 5.2"

  github_runners = {
    my-repo-runner = {
      github_config_url = "https://github.com/repo-owner/repo-name"
      github_token      = "ghp_token"
    }
  }
}

Deploy the organization runner with mandatory values only:

 hclmodule "runner_controller" {
  source  = "solutions.corewide.com/kubernetes/tf-k8s-github-actions-runner/helm"
  version = "~> 5.0"

  github_runners = {
    my-organization-runner = {
      github_config_url = "https://github.com/my-organization"
      github_token      = "ghp_token"
    }
  }
}

Deploy the repository runner with the custom values, name prefix, controller version, node selectors, replicas, service account name, and controller restricted to only watch a single namespace:

 hclmodule "runner_controller" {
  source  = "solutions.corewide.com/kubernetes/tf-k8s-github-actions-runner/helm"
  version = "~> 5.2"

  name_prefix = "foo"

  controller = {
    replicas               = 2
    app_version            = "0.14.2"
    chart_version          = "0.14.2"
    service_account_name   = "bar"
    watch_single_namespace = true

    node_selector = {
      "cluster/node-pool-name" = "biz"
    }

    custom_values = {
      fullnameOverride = "foo"
    }
  }

  github_runners = {
    my-repo-runner = {
      github_config_url = "https://github.com/repo-owner/repo-name"
      github_token      = "ghp_token"
      min_replicas      = 0
      max_replicas      = 3

      node_selector = {
        "cluster/node-pool-name" = "biz-spot"
      }

      listener_node_selector = {
        "cluster/node-pool-name" = "biz"
      }
    }
  }
}

Pipeline example:

 yaml---
name: pipeline
on: 
  push:
   branches: [ my-branch ]
jobs:
  build:
    name: Build Docker
    runs-on: my-scale-set
    steps:
    - name: Checkout
      uses: actions/checkout@v3  

    - name: Build Docker
      run: |
        docker build -t my-docker-image .
Variable Description Type Default Required Sensitive
github_runners[<key>] Name of the runner. Common length of runner name and var.name_prefix with dash must have up to 45 characters and can contain only (\"a-z\", \"0-9\" and \"-\")" string yes no
name_prefix Naming prefix for all the resources created by the module. Must have up to 36 characters long, and can contain only (\"a-z\", \"0-9\" and \"-\") string yes no
controller Set of parameters for the GitHub Actions Runner Controller (ARC) object {} no no
controller.app_version ARC application version string 0.14.2 no no
controller.assign_cluster_role Whether to bind a cluster role to the controller service account bool true no no
controller.chart_version ARC Helm chart version string 0.14.2 no no
controller.cluster_role_name Cluster role name to bind to the controller service account string cluster-admin no no
controller.custom_values Custom values to pass to the scale set controller Helm chart any {} no no
controller.image_pull_secrets Secrets to use for pulling images by runners list(string) [] no no
controller.labels Custom Kubernetes labels for ARC resources map(string) {} no no
controller.node_selector Node selector to place ARC resources in map(string) {} no no
controller.replicas Number of ARC replicas number 1 no no
controller.service_account_name Service Account name to create for runners and controller string github-controller no no
controller.watch_single_namespace Whether the controller must watch only a single namespace for the runner-related custom resources bool false no no
create_namespace Indicates creation of dedicated namespace for GitHub ARC resources bool true no no
github_runners Set of parameters for the GitHub Runners map(object) {} no no
github_runners[<key>].annotations Annotations to be set to the scale set resources map(string) {} no no
github_runners[<key>].container_mode GitHub Runner container mode to use. Possible values are: dind, kubernetes, kubernetes-novolume, and null. If set to kubernetes/null the runner configuration should be applied to the template via custom_values string dind no no
github_runners[<key>].custom_values Custom values to pass to the scale set Helm chart any {} no no
github_runners[<key>].github_config_url GitHub repository or organization URL for which you want to configure runners string yes no
github_runners[<key>].github_token GitHub private access token (PAT classic) suitable for personal API. PAT should be granted full access to repo and admin scopes string yes no
github_runners[<key>].listener_node_selector Node selector to place listener resources in map(string) {} no no
github_runners[<key>].max_replicas Max number of GitHub Runner replicas number 1 no no
github_runners[<key>].min_replicas Min number of GitHub Runner replicas number 1 no no
github_runners[<key>].node_selector Node selector to place runner resources in map(string) {} no no
namespace The namespace to install the GitHub ARC into string github-runner-controller no no
Dependency Version Kind
terraform >= 1.9 CLI
hashicorp/helm ~> 3.1 provider
hashicorp/kubernetes ~> 3.0 provider

These components are included as is under the terms of their corresponding licenses.

Component License
GitHub Actions Runner Controller (ARC) Apache-2.0

Not sure where to start?
Let's find your perfect match.