Skip to content

Commit

Permalink
Upstream and replace github-actions-runner with `eks/actions-runner…
Browse files Browse the repository at this point in the history
…-controller` (cloudposse#485)

* replaced github-actions-runner with eks/actions-runner-controller

* corrected variable description

* moved github-actions-runner to deprecrated, rather than deleted

* added README reference

* PR comments

* added documentation for github tokens

* corrected webhook_enabled
  • Loading branch information
milldr authored Sep 8, 2022
1 parent 13d31ac commit 8520312
Show file tree
Hide file tree
Showing 34 changed files with 1,309 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ repos:
exclude: |
(?x)^(
modules/cert-manager/cert-manager-issuer/templates/.*.yaml |
modules/github-actions-runner/runners/actions-runner/chart/templates/.*.yaml |
modules/echo-server/charts/eks/echo-server/templates/.*.yaml
modules/eks/actions-runner-controller/charts/actions-runner/templates/.*.yaml |
modules/echo-server/charts/eks/echo-server/templates/.*.yaml |
deprecated/github-actions-runner/runners/actions-runner/chart/templates/.*.yaml
)$
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.71.0
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
207 changes: 207 additions & 0 deletions modules/eks/actions-runner-controller/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: v2
name: actions-runner
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This chart only deploys Resources for actions-runner-controller, so app version does not really apply.
# We use Resource API version instead.
appVersion: "v1alpha1"
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: actions.summerwind.dev/v1alpha1
kind: HorizontalRunnerAutoscaler
metadata:
name: {{ .Values.release_name }}
spec:
# Runners in the targeted RunnerDeployment won't be scaled down
# for 5 minutes instead of the default 10 minutes now
scaleDownDelaySecondsAfterScaleOut: {{ .Values.scale_down_delay_seconds }}
scaleTargetRef:
name: {{ .Values.release_name }}
minReplicas: {{ .Values.min_replicas }}
maxReplicas: {{ .Values.max_replicas }}
{{- if .Values.pull_driven_scaling_enabled }}
metrics:
- type: PercentageRunnersBusy
scaleUpThreshold: {{ .Values.scale_up_threshold | quote }}
scaleDownThreshold: {{ .Values.scale_down_threshold | quote }}
{{- if .Values.scale_up_factor }}
scaleUpFactor: {{ .Values.scale_up_factor | quote }}
{{- else }}
scaleUpAdjustment: {{ .Values.scale_up_adjustment | quote }}
{{- end }}
{{- if .Values.scale_down_factor }}
scaleDownFactor: {{ .Values.scale_down_factor | quote }}
{{- else }}
scaleUpAdjustment: {{ .Values.scale_down_adjustment | quote }}
{{- end }}
{{- end }}
{{- if .Values.webhook_driven_scaling_enabled }}
scaleUpTriggers:
- githubEvent:
workflowJob: {}
amount: 1
duration: "{{ .Values.scale_down_delay_seconds }}s"
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
name: {{ .Values.release_name }}
spec:
# Do not use `replicas` with HorizontalRunnerAutoscaler
# See https://github.com/actions-runner-controller/actions-runner-controller/issues/206#issuecomment-748601907
# replicas: 1
template:
spec:
# You could reserve nodes for runners by labeling and tainting nodes with
# node-role.kubernetes.io/actions-runner
# and then adding the following to this RunnerDeployment
#
# nodeSelector:
# node-role.kubernetes.io/actions-runner: ""
#
# tolerations:
# - effect: NoSchedule
# key: node-role.kubernetes.io/actions-runner
# operator: Exists

{{ if eq .Values.type "organization" }}
organization: {{ .Values.scope }}
{{ end }}
{{ if eq .Values.type "repository" }}
repository: {{ .Values.scope }}
{{ end }}
# You can use labels to create subsets of runners.
# See https://github.com/summerwind/actions-runner-controller#runner-labels
# and https://docs.github.com/en/free-pro-team@latest/actions/hosting-your-own-runners/using-self-hosted-runners-in-a-workflow
labels:
# It appears that the webhook autoscaler requires the runner deployment
# to explicitly include the "self-hosted" label in order to match the
# workflow_job to it.
- self-hosted
{{- range .Values.labels }}
- {{ . | quote }}
{{- end }}
# dockerdWithinRunnerContainer = false means access to a Docker daemon is provided by a sidecar container.
dockerdWithinRunnerContainer: {{ .Values.dind_enabled }}
image: {{ .Values.image | quote }}
imagePullPolicy: IfNotPresent
serviceAccountName: {{ .Values.service_account_name }}
resources:
{{- toYaml .Values.resources | nindent 8 }}

Loading

0 comments on commit 8520312

Please sign in to comment.