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: {}