From 06cbd632b84970f0ca38dfdb1c27e8282883f28d Mon Sep 17 00:00:00 2001 From: arielly-parussulo <97965681+arielly-parussulo@users.noreply.github.com> Date: Tue, 25 Jul 2023 01:59:41 -0300 Subject: [PATCH] add interval and timeout configuration for the actions-runner-controler serviceMonitors (#2654) Co-authored-by: Yusuke Kuoka --- charts/actions-runner-controller/README.md | 8 ++++++-- .../templates/actionsmetrics.service.yaml | 2 +- .../templates/actionsmetrics.servicemonitor.yaml.yml | 4 +++- .../templates/controller.metrics.serviceMonitor.yaml | 4 +++- .../templates/githubwebhook.service.yaml | 2 +- .../templates/githubwebhook.serviceMonitor.yaml | 4 +++- charts/actions-runner-controller/values.yaml | 10 ++++++++-- 7 files changed, 25 insertions(+), 9 deletions(-) diff --git a/charts/actions-runner-controller/README.md b/charts/actions-runner-controller/README.md index 2ed82f96..8202b7b7 100644 --- a/charts/actions-runner-controller/README.md +++ b/charts/actions-runner-controller/README.md @@ -42,7 +42,9 @@ All additional docs are kept in the `docs/` folder, this README is solely for do | `image.actionsRunnerImagePullSecrets` | Optional image pull secrets to be included in the runner pod's ImagePullSecrets | | | `image.dindSidecarRepositoryAndTag` | The "repository/image" of the dind sidecar container | docker:dind | | `image.pullPolicy` | The pull policy of the controller image | IfNotPresent | -| `metrics.serviceMonitor` | Deploy serviceMonitor kind for for use with prometheus-operator CRDs | false | +| `metrics.serviceMonitor.enable` | Deploy serviceMonitor kind for for use with prometheus-operator CRDs | false | +| `metrics.serviceMonitor.interval` | Configure the interval that Prometheus should scrap the controller's metrics | 1m | +| `metrics.serviceMonitor.timeout` | Configure the timeout the timeout of Prometheus scrapping. | 30s | | `metrics.serviceAnnotations` | Set annotations for the provisioned metrics service resource | | | `metrics.port` | Set port of metrics service | 8443 | | `metrics.proxy.enabled` | Deploy kube-rbac-proxy container in controller pod | true | @@ -149,7 +151,9 @@ All additional docs are kept in the `docs/` folder, this README is solely for do | `actionsMetricsServer.ingress.hosts` | Set hosts configuration for ingress | `[{"host": "chart-example.local", "paths": []}]` | | `actionsMetricsServer.ingress.tls` | Set tls configuration for ingress | | | `actionsMetricsServer.ingress.ingressClassName` | Set ingress class name | | -| `actionsMetrics.serviceMonitor` | Deploy serviceMonitor kind for for use with prometheus-operator CRDs | false | +| `actionsMetrics.serviceMonitor.enable` | Deploy serviceMonitor kind for for use with prometheus-operator CRDs | false | +| `actionsMetrics.serviceMonitor.interval` | Configure the interval that Prometheus should scrap the controller's metrics | 1m | +| `actionsMetrics.serviceMonitor.timeout` | Configure the timeout the timeout of Prometheus scrapping. | 30s | | `actionsMetrics.serviceAnnotations` | Set annotations for the provisioned actions metrics service resource | | | `actionsMetrics.port` | Set port of actions metrics service | 8443 | | `actionsMetrics.proxy.enabled` | Deploy kube-rbac-proxy container in controller pod | true | diff --git a/charts/actions-runner-controller/templates/actionsmetrics.service.yaml b/charts/actions-runner-controller/templates/actionsmetrics.service.yaml index c465e677..4ff8830b 100644 --- a/charts/actions-runner-controller/templates/actionsmetrics.service.yaml +++ b/charts/actions-runner-controller/templates/actionsmetrics.service.yaml @@ -16,7 +16,7 @@ spec: {{ range $_, $port := .Values.actionsMetricsServer.service.ports -}} - {{ $port | toYaml | nindent 6 }} {{- end }} - {{- if .Values.actionsMetrics.serviceMonitor }} + {{- if .Values.actionsMetrics.serviceMonitor.enable }} - name: metrics-port port: {{ .Values.actionsMetrics.port }} targetPort: metrics-port diff --git a/charts/actions-runner-controller/templates/actionsmetrics.servicemonitor.yaml.yml b/charts/actions-runner-controller/templates/actionsmetrics.servicemonitor.yaml.yml index d25400fc..307a1cb2 100644 --- a/charts/actions-runner-controller/templates/actionsmetrics.servicemonitor.yaml.yml +++ b/charts/actions-runner-controller/templates/actionsmetrics.servicemonitor.yaml.yml @@ -1,4 +1,4 @@ -{{- if and .Values.actionsMetricsServer.enabled .Values.actionsMetrics.serviceMonitor }} +{{- if and .Values.actionsMetricsServer.enabled .Values.actionsMetrics.serviceMonitor.enable }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: @@ -19,6 +19,8 @@ spec: tlsConfig: insecureSkipVerify: true {{- end }} + interval: {{ .Values.actionsMetrics.serviceMonitor.interval }} + scrapeTimeout: {{ .Values.actionsMetrics.serviceMonitor.timeout }} selector: matchLabels: {{- include "actions-runner-controller-actions-metrics-server.selectorLabels" . | nindent 6 }} diff --git a/charts/actions-runner-controller/templates/controller.metrics.serviceMonitor.yaml b/charts/actions-runner-controller/templates/controller.metrics.serviceMonitor.yaml index 07b2f3b9..b1ab0d90 100644 --- a/charts/actions-runner-controller/templates/controller.metrics.serviceMonitor.yaml +++ b/charts/actions-runner-controller/templates/controller.metrics.serviceMonitor.yaml @@ -1,4 +1,4 @@ -{{- if .Values.metrics.serviceMonitor }} +{{- if .Values.metrics.serviceMonitor.enable }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: @@ -19,6 +19,8 @@ spec: tlsConfig: insecureSkipVerify: true {{- end }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.timeout }} selector: matchLabels: {{- include "actions-runner-controller.selectorLabels" . | nindent 6 }} diff --git a/charts/actions-runner-controller/templates/githubwebhook.service.yaml b/charts/actions-runner-controller/templates/githubwebhook.service.yaml index 6835c8cf..6ec28acf 100644 --- a/charts/actions-runner-controller/templates/githubwebhook.service.yaml +++ b/charts/actions-runner-controller/templates/githubwebhook.service.yaml @@ -16,7 +16,7 @@ spec: {{ range $_, $port := .Values.githubWebhookServer.service.ports -}} - {{ $port | toYaml | nindent 6 }} {{- end }} - {{- if .Values.metrics.serviceMonitor }} + {{- if .Values.metrics.serviceMonitor.enable }} - name: metrics-port port: {{ .Values.metrics.port }} targetPort: metrics-port diff --git a/charts/actions-runner-controller/templates/githubwebhook.serviceMonitor.yaml b/charts/actions-runner-controller/templates/githubwebhook.serviceMonitor.yaml index f659cc42..81d9b591 100644 --- a/charts/actions-runner-controller/templates/githubwebhook.serviceMonitor.yaml +++ b/charts/actions-runner-controller/templates/githubwebhook.serviceMonitor.yaml @@ -1,4 +1,4 @@ -{{- if and .Values.githubWebhookServer.enabled .Values.metrics.serviceMonitor }} +{{- if and .Values.githubWebhookServer.enabled .Values.metrics.serviceMonitor.enable }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: @@ -19,6 +19,8 @@ spec: tlsConfig: insecureSkipVerify: true {{- end }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + scrapeTimeout: {{ .Values.metrics.serviceMonitor.timeout }} selector: matchLabels: {{- include "actions-runner-controller-github-webhook-server.selectorLabels" . | nindent 6 }} diff --git a/charts/actions-runner-controller/values.yaml b/charts/actions-runner-controller/values.yaml index 92cb3dce..1a719f8d 100644 --- a/charts/actions-runner-controller/values.yaml +++ b/charts/actions-runner-controller/values.yaml @@ -109,7 +109,10 @@ service: # Metrics service resource metrics: serviceAnnotations: {} - serviceMonitor: false + serviceMonitor: + enable: false + timeout: 30s + interval: 1m serviceMonitorLabels: {} port: 8443 proxy: @@ -308,7 +311,10 @@ actionsMetrics: # as a part of the helm release. # Do note that you also need actionsMetricsServer.enabled=true # to deploy the actions-metrics-server whose k8s service is referenced by the service monitor. - serviceMonitor: false + serviceMonitor: + enable: false + timeout: 30s + interval: 1m serviceMonitorLabels: {} port: 8443 proxy: