mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
[stable/redis-ha]: added ability to specify exporter lua script (#20695)
* feat: redis-ha: added ability to specify exporter lua script Signed-off-by: jwenz723 <jwenz723@gmail.com> * Update stable/redis-ha/README.md Co-Authored-By: Aaron Layfield <Aaron.Layfield@gmail.com> Signed-off-by: jwenz723 <jwenz723@gmail.com> * updated exporter script configuration to create the cm Signed-off-by: jwenz723 <jwenz723@gmail.com> Co-authored-by: Aaron Layfield <Aaron.Layfield@gmail.com>
This commit is contained in:
co-authored by
Aaron Layfield
parent
6ad9947c28
commit
bfddd23f2f
@@ -6,7 +6,7 @@ keywords:
|
||||
- redis
|
||||
- keyvalue
|
||||
- database
|
||||
version: 4.3.3
|
||||
version: 4.3.4
|
||||
appVersion: 5.0.6
|
||||
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
|
||||
|
||||
@@ -93,6 +93,7 @@ The following table lists the configurable parameters of the Redis chart and the
|
||||
| `exporter.port` | Exporter port | `9121` |
|
||||
| `exporter.annotations` | Prometheus scrape annotations | `{prometheus.io/path: /metrics, prometheus.io/port: "9121", prometheus.io/scrape: "true"}` |
|
||||
| `exporter.extraArgs` | Additional args for the exporter | `{}` |
|
||||
| `exporter.script` | A custom custom Lua script that will be mounted to exporter for collection of custom metrics. Creates a ConfigMap and sets env var `REDIS_EXPORTER_SCRIPT`. | |
|
||||
| `exporter.serviceMonitor.enabled` | Use servicemonitor from prometheus operator | `false` |
|
||||
| `exporter.serviceMonitor.namespace` | Namespace the service monitor is created in | `default` |
|
||||
| `exporter.serviceMonitor.interval` | Scrape interval, If not set, the Prometheus default scrape interval is used | `nil` |
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{{- if .Values.exporter.script }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "redis-ha.fullname" . }}-exporter-script-configmap
|
||||
namespace: {{ .Release.Namespace }}
|
||||
labels:
|
||||
{{ include "labels.standard" . | indent 4 }}
|
||||
data:
|
||||
script: {{ toYaml .Values.exporter.script | indent 2 }}
|
||||
{{- end }}
|
||||
@@ -237,6 +237,10 @@ spec:
|
||||
{{- end }}
|
||||
key: {{ .Values.authKey }}
|
||||
{{- end }}
|
||||
{{- if .Values.exporter.script }}
|
||||
- name: REDIS_EXPORTER_SCRIPT
|
||||
value: /script/script.lua
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: {{ .Values.exporter.scrapePath }}
|
||||
@@ -249,6 +253,11 @@ spec:
|
||||
ports:
|
||||
- name: exporter-port
|
||||
containerPort: {{ .Values.exporter.port }}
|
||||
{{- if .Values.exporter.script }}
|
||||
volumeMounts:
|
||||
- mountPath: /script
|
||||
name: script-mount
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.priorityClassName }}
|
||||
priorityClassName: {{ .Values.priorityClassName }}
|
||||
@@ -262,6 +271,14 @@ spec:
|
||||
hostPath:
|
||||
path: /sys
|
||||
{{- end }}
|
||||
{{- if .Values.exporter.script }}
|
||||
- name: script-mount
|
||||
configMap:
|
||||
name: {{ template "redis-ha.fullname" . }}-exporter-script-configmap
|
||||
items:
|
||||
- key: script
|
||||
path: script.lua
|
||||
{{- end }}
|
||||
{{- if .Values.persistentVolume.enabled }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
|
||||
@@ -259,6 +259,31 @@ exporter:
|
||||
# Additional args for redis exporter
|
||||
extraArgs: {}
|
||||
|
||||
# Used to mount a LUA-Script via config map and use it for metrics-collection
|
||||
# script: |
|
||||
# -- Example script copied from: https://github.com/oliver006/redis_exporter/blob/master/contrib/sample_collect_script.lua
|
||||
# -- Example collect script for -script option
|
||||
# -- This returns a Lua table with alternating keys and values.
|
||||
# -- Both keys and values must be strings, similar to a HGETALL result.
|
||||
# -- More info about Redis Lua scripting: https://redis.io/commands/eval
|
||||
#
|
||||
# local result = {}
|
||||
#
|
||||
# -- Add all keys and values from some hash in db 5
|
||||
# redis.call("SELECT", 5)
|
||||
# local r = redis.call("HGETALL", "some-hash-with-stats")
|
||||
# if r ~= nil then
|
||||
# for _,v in ipairs(r) do
|
||||
# table.insert(result, v) -- alternating keys and values
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# -- Set foo to 42
|
||||
# table.insert(result, "foo")
|
||||
# table.insert(result, "42") -- note the string, use tostring() if needed
|
||||
#
|
||||
# return result
|
||||
|
||||
serviceMonitor:
|
||||
# When set true then use a ServiceMonitor to configure scraping
|
||||
enabled: false
|
||||
|
||||
Reference in New Issue
Block a user