Skip to content

Commit

Permalink
fix: update global values in github-actions-runners (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
SweetOps authored Oct 4, 2021
1 parent 5879919 commit c57089a
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 24 deletions.
2 changes: 1 addition & 1 deletion charts/github-actions-runners/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ apiVersion: v2
name: github-actions-runners
description: A Helm chart for provisioning Github Actions runners
type: application
version: 0.0.3
version: 0.1.0
maintainers:
- name: SweetOps
16 changes: 14 additions & 2 deletions charts/github-actions-runners/templates/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
{{- $enabled := printf "%t" .enabled }}
{{- if regexMatch "nil" $enabled }}{{- $enabled = "true" }}{{- end }}
{{- if (eq $enabled "true") }}
{{- if .autoscaling.enabled }}
{{- $autoscaling := .autoscaling | default dict }}
{{- $autoscalingEnabled := $autoscaling.enabled | default false }}
{{- $minReplicas := $autoscaling.minReplicas | default $.Values.global.autoscaling.minReplicas }}
{{- $maxReplicas := $autoscaling.maxReplicas | default $.Values.global.autoscaling.maxReplicas }}
{{- $scaleUpTriggers := $autoscaling.scaleUpTriggers | default $.Values.global.autoscaling.scaleUpTriggers }}
{{- $metrics := $autoscaling.metrics | default $.Values.global.autoscaling.metrics }}
{{- if $autoscalingEnabled }}
kind: HorizontalRunnerAutoscaler
apiVersion: actions.summerwind.dev/v1alpha1
metadata:
Expand All @@ -12,12 +18,18 @@ metadata:
github-actions-runner: {{ .name }}
{{- include "github-actions-runners.labels" $ | nindent 4 }}
spec:
minReplicas: {{ $minReplicas }}
maxReplicas: {{ $maxReplicas }}
scaleTargetRef:
name: {{ include "github-actions-runners.fullname" $ }}-{{ .name }}
{{- with .autoscaling.scaleUpTriggers }}
{{- with $scaleUpTriggers }}
scaleUpTriggers:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $metrics }}
metrics:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
30 changes: 17 additions & 13 deletions charts/github-actions-runners/templates/runnerdeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
{{- $enabled := printf "%t" .enabled }}
{{- if regexMatch "nil" $enabled }}{{- $enabled = "true" }}{{- end }}
{{- if (eq $enabled "true") }}
{{- $imageSpec := .image | default dict }}
{{- $repository := $imageSpec.repository | default $.Values.global.image.repository }}
{{- $tag := $imageSpec.tag | default $.Values.global.image.tag }}
{{- $pullPolicy := $imageSpec.pullPolicy | default $.Values.global.image.pullPolicy }}
kind: RunnerDeployment
apiVersion: actions.summerwind.dev/v1alpha1
metadata:
Expand All @@ -14,7 +18,7 @@ spec:
replicas: {{ .replicaCount | default $.Values.global.replicaCount }}
template:
metadata:
{{- with .podAnnotations }}
{{- with (default $.Values.global.podAnnotations .podAnnotations) }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand All @@ -23,38 +27,38 @@ spec:
{{- include "github-actions-runners.selectorLabels" $ | nindent 8 }}
spec:
serviceAccountName: {{ include "github-actions-runners.fullname" $ }}-{{ .name }}
image: "{{ .image.repository | default $.Values.global.image.repository }}:{{ .image.tag | default $.Values.global.image.tag }}"
imagePullPolicy: "{{ .image.pullPolicy | default $.Values.global.image.pullPolicy }}"
image: {{ printf "%s:%s" $repository $tag }}
imagePullPolicy: {{ $pullPolicy }}
{{- if .config.githubRepository }}
repository: "{{ .config.githubRepository }}"
{{- end }}
{{- if .config.githubOrganization }}
organization: "{{ .config.githubOrganization }}"
{{- end }}
{{- with .config.labels }}
{{- with (default $.Values.global.config.labels .config.labels )}}
labels:
{{- toYaml . | nindent 8 }}
{{- end }}
ephemeral: "{{ .config.ephemeral | default $.Values.global.config.ephemeral }}"
dockerEnabled: "{{ .config.dockerEnabled | default $.Values.global.config.dockerEnabled }}"
dockerMTU: "{{ .config.dockerMTU | default $.Values.global.config.dockerMTU }}"
ephemeral: {{ .config.ephemeral | default $.Values.global.config.ephemeral }}
dockerEnabled: {{ .config.dockerEnabled | default $.Values.global.config.dockerEnabled }}
dockerMTU: {{ .config.dockerMTU | default $.Values.global.config.dockerMTU }}
dockerRegistryMirror: "{{ .config.dockerRegistryMirror | default $.Values.global.config.dockerRegistryMirror }}"
dockerdWithinRunnerContainer: "{{ .config.dockerdWithinRunnerContainer | default $.Values.global.config.dockerdWithinRunnerContainer }}"
dockerdWithinRunnerContainer: {{ .config.dockerdWithinRunnerContainer | default $.Values.global.config.dockerdWithinRunnerContainer }}
securityContext:
{{- toYaml .securityContext | nindent 8 }}
{{- with .nodeSelector }}
{{- toYaml (default $.Values.global.securityContext .securityContext )| nindent 8 }}
{{- with (default $.Values.global.nodeSelector .nodeSelector )}}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .affinity }}
{{- with (default $.Values.global.affinity .affinity) }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .tolerations }}
{{- with (default $.Values.global.tolerations .tolerations) }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
resources:
{{- toYaml .resources | nindent 8 }}
{{- toYaml (default $.Values.global.resources .resources) | nindent 8 }}
{{- end }}
{{- end }}
7 changes: 5 additions & 2 deletions charts/github-actions-runners/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
{{- $enabled := printf "%t" .enabled }}
{{- if regexMatch "nil" $enabled }}{{- $enabled = "true" }}{{- end }}
{{- if (eq $enabled "true") }}
{{- if .serviceAccount.create -}}
{{- $serviceAccount := .image | default dict }}
{{- $create := $serviceAccount.create | default $.Values.global.serviceAccount.create }}
{{- $annotations := $serviceAccount.annotations | default $.Values.global.serviceAccount.annotations }}
{{- if $create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "github-actions-runners.fullname" $ }}-{{ .name }}
labels:
github-actions-runner: {{ .name }}
{{- include "github-actions-runners.labels" $ | nindent 4 }}
{{- with .serviceAccount.annotations }}
{{- with $annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
Expand Down
33 changes: 27 additions & 6 deletions charts/github-actions-runners/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,46 @@ nameOverride: ""
fullnameOverride: ""

global:
replicaCount: 1
replicaCount: 0
image:
repository: summerwind/actions-runner-dind
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "v2.281.1-ubuntu-20.04"

podAnnotations: {}
securityContext: {}
resources: {}
nodeSelector: {}
tolerations: []
affinity: {}

serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template

config:
ephemeral: true
dockerEnabled: false
dockerMTU: 1500
dockerRegistryMirror: https://mirror.gcr.io/
dockerdWithinRunnerContainer: true
labels: []

autoscaling:
minReplicas: 0
maxReplicas: 3
metrics: []
scaleUpTriggers: []


runnerDeployments:
- name: default
enabled: true
enabled: false
replicaCount: 1
image:
repository: summerwind/actions-runner-dind
Expand All @@ -39,9 +63,6 @@ runnerDeployments:

podAnnotations: {}

podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
Expand Down Expand Up @@ -88,7 +109,7 @@ runnerDeployments:
affinity: {}

autoscaling:
enabled: true
enabled: false
scaleUpTriggers:
- githubEvent:
checkRun:
Expand Down

0 comments on commit c57089a

Please sign in to comment.