-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
624fcfd
commit 33b69ea
Showing
12 changed files
with
404 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
{{- if not (.Capabilities.APIVersions.Has "actions.github.com/v1alpha1") }} | ||
1. Do not forget to add this rules to prometheus adapter: | ||
{{- $configUrl := trimSuffix "/" .Values.githubConfigUrl }} | ||
{{- if eq (len (regexSplit "/" $configUrl -1)) 4 }} | ||
- seriesQuery: '{__name__="github_runner_organization_status",app_kubernetes_io_name="{{ include "github-actions-runner.fullname" . }}"}' | ||
{{- else }} | ||
- seriesQuery: '{__name__="github_runner_status",app_kubernetes_io_name="{{ include "github-actions-runner.fullname" . }}"}' | ||
{{- end }} | ||
resources: | ||
overrides: | ||
kubernetes_namespace: {resource: "namespace"} | ||
app_kubernetes_io_instance: {group: "apps", resource: "deployment"} | ||
name: | ||
as: "github_actions_worker_usage_ratio" | ||
metricsQuery: 'sum(<<.Series>>{<<.LabelMatchers>>,busy="true"}) BY (<<.GroupBy>>,repo) / sum(<<.Series>>{}) BY (<<.GroupBy>>,repo) * 100 OR on () topk(1, <<.Series>>{<<.LabelMatchers>>})' | ||
|
||
{{- end }} | ||
{{- if .Values.registry.enabled }} | ||
1. Clean registry | ||
2. Clean registry manually | ||
|
||
kubectl -n {{ .Release.Namespace }} create job --from=cronjob/{{ include "github-actions-runner.fullname" . }}-registry-cleaner {{ include "github-actions-runner.fullname" . }}-registry-cleaner-manual | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
202 changes: 202 additions & 0 deletions
202
charts/github-actions-runner/templates/autoscalingrunnerset-statefulset.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,202 @@ | ||
{{- if not (.Capabilities.APIVersions.Has "actions.github.com/v1alpha1") }} | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: {{ include "github-actions-runner.fullname" . }} | ||
namespace: {{ .Release.Namespace }} | ||
labels: | ||
{{- include "github-actions-runner.labels" . | nindent 4 }} | ||
app.kubernetes.io/component: autoscaling-runner-set | ||
spec: | ||
serviceName: {{ include "github-actions-runner.fullname" . }} | ||
{{- if not .Values.autoscaling.enabled }} | ||
replicas: {{ max 1 .Values.minRunners }} | ||
{{- end }} | ||
updateStrategy: | ||
type: RollingUpdate | ||
podManagementPolicy: Parallel | ||
minReadySeconds: 5 | ||
selector: | ||
matchLabels: | ||
{{- include "github-actions-runner.selectorLabels" . | nindent 6 }} | ||
app.kubernetes.io/component: autoscaling-runner-set | ||
template: | ||
metadata: | ||
annotations: | ||
kubectl.kubernetes.io/default-container: runner | ||
{{- if .Values.mirrors.enabled }} | ||
checksum/config: {{ toJson .Values.mirrors.registry | sha256sum }} | ||
{{- end }} | ||
{{- with .Values.podAnnotations }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "github-actions-runner.selectorLabels" . | nindent 8 }} | ||
app.kubernetes.io/component: autoscaling-runner-set | ||
spec: | ||
enableServiceLinks: false | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "github-actions-runner.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
terminationGracePeriodSeconds: 3600 | ||
dnsConfig: | ||
options: | ||
- name: ndots | ||
value: "3" | ||
containers: | ||
{{- if .Values.dind.enabled }} | ||
- name: {{ .Chart.Name }}-dind | ||
securityContext: | ||
privileged: true | ||
seccompProfile: | ||
type: Unconfined | ||
image: "{{ .Values.dind.image.repository }}:{{ .Values.dind.image.tag }}" | ||
imagePullPolicy: {{ .Values.dind.image.pullPolicy }} | ||
command: ["dockerd"] | ||
args: | ||
- --config-file=/etc/docker-config/daemon.json | ||
volumeMounts: | ||
- name: config | ||
mountPath: /etc/docker-config | ||
- name: tls | ||
mountPath: /etc/docker-tls | ||
- name: docker | ||
mountPath: /var/lib/docker | ||
- name: run | ||
mountPath: /run | ||
- name: modules | ||
mountPath: /lib/modules | ||
readOnly: true | ||
{{- if .Values.dind.extraVolumeMounts }} | ||
{{- toYaml .Values.dind.extraVolumeMounts | nindent 12 }} | ||
{{- end }} | ||
resources: | ||
{{- toYaml .Values.dind.resources | nindent 12 }} | ||
{{- end }} | ||
- name: runner | ||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 12 }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
command: ["/bin/bash", "/entrypoint.sh"] | ||
env: | ||
- name: ACTIONS_RUNNER_POD_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
- name: ACTIONS_RUNNER_REQUIRE_JOB_CONTAINER | ||
value: "false" | ||
- name: RUNNER_WORK_FOLDER | ||
value: /builds | ||
- name: RUNNER_ORGANIZATION_URL | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ include "github-actions-runner.fullname" . }}-github | ||
key: RUNNER_ORGANIZATION_URL | ||
optional: true | ||
- name: RUNNER_REPOSITORY_URL | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ include "github-actions-runner.fullname" . }}-github | ||
key: RUNNER_REPOSITORY_URL | ||
optional: true | ||
- name: GITHUB_ACCESS_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ include "github-actions-runner.fullname" . }}-github | ||
key: GITHUB_ACCESS_TOKEN | ||
envFrom: | ||
- secretRef: | ||
name: "{{ include "github-actions-runner.fullname" . }}" | ||
lifecycle: | ||
postStart: | ||
exec: | ||
command: ["/bin/sh", "/etc/docker-config/mirrors.sh"] | ||
volumeMounts: | ||
- name: config | ||
mountPath: /etc/docker-config | ||
- name: tls | ||
mountPath: /etc/docker-tls | ||
{{- if .Values.extraVolumeMounts }} | ||
{{- toYaml .Values.extraVolumeMounts | nindent 12 }} | ||
{{- end }} | ||
- name: builds | ||
mountPath: /builds | ||
- name: run | ||
mountPath: /run | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
affinity: | ||
podAntiAffinity: {{- include "affinities.pods" . | nindent 10 }} | ||
{{- with .Values.affinity }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
volumes: | ||
- name: run | ||
emptyDir: | ||
medium: Memory | ||
- name: config | ||
configMap: | ||
name: {{ include "github-actions-runner.fullname" . }} | ||
- name: tls | ||
secret: | ||
secretName: {{ include "github-actions-runner.fullname" . }}-client-tls | ||
defaultMode: 288 | ||
{{- if .Values.dind.enabled }} | ||
- name: modules | ||
hostPath: | ||
path: /lib/modules | ||
- name: docker | ||
{{- if and .Values.dind.persistence.enabled .Values.dind.persistence.storageClass }} | ||
ephemeral: | ||
volumeClaimTemplate: | ||
metadata: | ||
labels: | ||
{{- include "github-actions-runner.labels" . | nindent 22 }} | ||
{{- with .Values.dind.persistence.annotations }} | ||
annotations: | ||
{{- range $key, $value := . }} | ||
{{ $key }}: {{ $value }} | ||
{{- end }} | ||
{{- end }} | ||
{{- include "volumeClaimTemplate.spec.render" .Values.dind.persistence | nindent 14 }} | ||
{{- else }} | ||
emptyDir: {} | ||
{{- end }} | ||
{{- end }} | ||
- name: builds | ||
{{- if and .Values.persistence.enabled .Values.persistence.storageClass }} | ||
ephemeral: | ||
volumeClaimTemplate: | ||
metadata: | ||
labels: | ||
{{- include "github-actions-runner.labels" . | nindent 22 }} | ||
{{- with .Values.persistence.annotations }} | ||
annotations: | ||
{{- range $key, $value := . }} | ||
{{ $key }}: {{ $value }} | ||
{{- end }} | ||
{{- end }} | ||
{{- include "volumeClaimTemplate.spec.render" .Values.persistence | nindent 14 }} | ||
{{- else }} | ||
emptyDir: {} | ||
{{- end }} | ||
{{- if .Values.extraVolumes }} | ||
{{- toYaml .Values.extraVolumes | nindent 8 }} | ||
{{- end }} | ||
{{- if .Values.dind.extraVolumes }} | ||
{{- toYaml .Values.dind.extraVolumes | nindent 8 }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.