diff --git a/stable/redis-ha/Chart.yaml b/stable/redis-ha/Chart.yaml index be92ddb852..3bb2eba5dd 100644 --- a/stable/redis-ha/Chart.yaml +++ b/stable/redis-ha/Chart.yaml @@ -5,7 +5,7 @@ keywords: - redis - keyvalue - database -version: 3.1.3 +version: 3.1.4 appVersion: 5.0.3 description: Highly available Kubernetes implementation of Redis icon: https://upload.wikimedia.org/wikipedia/en/thumb/6/6b/Redis_Logo.svg/1200px-Redis_Logo.svg.png @@ -18,3 +18,4 @@ details: sources: - https://redis.io/download - https://github.com/scality/Zenko/tree/development/1.0/kubernetes/zenko/charts/redis-ha +- https://github.com/oliver006/redis_exporter diff --git a/stable/redis-ha/README.md b/stable/redis-ha/README.md index 9a16ff6197..cf5325d27e 100644 --- a/stable/redis-ha/README.md +++ b/stable/redis-ha/README.md @@ -9,8 +9,8 @@ $ helm install stable/redis-ha ``` By default this chart install 3 pods total: - * one pod containing a redis master and sentinel containers - * two pods each containing redis slave and sentinel containers. + * one pod containing a redis master and sentinel container (optional prometheus metrics exporter sidecar available) + * two pods each containing a redis slave and sentinel containers (optional prometheus metrics exporter sidecars available) ## Introduction @@ -73,7 +73,11 @@ The following table lists the configurable parameters of the Redis chart and the | `nodeSelector` | Node labels for pod assignment | `{}` | | `tolerations` | Toleration labels for pod assignment | `[]` | | `podAntiAffinity.server` | Antiaffinity for pod assignment of servers, `hard` or `soft` | `Hard node and soft zone anti-affinity` | - +| `exporter.enabled` | If `true`, the prometheus exporter sidecar is enabled | `false` | +| `exporter.image` | Exporter image | `oliver006/redis_exporter` | +| `exporter.tag` | Exporter tag | `v0.28.0` | +| `exporter.annotations` | Prometheus scrape annotations | `{prometheus.io/path: /metrics, prometheus.io/port: "9121", prometheus.io/scrape: "true"}` | +| `exporter.extraArgs` | Additional args for the exporter | `{}` | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, diff --git a/stable/redis-ha/templates/redis-ha-statefulset.yaml b/stable/redis-ha/templates/redis-ha-statefulset.yaml index cc05c82147..bfb3a1174f 100644 --- a/stable/redis-ha/templates/redis-ha-statefulset.yaml +++ b/stable/redis-ha/templates/redis-ha-statefulset.yaml @@ -22,6 +22,11 @@ spec: {{- if .Values.podAnnotations }} {{ toYaml .Values.podAnnotations | indent 8 }} {{- end }} + {{- if .Values.exporter.enabled }} + prometheus.io/port: "{{ .Values.exporter.port }}" + prometheus.io/scrape: "true" + prometheus.io/path: {{ .Values.exporter.scrapePath }} + {{- end }} labels: release: {{ .Release.Name }} app: {{ template "redis-ha.name" . }} @@ -147,6 +152,41 @@ spec: name: data - mountPath: /probes name: probes +{{- if .Values.exporter.enabled }} + - name: redis-exporter + image: "{{ .Values.exporter.image }}:{{ .Values.exporter.tag }}" + imagePullPolicy: {{ .Values.exporter.pullPolicy }} + args: + {{- range $key, $value := .Values.extraArgs }} + - --{{ $key }}={{ $value }} + {{- end }} + env: + - name: REDIS_ADDR + value: redis://localhost:6379 + {{- if .Values.auth }} + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + {{- if .Values.existingSecret }} + name: {{ .Values.existingSecret }} + {{- else }} + name: {{ template "redis-ha.fullname" . }} + {{- end }} + key: auth + {{- end }} + livenessProbe: + httpGet: + path: {{ .Values.exporter.scrapePath }} + port: {{ .Values.exporter.port }} + initialDelaySeconds: 15 + timeoutSeconds: 1 + periodSeconds: 15 + resources: + {{ toYaml .Values.exporter.resources | indent 10 }} + ports: + - name: exporter-port + containerPort: {{ .Values.exporter.port }} +{{- end }} volumes: - name: config configMap: diff --git a/stable/redis-ha/values.yaml b/stable/redis-ha/values.yaml index 092146b82a..ced15a008c 100644 --- a/stable/redis-ha/values.yaml +++ b/stable/redis-ha/values.yaml @@ -91,6 +91,23 @@ affinity: | release: {{ .Release.Name }} topologyKey: failure-domain.beta.kubernetes.io/zone +# Prometheus exporter specific configuration options +exporter: + enabled: false + image: oliver006/redis_exporter + tag: v0.28.0 + pullPolicy: IfNotPresent + + # prometheus port & scrape path + port: 9121 + scrapePath: /metrics + + # cpu/memory resource limits/requests + resources: {} + + # Additional args for redis exporter + extraArgs: {} + podDisruptionBudget: {} # maxUnavailable: 1 # minAvailable: 1