Skip to content

Commit

Permalink
Test helm
Browse files Browse the repository at this point in the history
  • Loading branch information
drunkbatya committed Jul 22, 2024
1 parent d185019 commit 662604d
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:
- name: 'Checkout code'
uses: actions/checkout@v4

- name: 'Install Helm'
uses: azure/[email protected]

- name: 'Set image tag and name'
id: tag
run: |
Expand All @@ -34,6 +37,7 @@ jobs:
- name: 'Login to Docker Hub'
uses: docker/login-action@v3
with:
registry: registry-1.docker.io
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}

Expand Down Expand Up @@ -76,6 +80,12 @@ jobs:
cache-to: type=registry,ref=${{ steps.tag.outputs.image_name }}-fz-fw:buildcache,mode=max
context: flipperzero-firmware

- name: 'Push helm chart'
if: ${{ github.event_name != 'pull_request' }}
run: |
helm package helm --version ${IMAGE_TAG};
helm push github-actions-runner-${IMAGE_TAG}.tgz oci://registry-1.docker.io/flipperdevices;
- name: 'Trigger k8s to use new image android: prod'
if: ${{ (github.event_name != 'pull_request')
&& (steps.tag.outputs.image_tag != '0.0.0')
Expand Down
23 changes: 23 additions & 0 deletions helm/.helmignore
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/
5 changes: 5 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v2
name: github-actions-runner
description: Github Action runners deployment
type: application
version: 0.1.0
Binary file added helm/templates/.runnerdeployment.yaml.swp
Binary file not shown.
18 changes: 18 additions & 0 deletions helm/templates/horizontalrunnerautoscaler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: actions.summerwind.dev/v1alpha1
kind: HorizontalRunnerAutoscaler
metadata:
namespace: {{ .Release.Namespace }}
name: github-runner-deployment-autoscaler
spec:
scaleDownDelaySecondsAfterScaleOut: 180
scaleTargetRef:
kind: RunnerDeployment
name: github-runner-deployment
minReplicas: {{ .Values.replicasCount }}
maxReplicas: {{ .Values.replicasCount }}
metrics:
- type: PercentageRunnersBusy
scaleUpThreshold: '0.75'
scaleDownThreshold: '0.25'
scaleUpFactor: '2'
scaleDownFactor: '0.5'
44 changes: 44 additions & 0 deletions helm/templates/runnerdeployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
name: github-runner-deployment
namespace: {{ .Release.Namespace }}

spec:
template:
spec:
image: {{ .Values.repository }}:{{ .Values.tag }}
dockerdWithinRunnerContainer: {{ .Values.dockerInDocker }}
organization: {{ .Values.organization }}
labels:
{{- toYaml .Values.labels | nindent 8 }}
group: {{ .Values.runnerGroup }}
{{- if .Values.volumeMounts }}
{{- range .Values.volumeMounts }}
volumeMounts:
- mountPath: {{ .mountPath }}
name: {{ .name }}
{{- end }}
{{- range .Values.volumeMounts }}
volumes:
- name: {{ .name }}
hostPath:
path: {{ .hostPath }}
type: DirectoryOrCreate
{{- end }}
{{- end }}
dockerEnabled: false
{{- if .Values.serviceAccountName }}
serviceAccountName: {{ .Values.serviceAccountName }}
{{- else }}
serviceAccountName: default
{{- end }}
{{- if .Values.maxRunnersPerNode }}
topologySpreadConstraints:
- maxSkew: {{ .Values.maxRunnersPerNode }}
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
runner-deployment-name: github-runner-deployment
{{- end }}
Empty file added helm/values.yaml
Empty file.

0 comments on commit 662604d

Please sign in to comment.