helm charts for actions runner (#1375)
Fixes: #942 helm charts for actions runner, currently its having only RunnerDeployment and Autoscaler resources. Looks like deployment order is important here, facing the below issue if Autoscaler deployed first and then autoscaling not working as expected. ``` 2022-04-21T12:13:08Z DEBUG controllers.webhookbasedautoscaler RunnerDeployment not found with scale target ref name test-actions-runner for hra test-actions-runner-autoscaler ``` Helm doesn't support [ordering](https://github.com/helm/helm/issues/8439) for custom resources. So using List to overcome this issue, didn't use helm chart hooks for ordering since its not [tracked](https://helm.sh/docs/topics/charts_hooks/#hook-resources-are-not-managed-with-corresponding-releases) after creation. Co-authored-by: Josh Feierman <joshua.feierman@warnermedia.com> Co-authored-by: Yusuke Kuoka <ykuoka@gmail.com>
This commit is contained in:
parent
5fd6ec4bc8
commit
3ca96557a6
|
|
@ -0,0 +1,6 @@
|
|||
The `contrib` directory is the place for sharing various example code for deploying and operating `actions-runner-controller`.
|
||||
|
||||
Anything contained in this directory is provided as-is. The maintainers of `actions-runner-controller` is not yet commited to provide
|
||||
full support for using, fixing, and enhancing it. However, they will do their best effort to collect feedbacks from early adopters and advanced users like you, and may eventually consider graduating any of the examples as an official addition to the project.
|
||||
|
||||
See https://github.com/actions-runner-controller/actions-runner-controller/pull/1375#issuecomment-1258816470 and https://github.com/actions-runner-controller/actions-runner-controller/pull/1559#issuecomment-1258827496 for more context.
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
# 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/
|
||||
# Docs
|
||||
docs/
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
apiVersion: v2
|
||||
name: actions-runner
|
||||
description: Helm Chart for Github Actions Runner
|
||||
type: application
|
||||
version: 0.0.1
|
||||
appVersion: 2.290.1
|
||||
|
||||
home: https://github.com/actions-runner-controller/actions-runner-controller/tree/master/runner
|
||||
sources:
|
||||
- https://github.com/actions-runner-controller/actions-runner-controller/tree/master/runner
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
## Docs
|
||||
|
||||
All additional docs are kept in the `docs/` folder, this README is solely for documenting the values.yaml keys and values
|
||||
|
||||
## Values
|
||||
|
||||
**_The values are documented as of HEAD, to review the configuration options for your chart version ensure you view this file at the relevent [tag](https://github.com/actions-runner-controller/actions-runner-controller/tags)_**
|
||||
|
||||
> _Default values are the defaults set in the charts values.yaml, some properties have default configurations in the code for when the property is omitted or invalid_
|
||||
|
||||
| Key | Description | Default |
|
||||
|----------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------|
|
||||
| `labels` | Set labels to apply to all resources in the chart | |
|
||||
| `replicaCount` | Set the number of runner pods | 1 |
|
||||
| `image.repository` | The "repository/image" of the runner container | summerwind/actions-runner |
|
||||
| `image.tag` | The tag of the runner container | |
|
||||
| `image.pullPolicy` | The pull policy of the runner image | IfNotPresent |
|
||||
| `imagePullSecrets` | Specifies the secret to be used when pulling the runner pod containers | |
|
||||
| `fullnameOverride` | Override the full resource names | |
|
||||
| `nameOverride` | Override the resource name prefix | |
|
||||
| `podAnnotations` | Set annotations for the runner pod | |
|
||||
| `podLabels` | Set labels for the runner pod | |
|
||||
| `podSecurityContext` | Set the security context to runner pod | |
|
||||
| `nodeSelector` | Set the pod nodeSelector | |
|
||||
| `affinity` | Set the runner pod affinity rules | |
|
||||
| `tolerations` | Set the runner pod tolerations | |
|
||||
| `env` | Set environment variables for the runner container | |
|
||||
| `organization` | Github organization where runner will be registered | test |
|
||||
| `repository` | Github repository where runner will be registered | |
|
||||
| `runnerLabels` | Labels you want to add in your runner | test |
|
||||
| `autoscaler.enabled` | Enable the HorizontalRunnerAutoscaler, if its enabled then replica count will not be used | true |
|
||||
| `autoscaler.minReplicas` | Minimum no of replicas | 1 |
|
||||
| `autoscaler.maxReplicas` | Maximum no of replicas | 5 |
|
||||
| `autoscaler.scaleDownDelaySecondsAfterScaleOut` | [Anti-Flapping Configuration](https://github.com/actions-runner-controller/actions-runner-controller#anti-flapping-configuration) | 120 |
|
||||
| `autoscaler.metrics` | [Pull driven scaling](https://github.com/actions-runner-controller/actions-runner-controller#pull-driven-scaling) | default |
|
||||
| `autoscaler.scaleUpTriggers` | [Webhook driven scaling](https://github.com/actions-runner-controller/actions-runner-controller#webhook-driven-scaling) | |
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "actions-runner.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "actions-runner.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "actions-runner.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "actions-runner.labels" -}}
|
||||
helm.sh/chart: {{ include "actions-runner.chart" . }}
|
||||
{{ include "actions-runner.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- range $k, $v := .Values.labels }}
|
||||
{{ $k }}: {{ $v }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "actions-runner.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "actions-runner.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
|
@ -0,0 +1,96 @@
|
|||
apiVersion: v1
|
||||
kind: List
|
||||
items:
|
||||
- apiVersion: actions.summerwind.dev/v1alpha1
|
||||
kind: RunnerDeployment
|
||||
metadata:
|
||||
name: {{ include "actions-runner.fullname" . }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "actions-runner.labels" . | nindent 6 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaler.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "actions-runner.selectorLabels" . | nindent 8 }}
|
||||
template:
|
||||
metadata:
|
||||
{{- with .Values.podAnnotations }}
|
||||
annotations:
|
||||
kubectl.kubernetes.io/default-logs-container: "runner"
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "actions-runner.selectorLabels" . | nindent 10 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 10 }}
|
||||
{{- with .Values.priorityClassName }}
|
||||
priorityClassName: "{{ . }}"
|
||||
{{- end }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default (cat "v" .Chart.AppVersion | replace " " "") }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- if .Values.organization }}
|
||||
organization: {{ .Values.organization }}
|
||||
{{- end }}
|
||||
{{- if .Values.repository }}
|
||||
repository: {{ .Values.repository }}
|
||||
{{- end }}
|
||||
group: {{ .Values.group | default "Default" }}
|
||||
{{- with .Values.runnerLabels }}
|
||||
labels:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if .Values.env }}
|
||||
env:
|
||||
{{- range $key, $val := .Values.env }}
|
||||
- name: {{ $key }}
|
||||
value: {{ $val | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.autoscaler.enabled }}
|
||||
- apiVersion: actions.summerwind.dev/v1alpha1
|
||||
kind: HorizontalRunnerAutoscaler
|
||||
metadata:
|
||||
name: {{ (list (include "actions-runner.fullname" .) "autoscaler" | join "-") }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{- include "actions-runner.labels" . | nindent 6 }}
|
||||
spec:
|
||||
{{- if .Values.autoscaler.scaleDownDelaySecondsAfterScaleOut }}
|
||||
scaleDownDelaySecondsAfterScaleOut: {{ .Values.autoscaler.scaleDownDelaySecondsAfterScaleOut }}
|
||||
{{- end }}
|
||||
scaleTargetRef:
|
||||
name: {{ include "actions-runner.fullname" . }}
|
||||
minReplicas: {{ .Values.autoscaler.minReplicas }}
|
||||
maxReplicas: {{ .Values.autoscaler.maxReplicas }}
|
||||
{{- with .Values.autoscaler.scaleUpTriggers }}
|
||||
scaleUpTriggers:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- with .Values.autoscaler.metrics }}
|
||||
metrics:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
|
@ -0,0 +1,63 @@
|
|||
image:
|
||||
repository: summerwind/actions-runner
|
||||
tag: v2.290.1-ubuntu-20.04
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
# Create runner for an organization or a repository
|
||||
# Set only one of the two either organization or repository
|
||||
# By default, it creates runner under github organization test
|
||||
organization: test
|
||||
# repository: mumoshu/actions-runner-controller-ci
|
||||
|
||||
# Labels you want to add in your runner
|
||||
runnerLabels:
|
||||
- test
|
||||
|
||||
# If you enable Autoscaler, then it will not be used
|
||||
replicaCount: 1
|
||||
|
||||
# The Runner Group that the runner(s) should be associated with.
|
||||
# See https://docs.github.com/en/github-ae@latest/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups.
|
||||
group: Default
|
||||
|
||||
autoscaler:
|
||||
enabled: true
|
||||
minReplicas: 1
|
||||
maxReplicas: 5
|
||||
scaleDownDelaySecondsAfterScaleOut: 120
|
||||
# metrics (pull method) / scaleUpTriggers (push method)
|
||||
# https://github.com/actions-runner-controller/actions-runner-controller#pull-driven-scaling
|
||||
# https://github.com/actions-runner-controller/actions-runner-controller#webhook-driven-scaling
|
||||
metrics:
|
||||
- type: PercentageRunnersBusy
|
||||
scaleUpThreshold: '0.75'
|
||||
scaleDownThreshold: '0.25'
|
||||
scaleUpFactor: '2'
|
||||
scaleDownFactor: '0.5'
|
||||
# scaleUpTriggers:
|
||||
# - githubEvent: {}
|
||||
# duration: "5m"
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
podLabels: {}
|
||||
|
||||
imagePullSecrets: []
|
||||
|
||||
podSecurityContext:
|
||||
{}
|
||||
# fsGroup: 2000
|
||||
|
||||
# Leverage a PriorityClass to ensure your pods survive resource shortages
|
||||
# ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
|
||||
# PriorityClass: system-cluster-critical
|
||||
priorityClassName: ""
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
||||
|
||||
env:
|
||||
{}
|
||||
Loading…
Reference in New Issue