Actions-runner-controller: scaling Enterprise Runners

Created on 9 Apr 2021  ยท  8Comments  ยท  Source: summerwind/actions-runner-controller

Hi Team,

I am trying to autoscale the runners deployed by using below :

apiVersion: actions.summerwind.dev/v1alpha1
kind: HorizontalRunnerAutoscaler
metadata:
  name: example-runner-deployment-autoscaler
spec:
  enterprise: deutsche-bank
  scaleTargetRef:
    name: runnerdeploy
  minReplicas: 2
  maxReplicas: 25
  metrics:
  - type: PercentageRunnersBusy
    scaleUpThreshold: '0.75'   
    scaleDownThreshold: '0.3'  
    scaleUpFactor: '1.4'       
    scaleDownFactor: '0.7'     

while doing so, I am getting error to define enterprise, repo or org (I have set enterprise already) . below is the error

   /go/pkg/mod/k8s.io/[email protected]/pkg/util/wait/wait.go:88                                                           โ”‚
โ”‚ 2021-04-09T05:24:49.455Z    DEBUG    controller-runtime.manager.events    Normal    {"object": {"kind":"HorizontalRunnerAutoscaler","namespace":"default" โ”‚
โ”‚ ,"name":"example-runner-deployment-autoscaler","uid":"f9f64e76-d567-425b-8273-030f2d3a73c0","apiVersion":"actions.summerwind.dev/v1alpha1","resourceVersi โ”‚
โ”‚ on":"42750939"}, "reason": "RunnerAutoscalingFailure", "message": "enterprise, organization and repository are all empty"}                                โ”‚
โ”‚ 2021-04-09T05:24:49.455Z    ERROR    controller-runtime.controller    Reconciler error    {"controller": "horizontalrunnerautoscaler", "request": "defaul โ”‚
โ”‚ t/example-runner-deployment-autoscaler", "error": "enterprise, organization and repository are all empty"}                                                โ”‚
โ”‚ github.com/go-logr/zapr.(*zapLogger).Error   

is it the correct way to scale enterprise runners:

my deployment details are here https://github.com/summerwind/actions-runner-controller/issues/440

All 8 comments

@sandeepraj-chandrakant-bhandari-db Hey! I thought you had to define enterprise within your RunnerDeployment, not HorizontalRunnerAutoscaler.

@mumoshu yes I have it defined already. Still same error:

below is my deployment

kind: RunnerDeployment
metadata:
  name: runnerdeploy
spec:
  replicas: 2
  template:
    spec:
      enterprise: deutsche-bank
      labels:
        - dind
      image: summerwind/actions-runner-dind:latest
      dockerdWithinRunnerContainer: true
      resources:
        limits:
          cpu: "4000m"
          memory: "2Gi"
        requests:
          cpu: "200m"
          memory: "200Mi"
      volumeMounts:
      - mountPath: /runner
        name: runner
      volumes:
      - name: runner
        emptyDir: {}

@sandeepraj-chandrakant-bhandari-db Perhaps you're using an older version of actions-runner-controller? I think it must be 0.18.0 or greateR(highly recommend 0.18.2) for https://github.com/summerwind/actions-runner-controller/commit/f1db6af1c5be66bac1cff02eafbcf894a2bac356 which seems to be needed for autoscaling to work with enterprise runners.

@mumoshu Hey I tried to use 0.18.1 and 0.18.2 versions.

But I was stuck in below issue

  2021-04-09T06:26:09.940Z    ERROR    controller-runtime.controller    Reconciler error    {"controller": "runner-controller", "request": "default/runnerd โ”‚
โ”‚ eploy-6ntnt-blssq", "error": "Pod \"runnerdeploy-6ntnt-blssq\" is invalid: [spec.volumes[1].name: Duplicate value: \"runner\", spec.containers[0].volumeM โ”‚
โ”‚ ounts[1].mountPath: Invalid value: \"/runner\": must be unique]"}   

@sandeepraj-chandrakant-bhandari-db Hey! You must remove the below part from your RunnerDeployment, as those volume and volumeMount are already included in the pod spec generated by the controller

      volumeMounts:
      - mountPath: /runner
        name: runner
      volumes:
      - name: runner
        emptyDir: {}

@mumoshu the example in the https://github.com/summerwind/actions-runner-controller#github-enterprise-support section has the snippet:

      volumeMounts:
      - mountPath: /runner
        name: runner
      volumes:
      - name: runner
        emptyDir: {}

this needs removing if you can't overwrite them in the spec (even if you can this is probably the wrong place in the docs to first introduce that anyway). The example given is not great as it is a fairly complex example considering it is the first time the docs show a RunnerDeployment document at all.

I guess the enterprise RunnerDeployment document should align with the example given in the RunnerDeployment section but with the enterprise bits included as this is a minimal example making it a better introduction to the new kind. That is the enterprise settings are introduced in the general RunnerDeployment section as they really are just a configuration option for the kind.

@callum-tait-pbx Thanks! Ah, good catch! I have never realized that it was there. We should definitely fix it. Agree with the your guess on RunnerDeployment documentation, too.

@mumoshu @callum-tait-pbx Thank you. It works ๐Ÿ‘

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vitobotta picture vitobotta  ยท  7Comments

hdoinfodation picture hdoinfodation  ยท  4Comments

raj-saxena picture raj-saxena  ยท  5Comments

kaykhancheckpoint picture kaykhancheckpoint  ยท  4Comments

rofafor picture rofafor  ยท  4Comments