From 301ac01ba2b4a75b99791e66cb5aa0de3cb6c3db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20de=20Saint=20Martin?= Date: Wed, 5 Dec 2018 11:25:21 +0100 Subject: [PATCH] [stable/redis] Fix ServiceMonitor to not leak. (#9722) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previous definition allowed Prometheus to scrape all redis in all namespaces. Signed-off-by: Cédric de Saint Martin --- stable/redis/Chart.yaml | 2 +- stable/redis/README.md | 2 +- stable/redis/templates/metrics-prometheus.yaml | 4 +++- stable/redis/values.yaml | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/stable/redis/Chart.yaml b/stable/redis/Chart.yaml index 4d979c397761..66d2006c2057 100644 --- a/stable/redis/Chart.yaml +++ b/stable/redis/Chart.yaml @@ -1,5 +1,5 @@ name: redis -version: 5.0.0 +version: 5.1.0 appVersion: 4.0.11 description: Open source, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets. keywords: diff --git a/stable/redis/README.md b/stable/redis/README.md index b2e944723339..fdbbd5500e72 100644 --- a/stable/redis/README.md +++ b/stable/redis/README.md @@ -121,7 +121,7 @@ The following table lists the configurable parameters of the Redis chart and the | `metrics.service.loadBalancerIP` | loadBalancerIP if redis metrics service type is `LoadBalancer` | `nil` | | `metrics.resources` | Exporter resource requests/limit | Memory: `256Mi`, CPU: `100m` | | `metrics.serviceMonitor.enabled` | if `true`, creates a Prometheus Operator ServiceMonitor (also requires `metrics.enabled` to be `true`) | `false` | -| `metrics.serviceMonitor.namespace` | Namespace which Prometheus is running in | `monitoring` | +| `metrics.serviceMonitor.namespace` | Optional namespace which Prometheus is running in | `nil` | | `metrics.serviceMonitor.interval` | How frequently to scrape metrics (use by default, falling back to Prometheus' default) | `nil` | | `metrics.serviceMonitor.selector` | Default to kube-prometheus install (CoreOS recommended), but should be set according to Prometheus install | `{ prometheus: kube-prometheus }` | | `persistence.existingClaim` | Provide an existing PersistentVolumeClaim | `nil` | diff --git a/stable/redis/templates/metrics-prometheus.yaml b/stable/redis/templates/metrics-prometheus.yaml index 369aa2776df0..3f3345430f9d 100644 --- a/stable/redis/templates/metrics-prometheus.yaml +++ b/stable/redis/templates/metrics-prometheus.yaml @@ -23,6 +23,8 @@ spec: selector: matchLabels: app: {{ template "redis.name" . }} + release: {{ .Release.Name }} namespaceSelector: - any: true + matchNames: + - {{ .Release.Namespace }} {{- end -}} diff --git a/stable/redis/values.yaml b/stable/redis/values.yaml index 8a22b9b6aaf8..d6990a7fda87 100644 --- a/stable/redis/values.yaml +++ b/stable/redis/values.yaml @@ -339,7 +339,8 @@ metrics: # Enable this if you're using https://github.com/coreos/prometheus-operator serviceMonitor: enabled: false - namespace: monitoring + ## Specify a namespace if needed + # namespace: monitoring # fallback to the prometheus default unless specified # interval: 10s ## Defaults to what's used if you follow CoreOS [Prometheus Install Instructions](https://github.com/helm/charts/tree/master/stable/prometheus-operator#tldr)