Actions-runner-controller: spec.replicas in body must be of type integer: "null"

Created on 30 Jun 2020  路  10Comments  路  Source: summerwind/actions-runner-controller

I'm trying to create an autoscaling RunnerDeployment, but kubernetes won't let me unless I set the replicas value. I've barely modified the example in the README.

apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
  name: github-actions-runner
spec:
  minReplicas: 1
  maxReplicas: 5
  template:
    spec:
      organization: ORGNAME

When I run kubectl apply -f filename.yml, I get this error:

The RunnerDeployment "github-actions-runner" is invalid: spec.replicas: Invalid value: "null": spec.replicas in body must be of type integer: "null"

replicas seems to be defined as optional in runnerdeployment_types.go, why is this happening?

Most helpful comment

I'm seeing similar behavior The error I get is the following:
2020-08-24T18:56:13.717Z ERROR controller-runtime.controller Reconciler error {"controller": "runnerdeployment", "request": "actions-runner-system/runnerdeployment-gitops", "error": "RunnerReplicaSet.actions.summerwind.dev \"runnerdeployment-gitops-pqsns\" is invalid: spec.replicas: Invalid value: \"null\": spec.replicas in body must be of type integer: \"null\""}

I have deployed the RunnerDeployment on v0.7.2 as follows:

apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
  name: runnerdeployment-gitops
  namespace: actions-runner-system
spec:
  template:
    spec:
      repository: bjw-s/k8s-gitops
      image: onedr0p/actions-runnner:latest
      env: []
---
apiVersion: actions.summerwind.dev/v1alpha1
kind: HorizontalRunnerAutoscaler
metadata:
  name: runnerdeployment-gitops-autoscaler
spec:
  scaleTargetRef:
    name: runnerdeployment-gitops
    namespace: actions-runner-system
  minReplicas: 1
  maxReplicas: 3
  metrics:
    - type: TotalNumberOfQueuedAndInProgressWorkflowRuns
      repositoryNames:
        - bjw-s/k8s-gitops

All 10 comments

@pedrofracassi Hey! How did you installed the CRD and the actions-runner-controller?

I thought that error happen when either your CRD or actions-runner-controller is outdated(i.e. coming from releases older than 0.6.0)

I installed it with the manifest available on the README: kubectl apply -f https://github.com/summerwind/actions-runner-controller/releases/latest/download/actions-runner-controller.yaml

@pedrofracassi Thanks! But I couldn't reproduce it:

$ kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v0.15.1/cert-manager.yaml

$ k apply -f https://github.com/summerwind/actions-runner-controller/releases/latest/download/actions-runner-controller.yaml

$ kubectl create secret generic controller-manager \
    -n actions-runner-system \
    --from-literal=github_token=${GITHUB_TOKEN}
secret/controller-manager created

$ pbpaste
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
  name: github-actions-runner
spec:
  minReplicas: 1
  maxReplicas: 5
  template:
    spec:
      organization: ORGNAME

$ pbpaste | k apply -f -
runnerdeployment.actions.summerwind.dev/github-actions-runner created

DId you have old CRDs and/or actions-runner-controller installed onto your cluster? If so, could you trying deleting them and reinstalling it?

Also, I missed organization: ORGNAME in your config. Unfortunately, autoscaling(implied by min/max replicas) does not support organizational runners yet. GitHub doesn't provide a convenient API for that yet so I couldn't come up with a solution while I was authoring #57

JFYI I've already started an initial attempt for autoscaling organizational runners at #66. You can test it by building the image yourseful with NAME=your-docker-registry/actions-runner-controller make docker-build docker-push and updating the controller deployment with kubectl set image.

I'm seeing similar behavior The error I get is the following:
2020-08-24T18:56:13.717Z ERROR controller-runtime.controller Reconciler error {"controller": "runnerdeployment", "request": "actions-runner-system/runnerdeployment-gitops", "error": "RunnerReplicaSet.actions.summerwind.dev \"runnerdeployment-gitops-pqsns\" is invalid: spec.replicas: Invalid value: \"null\": spec.replicas in body must be of type integer: \"null\""}

I have deployed the RunnerDeployment on v0.7.2 as follows:

apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
  name: runnerdeployment-gitops
  namespace: actions-runner-system
spec:
  template:
    spec:
      repository: bjw-s/k8s-gitops
      image: onedr0p/actions-runnner:latest
      env: []
---
apiVersion: actions.summerwind.dev/v1alpha1
kind: HorizontalRunnerAutoscaler
metadata:
  name: runnerdeployment-gitops-autoscaler
spec:
  scaleTargetRef:
    name: runnerdeployment-gitops
    namespace: actions-runner-system
  minReplicas: 1
  maxReplicas: 3
  metrics:
    - type: TotalNumberOfQueuedAndInProgressWorkflowRuns
      repositoryNames:
        - bjw-s/k8s-gitops

@pedrofracassi @bjw-s @callum-tait-pbx @droidpl Thank you so much for reporting and sorry for the delay. This seems to have buried in time...

Finally, I've managed to fix this in #186. It's released as part of v0.11.3.
Would you mind testing it out?

@mumoshu Worked for me 馃憤 . Deployed with replicas ommitted on the RunnerDeployment and it deployed fine spawning 1 runner. I also did an upgrade setting the minReplicas to 5 whilst still ommitting the replicas key and it span up the additional runners fine. I did still get that Failed to check if runner is busy https://github.com/summerwind/actions-runner-controller/issues/183 error for all the pods it span up but it span them up fine still.

Same for me! 馃憤

I'll give it a go whenever our new kubernetes cluster is up and running, but thank you for your great work!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

naka-gawa picture naka-gawa  路  5Comments

raj-saxena picture raj-saxena  路  5Comments

sandeepraj-chandrakant-bhandari-db picture sandeepraj-chandrakant-bhandari-db  路  8Comments

jlsan92 picture jlsan92  路  4Comments

vitobotta picture vitobotta  路  7Comments