쿠버네티스 기반 Actions Runner Controller(ARC)

  • https://github.com/actions-runner-controller/actions-runner-controller 에 오픈소스로 존재하는 쿠버네티스 기반의 Autoscale을 위한 콘트롤러
  • 쿠버네티스 클러스터에 Runner를 자동으로 생성하게 해주는 actions-runner-controller
  • GHEC와 GHES 모두 지원: GHES는 3.3.0 버젼 이상이어야 함.

특징

Pull-driven 방식의 Autoscale

  • 설정된 metrics속성들의 조건에 부합할 때 자동 스케일 되는 방식
  • Poll의 주기는 콘트롤러의 --sync-period flag로 설정: 이 값이 지정되지 않으면 default로 10분
  • Metric Options
    • TotalNumberOfQueuedAndInProgressWorkflowRuns: 주어진 저장소 갯수 대비 모든 pending상태인 워크플로우들의 숫자. 전체 Pending job의 갯수만큼 runner를 scale하며, 최대 scale되는 갯수의 제한은 maxReplicas에 설정
    • PercentageRunnersBusy: busy상태인 runner의 갯수를 바탕으로 설정된 scale factor에 따라 전체 runner대비 percentage에 따라 scale수행.
      • Percentage 설정: scaleUpThreshold, scaleDownThreshold
      • Scale factor: scaleUpFactor, scaleDownFactor

Webhook-driven 방식의 Autoscale

  • Actions-runner-controller 와 별도로 설치되는 Webhook Server에 의해 실행
  • 현재 Webhook Server는 check_run, workflow_job, pull_requestpush 이벤트들에 대응하여 HorizontalRunnerAutoscaler kind내 spec에 설정된 N값에 매칭되도록 scale up

설치 Implementation

  1. Git clone the project
      git clone git@github.com:actions-runner-controller/actions-runner-controller.git
    
  2. Install Cert-manager

  3. GitHub App 또는 PAT 생성 및 알맞은 권한 설정

  4. Create Name Space
    kubectl create ns actions-runner-system
    
  5. Create GitHub App Secret

  6. Actions-runner-controller install (for Helm: value.yaml)
    • Kubernetes deployment
      $ kubectl create secret generic controller-manager \
        -n actions-runner-system \
        --from-literal=github_app_id=${APP_ID} \
        --from-literal=github_app_installation_id=${INSTALLATION_ID} \
        --from-file=github_app_private_key=${PRIVATE_KEY_FILE_PATH}
      
    • Helm deployment를 위해서는 yaml파일(value.yaml) 필요

      helm upgrade --install -f values.yaml -n actions-runner-system actions-runner-controller actions-runner-controller/actions-runner-controller
      
    • value.yaml예

      authSecret:
       github_app_id: 3
       github_app_installation_id: 1
      
      githubWebhookServer:
       enabled: true
       secret:
         create: true
         name: "github-webhook-server"
         github_webhook_secret_token: "123456789"
       service:
         type: LoadBalancer
         ports:
         - port: 80
           targetPort: http
           protocol: TCP
           name: http
           nodePort: 30020
      
  7. GHES경우 env set

  8. Deploy Runner

    • runnerdeploy.yaml파일 예제

      kind: RunnerDeployment
      metadata:
       name: k8s-runner-deployment
      spec:
       template:
        spec:
         organization: testorg
         env: []
         labels:
         - test-runner
      
  9. Horizontal Scale 설정

    • HorizontalRunnerAutoscaler 의 hra.yaml파일 예제
      kind: HorizontalRunnerAutoscaler
      spec:
       scaleTargetRef:
        name: example-runners
        # Uncomment the below in case the target is not RunnerDeployment but RunnerSet
        #kind: RunnerSet
       scaleUpTriggers:
       - githubEvent:
          checkRun:
           types: ["created"]
           status: "queued"
         amount: 1
         duration: "5m"
    
  10. Org에 Webhook설정
       Payload URL: http://<DNS name of the load balancer in front of the controller deployed by step 6>
       Content type: application/json
       Secret: <Use the token value from your values.yaml created in Step 14 e.g. 1234567890>
       Events: Workflow jobs
    

GitHub Enterprise의 다양한 기능설명을 위한 웹페이지입니다.

Last Modified Date: $LAST_MODIFIED_DATE$