actions / actions-runner-controller

Kubernetes controller for GitHub Actions self-hosted runners
Apache License 2.0
4.4k stars 1.04k forks source link

Configuring runner pods architecture as arm64 or amd64. #3539

Closed ItsManikantaGopi closed 1 month ago

ItsManikantaGopi commented 1 month ago

While configuring azure arc runners to run github actions, we might have some platform related images, which requires specific architecture like arm64 or amd64.

Is there any way to mention arc runners controller spinning up in k8s cluster, to specify the architecture to the runner pods to be spinning up.

In my case

I have a sql which needs arm64 architecture, Have configured azure arc runners with below configuration.

values.yaml

containerMode:
  type: "dind"

arc.tf

resource "helm_release" "arc" {
  repository = "oci://ghcr.io/actions/actions-runner-controller-charts"
  chart      = "gha-runner-scale-set-controller"
  name       = "arc-controller"
  namespace  = kubernetes_namespace.arc_systems.metadata[0].name
}

resource "helm_release" "arc_runners" {
  namespace  = kubernetes_namespace.arc_systems.metadata[0].name
  repository = "oci://ghcr.io/actions/actions-runner-controller-charts"
  chart      = "gha-runner-scale-set"
  name       = "azure-arc-runners"

  set {
    name  = "githubConfigUrl"
    value = "https://github.com/praja"
  }

  set {
    name  = "githubConfigSecret"
    value = kubernetes_secret.github_secret.metadata[0].name
  }

  set {
    name  = "minRunners"
    value = "0"
  }

  set {
    name  = "maxRunners"
    value = "5"
  }

  set {
    name  = "runnerScaleSetName"
    value = "azure-arc-runners"
  }

  values = [
    templatefile("${path.module}/values.yaml", {})
  ]

}

We have multiple nodes configured with amd64 and arm64 architecture in our k8s cluster in azure.

It is causing some runner pods are being spinning up on amd64 node machine, which is causing our github workflow to fail, due to architecture mismatch of mysql image, we are fetching in the workflow.

So we need to have specific configuration, so that we can specify runner pods to be spinned up on arm64 node machine.

github-actions[bot] commented 1 month ago

Hello! Thank you for filing an issue.

The maintainers will triage your issue shortly.

In the meantime, please take a look at the troubleshooting guide for bug reports.

If this is a feature request, please review our contribution guidelines.

ItsManikantaGopi commented 1 month ago

stack-overflow question

I was able to solve this problem by adding below configuration to the vaules.yaml

template:
  spec:
    nodeSelector:
      "kubernetes.io/arch": arm64

now was able to spin up runner pods on arm64 node machine.

nikola-jokic commented 1 month ago

Hey, the way you solved the problem is the correct way. You have the complete control over the pod template created by ARC. For future reference, enhancements related to gha-runner-scale-set should be submitted to the support forum.

ItsManikantaGopi commented 1 month ago

Hey @nikola-jokic Thanks for confirmation.

I think, it will be helpful for the people, if it is mentioned in documentation, with some simple example.