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 56934c4b2c44df927646cd0a1c889b6a902e3aa6
Author: Hussein Awala <[email protected]>
AuthorDate: Sat Jul 22 00:16:47 2023 +0200

    refacto the runners chart and switch to 
TotalNumberOfQueuedAndInProgressWorkflowRuns metrics
---
 helm/runners-config/templates/_helpers.tpl        | 43 -----------------------
 helm/runners-config/templates/medium-runners.yaml | 36 -------------------
 helm/runners-config/templates/runners.yaml        | 43 +++++++++++++++++++++++
 helm/runners-config/templates/small-runners.yaml  | 36 -------------------
 helm/runners-config/values.yaml                   | 30 ++++++++++++++++
 5 files changed, 73 insertions(+), 115 deletions(-)

diff --git a/helm/runners-config/templates/_helpers.tpl 
b/helm/runners-config/templates/_helpers.tpl
deleted file mode 100644
index 0144d79..0000000
--- a/helm/runners-config/templates/_helpers.tpl
+++ /dev/null
@@ -1,43 +0,0 @@
-{{/*
-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
deleted file mode 100644
index b5de52b..0000000
--- a/helm/runners-config/templates/medium-runners.yaml
+++ /dev/null
@@ -1,36 +0,0 @@
-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/runners.yaml 
b/helm/runners-config/templates/runners.yaml
new file mode 100644
index 0000000..c92cb57
--- /dev/null
+++ b/helm/runners-config/templates/runners.yaml
@@ -0,0 +1,43 @@
+{{ $values := .Values }}
+{{ range $runner := $values.runners }}
+apiVersion: actions.summerwind.dev/v1alpha1
+kind: RunnerDeployment
+metadata:
+  name: {{ $runner.name }}-runners-deployment
+spec:
+  template:
+    spec:
+      repository: {{ $values.githubRepository }}
+      nodeSelector:
+        {{- $runner.nodeSelector | toYaml | nindent 8 }}
+      tolerations:
+        {{- $runner.tolerations | toYaml | nindent 8 }}
+      labels:
+        {{- $runner.labels | toYaml | nindent 8 }}
+      affinity:
+        podAntiAffinity:
+          requiredDuringSchedulingIgnoredDuringExecution:
+            - labelSelector:
+                matchExpressions:
+                  - key: runner-deployment-name
+                    operator: In
+                    values:
+                      - {{ $runner.name }}-runners-deployment
+              topologyKey: kubernetes.io/hostname
+---
+apiVersion: actions.summerwind.dev/v1alpha1
+kind: HorizontalRunnerAutoscaler
+metadata:
+  name: {{ $runner.name }}-runners-deployment-autoscaler
+spec:
+  scaleDownDelaySecondsAfterScaleOut: {{ 
$values.scaleDownDelaySecondsAfterScaleOut }}
+  scaleTargetRef:
+    kind: RunnerDeployment
+    name: {{ $runner.name }}-runners-deployment
+  minReplicas: {{ $runner.minReplicas }}
+  maxReplicas: {{ $runner.maxReplicas }}
+  metrics:
+    - type: TotalNumberOfQueuedAndInProgressWorkflowRuns
+      repositoryNames:
+        - {{ $values.githubRepository }}
+{{ end }}
\ No newline at end of file
diff --git a/helm/runners-config/templates/small-runners.yaml 
b/helm/runners-config/templates/small-runners.yaml
deleted file mode 100644
index dc31984..0000000
--- a/helm/runners-config/templates/small-runners.yaml
+++ /dev/null
@@ -1,36 +0,0 @@
-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
index 8b13789..3cff786 100644
--- a/helm/runners-config/values.yaml
+++ b/helm/runners-config/values.yaml
@@ -1 +1,31 @@
+githubRepository: hussein-awala/airflow
 
+scaleDownDelaySecondsAfterScaleOut: 30
+
+runners:
+  - name: small
+    minReplicas: 0
+    maxReplicas: 5
+    labels:
+      - small
+    nodeSelector:
+      node-type: gha-runners
+      size: small
+    tolerations:
+      - key: node-type
+        operator: Equal
+        value: gha-runners
+        effect: NoSchedule
+  - name: medium
+    minReplicas: 0
+    maxReplicas: 5
+    labels:
+      - medium
+    nodeSelector:
+      node-type: gha-runners
+      size: medium
+    tolerations:
+      - key: node-type
+        operator: Equal
+        value: gha-runners
+        effect: NoSchedule
\ No newline at end of file

Reply via email to