diff --git a/README.md b/README.md index 7e7e86b..e7e7f0b 100644 --- a/README.md +++ b/README.md @@ -107,6 +107,7 @@ their default values. | `metrics.port` | TCP port on which the service metrics is exposed | `5001` | | `metrics.serviceMonitor.annotations` | Prometheus Operator ServiceMonitor annotations | `{}` | | `metrics.serviceMonitor.enable` | If true, Prometheus Operator ServiceMonitor will be created | `false` | +| `metrics.serviceMonitor.namespace` | Namespace where ServiceMonitor should be installed (defaults to current one) | `""` | | `metrics.serviceMonitor.labels` | Prometheus Operator ServiceMonitor labels | `{}` | | `metrics.prometheusRule.annotations` | Prometheus Operator PrometheusRule annotations | `{}` | | `metrics.prometheusRule.enable` | If true, Prometheus Operator prometheusRule will be created | `false` | diff --git a/templates/servicemonitor.yaml b/templates/servicemonitor.yaml index ece2160..4d485fd 100644 --- a/templates/servicemonitor.yaml +++ b/templates/servicemonitor.yaml @@ -3,6 +3,7 @@ apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ template "docker-registry.fullname" . }}-servicemonitor + namespace: {{ default .Release.Namespace .Values.metrics.serviceMonitor.namespace }} labels: app: {{ template "docker-registry.name" . }}-metrics release: {{ .Release.Name }} diff --git a/values.yaml b/values.yaml index 4bdab45..05e9a47 100644 --- a/values.yaml +++ b/values.yaml @@ -126,6 +126,9 @@ metrics: # Create a prometheus-operator servicemonitor serviceMonitor: enabled: false + # Namespace where ServiceMonitor should be installed (i.e. `monitoring`) + # Defaults to namespace where the chart is installed. + namespace: "" labels: {} # prometheus-operator PrometheusRule defining alerting rules for a Prometheus instance prometheusRule: