DEV Community

Kahiro Okina
Kahiro Okina

Posted on

Actions Runner Controller and ArgoCD Integration Guide

Overview

This guide addresses compatibility issues between Actions Runner Controller and ArgoCD, prepared in response to requirements from this PR:
https://github.com/actions/actions-runner-controller/pull/3575#issuecomment-2594906700

1. Create a kind Cluster

kind create cluster --image mirror.gcr.io/kindest/node:v1.32.0 
Enter fullscreen mode Exit fullscreen mode

2. Install ArgoCD

kubectl create namespace argocd kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml 
Enter fullscreen mode Exit fullscreen mode

Note: To access the UI, use port forwarding:

kubectl port-forward svc/argocd-server -n argocd 8080:443 
Enter fullscreen mode Exit fullscreen mode

3. Create GitHub PAT Secret

Execute the following after the namespace is automatically created via ArgoCD Application syncOptions:

kubectl create secret generic github-pat-secret \ -n default \ --from-literal=github_token='<YOUR_PAT>' 
Enter fullscreen mode Exit fullscreen mode

Note: Replace <YOUR_PAT> with your actual Personal Access Token.

4. ArgoCD Application: gha-runner-scale-set-controller

Save the following content as gha-runner-scale-set-controller-app.yaml.
This uses Helm Chart version 0.10.1, specifies the image.repository while using the default tag, and adds excludeLabelPropagationPrefixes array settings:

apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: gha-runner-scale-set-controller namespace: argocd finalizers: - resources-finalizer.argocd.argoproj.io spec: project: default source: repoURL: "ghcr.io/actions/actions-runner-controller-charts" chart: "gha-runner-scale-set-controller" targetRevision: "0.10.1" helm: parameters: - name: image.repository value: "quay.io/kahirokunn/gha-runner-scale-set" - name: githubConfigSecret value: "github-pat-secret" - name: serviceAccount.name value: "gha-runner-scale-set-controller" - name: flags.excludeLabelPropagationPrefixes[0] value: "argocd.argoproj.io/instance" - name: flags.excludeLabelPropagationPrefixes[1] value: "app.kubernetes.io/component" - name: flags.excludeLabelPropagationPrefixes[2] value: "app.kubernetes.io/instance" - name: flags.excludeLabelPropagationPrefixes[3] value: "app.kubernetes.io/managed-by" - name: flags.excludeLabelPropagationPrefixes[4] value: "app.kubernetes.io/name" - name: flags.excludeLabelPropagationPrefixes[5] value: "app.kubernetes.io/part-of" - name: flags.excludeLabelPropagationPrefixes[6] value: "app.kubernetes.io/version" destination: server: "https://kubernetes.default.svc" namespace: arc-systems syncPolicy: automated: prune: true selfHeal: true syncOptions: - CreateNamespace=true - ServerSideApply=true 
Enter fullscreen mode Exit fullscreen mode

After applying, it will look like this:
image.png

5. ArgoCD Application: demo (Runner Scale Set)

Save the following content as gha-runner-scale-set-app.yaml (filename is arbitrary):
This uses Helm Chart version 0.10.1, sets minimum runners to 1, and configures the following Helm parameters:

  • controllerServiceAccount.name: "gha-runner-scale-set-controller"
  • controllerServiceAccount.namespace: "arc-systems"
  • githubConfigSecret: "github-pat-secret"
  • githubConfigUrl: "https://github.com/kahirokunn/actions-runner-controller"
apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: demo namespace: argocd finalizers: - resources-finalizer.argocd.argoproj.io spec: project: default source: repoURL: "ghcr.io/actions/actions-runner-controller-charts" chart: "gha-runner-scale-set" targetRevision: "0.10.1" helm: parameters: - name: minRunners value: "1" - name: controllerServiceAccount.name value: "gha-runner-scale-set-controller" - name: controllerServiceAccount.namespace value: "arc-systems" - name: githubConfigSecret value: "github-pat-secret" - name: githubConfigUrl value: "https://github.com/kahirokunn/actions-runner-controller" destination: server: "https://kubernetes.default.svc" namespace: default syncPolicy: automated: prune: true selfHeal: true syncOptions: - CreateNamespace=true - ServerSideApply=true 
Enter fullscreen mode Exit fullscreen mode

After applying, it will appear in ArgoCD as follows:
image.png

Top comments (0)