From 6a850e9ea8794942ecb558bc88a5c45b4a3b6939 Mon Sep 17 00:00:00 2001 From: CRA Fabio Yasuo Furushou Date: Tue, 6 Aug 2024 16:43:12 +0900 Subject: [PATCH] Add PodMonitor to gha-runner-scale-set-controller chart --- .../templates/_helpers.tpl | 4 ++++ .../manager_cluster_pod_monitor.yaml | 23 +++++++++++++++++++ .../values.yaml | 2 ++ 3 files changed, 29 insertions(+) create mode 100644 charts/gha-runner-scale-set-controller/templates/manager_cluster_pod_monitor.yaml diff --git a/charts/gha-runner-scale-set-controller/templates/_helpers.tpl b/charts/gha-runner-scale-set-controller/templates/_helpers.tpl index 075d21ae..87cb6fba 100644 --- a/charts/gha-runner-scale-set-controller/templates/_helpers.tpl +++ b/charts/gha-runner-scale-set-controller/templates/_helpers.tpl @@ -111,6 +111,10 @@ Create the name of the service account to use {{- include "gha-runner-scale-set-controller.fullname" . }}-listener {{- end }} +{{- define "gha-runner-scale-set-controller.managerPodMonitor" -}} +{{- include "gha-runner-scale-set-controller.fullname" . }} +{{- end }} + {{- define "gha-runner-scale-set-controller.leaderElectionRoleName" -}} {{- include "gha-runner-scale-set-controller.fullname" . }}-leader-election {{- end }} diff --git a/charts/gha-runner-scale-set-controller/templates/manager_cluster_pod_monitor.yaml b/charts/gha-runner-scale-set-controller/templates/manager_cluster_pod_monitor.yaml new file mode 100644 index 00000000..fb700c75 --- /dev/null +++ b/charts/gha-runner-scale-set-controller/templates/manager_cluster_pod_monitor.yaml @@ -0,0 +1,23 @@ +{{- if hasKey .Values "metrics" }} +{{- if and (hasKey .Values.metrics "podMonitor") .Values.metrics.podMonitor.enabled }} +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + labels: + {{- include "gha-runner-scale-set-controller.labels" . | nindent 4 }} + name: {{ include "gha-runner-scale-set-controller.managerPodMonitor" . }} + namespace: {{ .Release.Namespace }} +spec: + podMetricsEndpoints: + {{- with .Values.metrics }} + - path: {{ .listenerEndpoint }} + port: metrics + {{- end }} + selector: + matchLabels: + {{- include "gha-runner-scale-set-controller.selectorLabels" . | nindent 6 }} + namespaceSelector: + matchNames: + - {{ .Release.Namespace }} +{{- end }} +{{- end }} diff --git a/charts/gha-runner-scale-set-controller/values.yaml b/charts/gha-runner-scale-set-controller/values.yaml index 8e74317e..a7278fa0 100644 --- a/charts/gha-runner-scale-set-controller/values.yaml +++ b/charts/gha-runner-scale-set-controller/values.yaml @@ -93,6 +93,8 @@ priorityClassName: "" # controllerManagerAddr: ":8080" # listenerAddr: ":8080" # listenerEndpoint: "/metrics" +# podMonitor: +# enabled: true flags: ## Log level can be set here with one of the following values: "debug", "info", "warn", "error".