Skip to content
This repository has been archived by the owner on Jun 6, 2023. It is now read-only.

Commit

Permalink
keydb: 0.28.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Antiarchitect committed Nov 30, 2021
1 parent 14d5bea commit 275e5fa
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 99 deletions.
2 changes: 1 addition & 1 deletion keydb/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: keydb
description: A Helm chart for KeyDB multimaster setup
type: application
version: 0.27.2
version: 0.28.0
keywords:
- keydb
- redis
Expand Down
11 changes: 6 additions & 5 deletions keydb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The following table lists the configurable parameters of the KeyDB chart and the

| Parameter | Description | Default |
|:--------------------------------|:---------------------------------------------------|:------------------------------------------|
| `image` | KeyDB docker image | `eqalpha/keydb:x86_64_v6.2.0` |
| `image` | KeyDB docker image | `eqalpha/keydb:x86_64_v6.2.1` |
| `imagePullPolicy` | K8s imagePullPolicy | `IfNotPresent` |
| `nodes` | Number of KeyDB master pods | `3` |
| `password` | If enabled KeyDB servers are password-protected | `""` |
Expand All @@ -52,14 +52,15 @@ The following table lists the configurable parameters of the KeyDB chart and the
| `extraInitContainers` | Additional init containers for StatefulSet | `[]` |
| `extraContainers` | Additional sidecar containers for StatefulSet | `[]` |
| `extraVolumes` | Additional volumes for init and sidecar containers | `[]` |
| `livenessProbe` | LivenessProbe for KeyDB pods | Look values.yaml |
| `readinessProbe` | ReadinessProbe for KeyDB pods | Look values.yaml |
| `startupProbe` | StartupProbe for KeyDB pods | Look values.yaml |
| `livenessProbe.custom` | Custom LivenessProbe for KeyDB pods | `{}` |
| `readinessProbe.custom` | Custom ReadinessProbe for KeyDB pods | `{}` |
| `startupProbe.custom` | Custom StartupProbe for KeyDB pods | `{}` |
| `persistentVolume.enabled` | Should PVC be created via volumeClaimTemplates | `true` |
| `persistentVolume.accessModes` | Volume access modes | `[ReadWriteOnce]` |
| `persistentVolume.size` | Size of the volume | `1Gi` |
| `persistentVolume.storageClass` | StorageClassName for volume | `` |
| `resources` | Resources for KeyDB containers | `{}` |
| `scripts.enabled` | Turn on health util scripts | `false` |
| `securityContext` | SecurityContext for KeyDB pods | `{}` |
| `service.annotations` | Service annotations | `{}` |
| `loadBalancer.enabled` | Create LoadBalancer service | `false` |
Expand All @@ -71,7 +72,7 @@ The following table lists the configurable parameters of the KeyDB chart and the
| `serviceMonitor.interval` | ServiceMonitor scrape interval | `30s` |
| `serviceMonitor.scrapeTimeout` | ServiceMonitor scrape timeout | `nil` |
| `exporter.enabled` | Prometheus Exporter sidecar contaner | `false` |
| `exporter.image` | Exporter Image | `oliver006/redis_exporter:v1.12.1-alpine` |
| `exporter.image` | Exporter Image | `oliver006/redis_exporter:v1.31.4-alpine` |
| `exporter.pullPolicy` | Exporter imagePullPolicy | `IfNotPresent` |
| `exporter.port` | `prometheus.io/port` | `9121` |
| `exporter.scrapePath` | `prometheus.io/path` | `/metrics` |
Expand Down
68 changes: 68 additions & 0 deletions keydb/templates/cm-health.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "keydb.fullname" . }}-health
labels:
{{ include "keydb.labels" . | nindent 4 }}
data:
ping_readiness_local.sh: |-
#!/bin/bash
set -eo pipefail
[[ -n "${REDIS_PASSWORD}" ]] && export REDISCLI_AUTH="${REDIS_PASSWORD}"
response="$(
timeout -s 3 "${1}" \
keydb-cli \
-h localhost \
-p "${REDIS_PORT}" \
ping
)"
if [ "${response}" != "PONG" ]; then
echo "${response}"
exit 1
fi
ping_liveness_local.sh: |-
#!/bin/bash
set -eo pipefail
[[ -n "${REDIS_PASSWORD}" ]] && export REDISCLI_AUTH="${REDIS_PASSWORD}"
response="$(
timeout -s 3 "${1}" \
keydb-cli \
-h localhost \
-p "${REDIS_PORT}" \
ping
)"
if [ "${response}" != "PONG" ] && [ "${response}" != "LOADING Redis is loading the dataset in memory" ]; then
echo "${response}"
exit 1
fi
{{- if .Values.scripts.enabled }}

scripts_local.sh: |-
#!/bin/bash
set -eo pipefail
script_dir="$(dirname "$0")"
while true; do
{{- if .Values.scripts.cleanup.enabled }}
"${script_dir}/cleanup_local_data.sh" || exit $?
{{- end }}
sleep 60
done
{{- end }}

{{- if .Values.scripts.cleanup.enabled }}

cleanup_local_data.sh: |-
#!/bin/bash
set -eo pipefail
find /data/ -type f -name temp-*.rdb -mmin +{{ .Values.scripts.cleanup.minutes }} -delete
{{- end }}
69 changes: 0 additions & 69 deletions keydb/templates/health-configmap.yaml

This file was deleted.

36 changes: 26 additions & 10 deletions keydb/templates/sts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ spec:
containerPort: {{ .Values.port | int }}
protocol: TCP
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
{{- if .Values.livenessProbe.custom }}
{{- toYaml .Values.livenessProbe.custom | nindent 10 }}
{{- else }}
livenessProbe:
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
Expand All @@ -88,11 +92,13 @@ spec:
- sh
- -c
- /health/ping_liveness_local.sh {{ .Values.livenessProbe.timeoutSeconds }}
{{- else if .Values.customLivenessProbe }}
livenessProbe: {{- toYaml .Values.customLivenessProbe | nindent 10 }}
{{- end }}
{{- end }}
{{- if .Values.readinessProbe.enabled }}
readinessProbe:
{{- if .Values.readinessProbe.custom }}
{{- toYaml .Values.readinessProbe.custom | nindent 10 }}
{{- else }}
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
# One second longer than command timeout should prevent generation of zombie processes.
Expand All @@ -104,13 +110,23 @@ spec:
- sh
- -c
- /health/ping_readiness_local.sh {{ .Values.readinessProbe.timeoutSeconds }}
{{- else if .Values.customReadinessProbe }}
readinessProbe:
{{- toYaml .Values.customReadinessProbe | nindent 10 }}
{{- end }}
{{- if .Values.startupProbe }}
{{- end }}
{{- if .Values.startupProbe.enabled }}
startupProbe:
{{- toYaml .Values.startupProbe | nindent 10 }}
{{- if .Values.startupProbe.custom }}
{{- toYaml .Values.startupProbe.custom | nindent 10 }}
{{- else }}
periodSeconds: {{ .Values.startupProbe.periodSeconds }}
# One second longer than command timeout should prevent generation of zombie processes.
timeoutSeconds: {{ add1 .Values.startupProbe.timeoutSeconds }}
failureThreshold: {{ .Values.startupProbe.failureThreshold }}
exec:
command:
- sh
- -c
- /health/ping_readiness_local.sh {{ .Values.startupProbe.timeoutSeconds }}
{{- end }}
{{- end }}
{{- if .Values.lifecycle }}
lifecycle:
Expand All @@ -136,7 +152,7 @@ spec:
{{- end }}
env:
- name: REDIS_ADDR
value: redis://localhost:{{ .Values.port | int }}
value: redis://localhost:6379
- name: REDIS_PORT
value: {{ .Values.port | quote }}
{{- if .Values.existingSecret }}
Expand Down Expand Up @@ -167,7 +183,7 @@ spec:
- name: redis-exporter
containerPort: {{ .Values.exporter.port }}
{{- end }}
{{- if (.Values.scripts).enabled }}
{{- if .Values.scripts.enabled }}
- name: scripts
image: {{ .Values.image }}
imagePullPolicy: {{ .Values.imagePullPolicy }}
Expand Down Expand Up @@ -210,7 +226,7 @@ spec:
volumes:
- name: health
configMap:
name: {{ printf "%s-health" (include "keydb.fullname" . ) }}
name: {{ include "keydb.fullname" . }}-health
defaultMode: 0755
- name: utils
secret:
Expand Down
30 changes: 16 additions & 14 deletions keydb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,36 +61,38 @@ extraVolumes: []
# Liveness Probe
livenessProbe:
enabled: true
custom: {}
# tcpSocket:
# port: keydb
# initialDelaySeconds: 30
initialDelaySeconds: 20
periodSeconds: 5
timeoutSeconds: 5
successThreshold: 1
failureThreshold: 5

customLivenessProbe: {}
# tcpSocket:
# port: keydb

# Readiness Probe
readinessProbe:
enabled: true
custom: {}
# tcpSocket:
# port: keydb
# initialDelaySeconds: 30
initialDelaySeconds: 20
periodSeconds: 5
timeoutSeconds: 1
successThreshold: 1
failureThreshold: 5

customReadinessProbe: {}
# tcpSocket:
# port: keydb
# initialDelaySeconds: 30

# Startup Probe
startupProbe:
tcpSocket:
port: keydb
failureThreshold: 30
enabled: true
custom: {}
# tcpSocket:
# port: keydb
periodSeconds: 5
timeoutSeconds: 1
failureThreshold: 24

# Lifecycle Hooks
lifecycle: {}
Expand Down Expand Up @@ -178,7 +180,7 @@ exporter:
httpGet:
path: /health
port: 9121
failureThreshold: 30
failureThreshold: 24
periodSeconds: 5

# CPU/Memory resource limits/requests
Expand All @@ -192,5 +194,5 @@ scripts:
# CPU/Memory resource limits/requests
resources: {}
cleanup:
enabled: false
enabled: true
minutes: 60

0 comments on commit 275e5fa

Please sign in to comment.