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

Commit

Permalink
KeyDB: backward incompatible changes! Extra args are now arrays. Intr…
Browse files Browse the repository at this point in the history
…oduce PVC selector.
  • Loading branch information
Antiarchitect committed Dec 7, 2021
1 parent c31d654 commit 1bea47b
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 15 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.28.4
version: 0.29.0
keywords:
- keydb
- redis
Expand Down
40 changes: 38 additions & 2 deletions keydb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,41 @@ helm install keydb enapter/keydb

This chart bootstraps a [KeyDB](https://keydb.dev) highly available multi-master statefulset in a [Kubernetes](http://kubernetes.io) cluster using the Helm package manager.

## 0.29.0 Upgrade notice

As the chart is not yet production ready (0.x) backward incompatible changes can be introduced in minor releases.
Since 0.29.0 `configExtraArgs` and `exporter.extraArgs` are now arrays of dicts in order to allow repeating arguments with the same key.
If dict value is an array it is interpreted as multiple arguments for the key.

### Config Example:

```
configExtraArgs:
- client-output-buffer-limit: ["normal", "0", "0", "0"]
- client-output-buffer-limit: ["replica", "268435456", "67108864", "60"]
- client-output-buffer-limit: ["pubsub", "33554432", "8388608", "60"]
- save: ~
- tcp-backlog "1024"
```

### Resulting File:

```
...
exec keydb-server /etc/keydb/redis.conf \
...
--client-output-buffer-limit "normal" "0" "0" "0" \
--client-output-buffer-limit "replica" "268435456" "67108864" "60" \
--client-output-buffer-limit "pubsub" "33554432" "8388608" "60" \
--save \
--tcp-backlog "1024" \
...
```

## Prerequisites

- PV provisioner support in the underlying infrastructure if you want to enable persistence
Expand Down Expand Up @@ -43,7 +78,7 @@ The following table lists the configurable parameters of the KeyDB chart and the
| `activeReplicas` | KeyDB active replication setup | `yes` |
| `protectedMode` | KeyDB protection mode | `no` |
| `appendonly` | KeyDB appendonly setting | `no` |
| `configExtraArgs` | Additional configuration arguments for KeyDB | `{}` |
| `configExtraArgs` | Additional configuration arguments for KeyDB | `[]` |
| `annotations` | KeyDB StatefulSet annotations | `{}` |
| `podAnnotations` | KeyDB pods annotations | `{}` |
| `tolerations` | KeyDB tolerations setting | `{}` |
Expand All @@ -57,6 +92,7 @@ The following table lists the configurable parameters of the KeyDB chart and the
| `startupProbe.custom` | Custom StartupProbe for KeyDB pods | `{}` |
| `persistentVolume.enabled` | Should PVC be created via volumeClaimTemplates | `true` |
| `persistentVolume.accessModes` | Volume access modes | `[ReadWriteOnce]` |
| `persistentVolume.selector` | PVC selector. (In order to match existing PVs) | `{}` |
| `persistentVolume.size` | Size of the volume | `1Gi` |
| `persistentVolume.storageClass` | StorageClassName for volume | `` |
| `resources` | Resources for KeyDB containers | `{}` |
Expand All @@ -80,7 +116,7 @@ The following table lists the configurable parameters of the KeyDB chart and the
| `exporter.readinessProbe` | ReadinessProbe for sidecar Prometheus exporter | Look values.yaml |
| `exporter.startupProbe` | StartupProbe for sidecar Prometheus exporter | Look values.yaml |
| `exporter.resources` | Resources for sidecar Prometheus container | `{}` |
| `exporter.extraArgs` | Additional arguments for exporter | `{}` |
| `exporter.extraArgs` | Additional arguments for exporter | `[]` |

## Using existingSecret

Expand Down
20 changes: 12 additions & 8 deletions keydb/templates/secret-utils.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,22 @@ stringData:
--port "${port}" \
--protected-mode {{ .Values.protectedMode | quote }} \
--server-threads {{ .Values.threads | quote }} \
{{- if .Values.existingSecret }}
{{- if .Values.existingSecret }}
--masterauth "${REDIS_PASSWORD}" \
--requirepass "${REDIS_PASSWORD}" \
{{- else if .Values.password }}
{{- else if .Values.password }}
--masterauth {{ .Values.password | quote }} \
--requirepass {{ .Values.password | quote }} \
{{- end }}
{{- range $key, $value := .Values.configExtraArgs }}
{{- if not (kindIs "invalid" $value) }}
--{{ $key }} {{ $value | quote }} \
{{- else }}
{{- end }}
{{- range $item := .Values.configExtraArgs }}
{{- range $key, $value := $item }}
{{- if kindIs "invalid" $value }}
--{{ $key }} \
{{- else if kindIs "slice" $value }}
--{{ $key }}{{ range $value }} {{ . | quote }}{{ end }} \
{{- else }}
--{{ $key }} {{ $value | quote }} \
{{- end }}
{{- end }}
{{- end }}
{{- end }}
"${replicas[@]}"
16 changes: 14 additions & 2 deletions keydb/templates/sts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,16 @@ spec:
image: {{ .Values.exporter.image }}
imagePullPolicy: {{ .Values.exporter.pullPolicy }}
args:
{{- range $key, $value := .Values.exporter.extraArgs }}
- --{{ $key }}={{ $value }}
{{- range $item := .Values.exporter.extraArgs }}
{{- range $key, $value := $item }}
{{- if kindIs "invalid" $value }}
--{{ $key }} \
{{- else if kindIs "slice" $value }}
--{{ $key }}{{ range $value }} {{ . | quote }}{{ end }} \
{{- else }}
--{{ $key }} {{ $value | quote }} \
{{- end }}
{{- end }}
{{- end }}
env:
- name: REDIS_ADDR
Expand Down Expand Up @@ -263,4 +271,8 @@ spec:
storageClassName: {{ .Values.persistentVolume.storageClass }}
{{- end }}
{{- end }}
{{- if .Values.persistentVolume.selector }}
selector:
{{- toYaml .Values.persistentVolume.selector | nindent 8 }}
{{- end }}
{{- end }}
17 changes: 15 additions & 2 deletions keydb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ appendonly: "no"

annotations: {}

configExtraArgs: {}
configExtraArgs: []
# - somesimple: "argument"
# - client-output-buffer-limit: ["normal", "0", "0", "0"]
# - client-output-buffer-limit: ["replica", "268435456", "67108864", "60"]
# - client-output-buffer-limit: ["pubsub", "33554432", "8388608", "60"]

podAnnotations: {}

Expand Down Expand Up @@ -107,6 +111,11 @@ persistentVolume:
enabled: true
accessModes:
- ReadWriteOnce
selector: {}
# matchLabels:
# release: "stable"
# matchExpressions:
# - {key: environment, operator: In, values: [dev]}
size: 1Gi

## If defined, storageClassName: <storageClass>
Expand Down Expand Up @@ -187,7 +196,11 @@ exporter:
resources: {}

# Additional args for redis exporter
extraArgs: {}
extraArgs: []
# - somesimple: "argument"
# - client-output-buffer-limit: ["normal", "0", "0", "0"]
# - client-output-buffer-limit: ["replica", "268435456", "67108864", "60"]
# - client-output-buffer-limit: ["pubsub", "33554432", "8388608", "60"]

scripts:
enabled: false
Expand Down

0 comments on commit 1bea47b

Please sign in to comment.