This is an automated email from the ASF dual-hosted git repository.

shahar1 pushed a commit to branch gha-arc-rebase
in repository https://gitbox.apache.org/repos/asf/airflow-ci-infra.git

commit 6aadc02b6351c13f6877736523233263ad53e011
Author: Hussein Awala <[email protected]>
AuthorDate: Fri Jul 21 03:09:27 2023 +0200

    Create a chart to configure GHA runners and add 2 scaled deployments for 
testing
---
 helm/helmfile.yaml                                |  4 +++
 helm/runners-config/Chart.yaml                    |  6 ++++
 helm/runners-config/templates/_helpers.tpl        | 43 +++++++++++++++++++++++
 helm/runners-config/templates/medium-runners.yaml | 36 +++++++++++++++++++
 helm/runners-config/templates/small-runners.yaml  | 36 +++++++++++++++++++
 helm/runners-config/values.yaml                   |  1 +
 6 files changed, 126 insertions(+)

diff --git a/helm/helmfile.yaml b/helm/helmfile.yaml
index 74d4be5..f30e329 100644
--- a/helm/helmfile.yaml
+++ b/helm/helmfile.yaml
@@ -34,3 +34,7 @@ releases:
     version: 0.23.3
     values:
       - ./values/actions-runner-controller.yaml
+
+  - name: runners-config
+    chart: ./runners-config
+    namespace: ci
diff --git a/helm/runners-config/Chart.yaml b/helm/runners-config/Chart.yaml
new file mode 100644
index 0000000..bc30b4f
--- /dev/null
+++ b/helm/runners-config/Chart.yaml
@@ -0,0 +1,6 @@
+apiVersion: v2
+name: runners-config
+description: A Helm chart to manage the ARC runners
+type: application
+version: 0.1.0
+appVersion: "1.16.0"
diff --git a/helm/runners-config/templates/_helpers.tpl 
b/helm/runners-config/templates/_helpers.tpl
new file mode 100644
index 0000000..0144d79
--- /dev/null
+++ b/helm/runners-config/templates/_helpers.tpl
@@ -0,0 +1,43 @@
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "chart.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 "chart.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 "chart.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | 
trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Common labels
+*/}}
+{{- define "chart.labels" -}}
+helm.sh/chart: {{ include "chart.chart" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end }}
+
diff --git a/helm/runners-config/templates/medium-runners.yaml 
b/helm/runners-config/templates/medium-runners.yaml
new file mode 100644
index 0000000..b5de52b
--- /dev/null
+++ b/helm/runners-config/templates/medium-runners.yaml
@@ -0,0 +1,36 @@
+apiVersion: actions.summerwind.dev/v1alpha1
+kind: RunnerDeployment
+metadata:
+  name: medium-runners-deployment
+spec:
+  template:
+    spec:
+      repository: hussein-awala/airflow
+      nodeSelector:
+        node-type: gha-runners
+        size: medium
+      tolerations:
+        - key: node-type
+          operator: Equal
+          value: gha-runners
+          effect: NoSchedule
+      labels:
+        - size:medium
+---
+apiVersion: actions.summerwind.dev/v1alpha1
+kind: HorizontalRunnerAutoscaler
+metadata:
+  name: medium-runners-deployment-autoscaler
+spec:
+  scaleDownDelaySecondsAfterScaleOut: 300
+  scaleTargetRef:
+    kind: RunnerDeployment
+    name: medium-runners-deployment
+  minReplicas: 0
+  maxReplicas: 5
+  metrics:
+    - type: PercentageRunnersBusy
+      scaleUpThreshold: '0.75'
+      scaleDownThreshold: '0.25'
+      scaleUpFactor: '2'
+      scaleDownFactor: '0.5'
\ No newline at end of file
diff --git a/helm/runners-config/templates/small-runners.yaml 
b/helm/runners-config/templates/small-runners.yaml
new file mode 100644
index 0000000..dc31984
--- /dev/null
+++ b/helm/runners-config/templates/small-runners.yaml
@@ -0,0 +1,36 @@
+apiVersion: actions.summerwind.dev/v1alpha1
+kind: RunnerDeployment
+metadata:
+  name: small-runners-deployment
+spec:
+  template:
+    spec:
+      repository: hussein-awala/airflow
+      nodeSelector:
+        node-type: gha-runners
+        size: small
+      tolerations:
+        - key: node-type
+          operator: Equal
+          value: gha-runners
+          effect: NoSchedule
+      labels:
+        - size:small
+---
+apiVersion: actions.summerwind.dev/v1alpha1
+kind: HorizontalRunnerAutoscaler
+metadata:
+  name: small-runners-deployment-autoscaler
+spec:
+  scaleDownDelaySecondsAfterScaleOut: 300
+  scaleTargetRef:
+    kind: RunnerDeployment
+    name: small-runners-deployment
+  minReplicas: 0
+  maxReplicas: 5
+  metrics:
+    - type: PercentageRunnersBusy
+      scaleUpThreshold: '0.75'
+      scaleDownThreshold: '0.25'
+      scaleUpFactor: '2'
+      scaleDownFactor: '0.5'
\ No newline at end of file
diff --git a/helm/runners-config/values.yaml b/helm/runners-config/values.yaml
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/helm/runners-config/values.yaml
@@ -0,0 +1 @@
+

Reply via email to