diff --git a/stable/redis/Chart.yaml b/stable/redis/Chart.yaml index f11ed45bba..9a493d88b8 100644 --- a/stable/redis/Chart.yaml +++ b/stable/redis/Chart.yaml @@ -1,5 +1,5 @@ name: redis -version: 4.2.10 +version: 4.3.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 a14da72697..d7e88295a4 100644 --- a/stable/redis/README.md +++ b/stable/redis/README.md @@ -109,6 +109,10 @@ The following table lists the configurable parameters of the Redis chart and the | `metrics.service.annotations` | Annotations for the services to monitor (redis master and redis slave service) | {} | | `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.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` | | `master.persistence.enabled` | Use a PVC to persist data (master node) | `true` | | `master.persistence.path` | Path to mount the volume at, to use other images | `/bitnami` | diff --git a/stable/redis/templates/metrics-prometheus.yaml b/stable/redis/templates/metrics-prometheus.yaml new file mode 100644 index 0000000000..369aa2776d --- /dev/null +++ b/stable/redis/templates/metrics-prometheus.yaml @@ -0,0 +1,28 @@ +{{- if and (.Values.metrics.enabled) (.Values.metrics.serviceMonitor.enabled) }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: {{ template "redis.fullname" . }} + {{- if .Values.metrics.serviceMonitor.namespace }} + namespace: {{ .Values.metrics.serviceMonitor.namespace }} + {{- end }} + labels: + app: {{ template "redis.name" . }} + chart: {{ template "redis.chart" . }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + {{- range $key, $value := .Values.metrics.serviceMonitor.selector }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + endpoints: + - port: metrics + {{- if .Values.metrics.serviceMonitor.interval }} + interval: {{ .Values.metrics.serviceMonitor.interval }} + {{- end }} + selector: + matchLabels: + app: {{ template "redis.name" . }} + namespaceSelector: + any: true +{{- end -}} diff --git a/stable/redis/values-production.yaml b/stable/redis/values-production.yaml index 94d56e4f76..3d63bb7d0c 100644 --- a/stable/redis/values-production.yaml +++ b/stable/redis/values-production.yaml @@ -337,6 +337,18 @@ metrics: # podAnnotations: {} # podLabels: {} + # Enable this if you're using https://github.com/coreos/prometheus-operator + serviceMonitor: + enabled: false + 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) + ## [Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#prometheus-operator-1) + ## [Kube Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#exporters) + selector: + prometheus: kube-prometheus + ## ## Init containers parameters: ## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup diff --git a/stable/redis/values.yaml b/stable/redis/values.yaml index 0ceb1f17a0..b1ef804ccb 100644 --- a/stable/redis/values.yaml +++ b/stable/redis/values.yaml @@ -341,6 +341,18 @@ metrics: # podAnnotations: {} # podLabels: {} + # Enable this if you're using https://github.com/coreos/prometheus-operator + serviceMonitor: + enabled: false + 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) + ## [Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#prometheus-operator-1) + ## [Kube Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#exporters) + selector: + prometheus: kube-prometheus + ## ## Init containers parameters: ## volumePermissions: Change the owner of the persist volume mountpoint to RunAsUser:fsGroup