From 6ad28dd5efd921db411de3b4809815ce94ff0f01 Mon Sep 17 00:00:00 2001 From: Dmytro Bondar Date: Tue, 10 Dec 2024 13:09:40 +0100 Subject: [PATCH] chart: added possibility to override ServiceMonitor apiVersion Signed-off-by: Dmytro Bondar --- charts/ingress-nginx/README.md | 1 + charts/ingress-nginx/templates/controller-servicemonitor.yaml | 2 +- charts/ingress-nginx/values.yaml | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/charts/ingress-nginx/README.md b/charts/ingress-nginx/README.md index c0b00e56d..0f777c9fe 100644 --- a/charts/ingress-nginx/README.md +++ b/charts/ingress-nginx/README.md @@ -398,6 +398,7 @@ metadata: | controller.metrics.service.type | string | `"ClusterIP"` | | | controller.metrics.serviceMonitor.additionalLabels | object | `{}` | | | controller.metrics.serviceMonitor.annotations | object | `{}` | Annotations to be added to the ServiceMonitor. | +| controller.metrics.serviceMonitor.apiVersion | string | `"monitoring.coreos.com/v1"` | Override API version of the ServiceMonitor resource. E.g. `azmonitoring.coreos.com/v1` for Azure Managed Prometheus | | controller.metrics.serviceMonitor.enabled | bool | `false` | | | controller.metrics.serviceMonitor.labelLimit | int | `0` | Per-scrape limit on number of labels that will be accepted for a sample. | | controller.metrics.serviceMonitor.labelNameLengthLimit | int | `0` | Per-scrape limit on length of labels name that will be accepted for a sample. | diff --git a/charts/ingress-nginx/templates/controller-servicemonitor.yaml b/charts/ingress-nginx/templates/controller-servicemonitor.yaml index 85bb84186..d3169fdf3 100644 --- a/charts/ingress-nginx/templates/controller-servicemonitor.yaml +++ b/charts/ingress-nginx/templates/controller-servicemonitor.yaml @@ -1,5 +1,5 @@ {{- if and .Values.controller.metrics.enabled .Values.controller.metrics.serviceMonitor.enabled -}} -apiVersion: monitoring.coreos.com/v1 +apiVersion: {{ .Values.controller.metrics.serviceMonitor.apiVersion }} kind: ServiceMonitor metadata: name: {{ include "ingress-nginx.controller.fullname" . }} diff --git a/charts/ingress-nginx/values.yaml b/charts/ingress-nginx/values.yaml index 116adf7ca..7bd43cac9 100644 --- a/charts/ingress-nginx/values.yaml +++ b/charts/ingress-nginx/values.yaml @@ -874,6 +874,9 @@ controller: # nodePort: "" serviceMonitor: enabled: false + # -- Override API version of the ServiceMonitor resource. + # E.g. `azmonitoring.coreos.com/v1` for Azure Managed Prometheus + apiVersion: monitoring.coreos.com/v1 additionalLabels: {} # -- Annotations to be added to the ServiceMonitor. annotations: {}