From a44f5f6d790db71b126b5fd1d1ea6141713d5eb7 Mon Sep 17 00:00:00 2001
From: Jess <jess@jessie.cafe>
Date: Sun, 22 Dec 2024 19:45:20 +1300
Subject: [PATCH] k8s/arc: init

---
 k8s/github-runners/namespaces.yaml           |  9 +++++++
 k8s/github-runners/scale-set-controller.yaml | 26 ++++++++++++++++++
 k8s/github-runners/scale-set.yaml            | 28 ++++++++++++++++++++
 3 files changed, 63 insertions(+)
 create mode 100644 k8s/github-runners/namespaces.yaml
 create mode 100644 k8s/github-runners/scale-set-controller.yaml
 create mode 100644 k8s/github-runners/scale-set.yaml

diff --git a/k8s/github-runners/namespaces.yaml b/k8s/github-runners/namespaces.yaml
new file mode 100644
index 0000000..996c41e
--- /dev/null
+++ b/k8s/github-runners/namespaces.yaml
@@ -0,0 +1,9 @@
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: actions-runner-controller
+---
+apiVersion: v1
+kind: Namespace
+metadata:
+  name: github-runners
diff --git a/k8s/github-runners/scale-set-controller.yaml b/k8s/github-runners/scale-set-controller.yaml
new file mode 100644
index 0000000..1eedd74
--- /dev/null
+++ b/k8s/github-runners/scale-set-controller.yaml
@@ -0,0 +1,26 @@
+apiVersion: argoproj.io/v1alpha1
+kind: Application
+metadata:
+  name: gha-runner-scale-set-controller
+  namespace: apps
+  annotations:
+    argocd.argoproj.io/sync-wave: "1"
+spec:
+  project: apps
+  sources:
+    - chart: gha-runner-scale-set-controller
+      repoURL: ghcr.io/actions/actions-runner-controller-charts
+      targetRevision: 0.10.1
+      helm:
+        releaseName: gha-runner-scale-set-controller
+  destination:
+    server: "https://kubernetes.default.svc"
+    namespace: actions-runner-controller
+  syncPolicy:
+    syncOptions:
+      # https://github.com/argoproj/argo-cd/issues/820
+      - Replace=true
+    automated:
+      prune: true
+      selfHeal: true
+      allowEmpty: false
diff --git a/k8s/github-runners/scale-set.yaml b/k8s/github-runners/scale-set.yaml
new file mode 100644
index 0000000..f06e81f
--- /dev/null
+++ b/k8s/github-runners/scale-set.yaml
@@ -0,0 +1,28 @@
+apiVersion: argoproj.io/v1alpha1
+kind: Application
+metadata:
+  name: gha-runner-scale-set
+  namespace: apps
+  annotations:
+    argocd.argoproj.io/sync-wave: "2"
+spec:
+  project: apps
+  sources:
+    - chart: gha-runner-scale-set
+      repoURL: ghcr.io/actions/actions-runner-controller-charts
+      targetRevision: 0.10.1
+      helm:
+        releaseName: gha-runner-scale-set
+        valuesObject:
+          githubConfigUrl: https://github.com/ttrssreal/jix
+          # FIXME: part of declarative secret management
+          githubConfigSecret: jess-gh-pat
+  destination:
+    server: "https://kubernetes.default.svc"
+    namespace: github-runners
+  syncPolicy:
+    automated:
+      prune: true
+      selfHeal: true
+      allowEmpty: false
+