Skip to content

Commit

Permalink
option to set ServiceMonitor namespace
Browse files Browse the repository at this point in the history
Fixes: twuni#148
Signed-off-by: Fat Dragon <[email protected]>
  • Loading branch information
peske committed Dec 23, 2024
1 parent 541f368 commit f46a790
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` |
Expand Down
1 change: 1 addition & 0 deletions templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
3 changes: 3 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit f46a790

Please sign in to comment.