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

Commit

Permalink
keydb: separate internal and external ports for keydb
Browse files Browse the repository at this point in the history
  • Loading branch information
Antiarchitect committed Mar 13, 2023
1 parent a603b01 commit e55b641
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 16 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.46.3
version: 0.47.0
keywords:
- keydb
- redis
Expand Down
5 changes: 2 additions & 3 deletions keydb/templates/secret-utils.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@ stringData:
set -euxo pipefail
host="$(hostname)"
port="6379"
replicas=()
for node in {0..{{ (sub (.Values.nodes | int) 1) }}}; do
if [ "${host}" != "{{ include "keydb.fullname" . }}-${node}" ]; then
replicas+=("--replicaof {{ include "keydb.fullname" . }}-${node}.{{ include "keydb.fullname" . }}-headless ${port}")
replicas+=("--replicaof {{ include "keydb.fullname" . }}-${node}.{{ include "keydb.fullname" . }}-headless {{ .Values.port }}")
fi
done
exec keydb-server /etc/keydb/redis.conf \
--active-replica {{ .Values.activeReplicas | quote }} \
--multi-master {{ .Values.multiMaster | quote }} \
--appendonly {{ .Values.appendonly | quote }} \
--bind "0.0.0.0" \
--port "${port}" \
--port "{{ .Values.internalPort }}" \
--protected-mode {{ .Values.protectedMode | quote }} \
--server-threads {{ .Values.threads | quote }} \
{{- if .Values.existingSecret }}
Expand Down
18 changes: 10 additions & 8 deletions keydb/templates/sts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ spec:
- /utils/server.sh
env:
- name: REDIS_PORT
value: {{ .Values.port | quote }}
value: {{ .Values.internalPort | quote }}
{{- if .Values.existingSecret }}
- name: REDIS_PASSWORD
valueFrom:
Expand All @@ -59,8 +59,8 @@ spec:
value: "{{ .Values.password }}"
{{- end }}
ports:
- name: keydb
containerPort: {{ .Values.port | int }}
- name: {{ .Values.internalPortName }}
containerPort: {{ .Values.internalPort | int }}
protocol: TCP
{{- if .Values.livenessProbe.enabled }}
livenessProbe:
Expand Down Expand Up @@ -155,10 +155,12 @@ spec:
{{- end }}
{{- end }}
env:
- name: REDIS_EXPORTER_WEB_LISTEN_ADDRESS
value: "0.0.0.0:{{ .Values.exporter.port }}"
- name: REDIS_EXPORTER_WEB_TELEMETRY_PATH
value: {{ .Values.exporter.scrapePath | quote }}
- name: REDIS_ADDR
value: redis://localhost:6379
- name: REDIS_PORT
value: {{ .Values.port | quote }}
value: "redis://localhost:{{ .Values.internalPort }}"
{{- if .Values.existingSecret }}
- name: REDIS_PASSWORD
valueFrom:
Expand Down Expand Up @@ -186,7 +188,7 @@ spec:
securityContext:
{{- toYaml .Values.exporter.securityContext | nindent 10 }}
ports:
- name: redis-exporter
- name: {{ .Values.exporter.portName | quote }}
containerPort: {{ .Values.exporter.port }}
protocol: TCP
{{- end }}
Expand All @@ -202,7 +204,7 @@ spec:
- /health/scripts_local.sh
env:
- name: REDIS_PORT
value: {{ .Values.port | quote }}
value: {{ .Values.internalPort | quote }}
{{- if .Values.existingSecret }}
- name: REDIS_PASSWORD
valueFrom:
Expand Down
2 changes: 1 addition & 1 deletion keydb/templates/svc-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ spec:
- name: {{ .Values.portName | quote }}
port: {{ .Values.port | int }}
protocol: TCP
targetPort: keydb
targetPort: {{ .Values.internalPortName | quote }}
{{- if .Values.service.appProtocol.enabled }}
appProtocol: redis
{{- end }}
Expand Down
2 changes: 1 addition & 1 deletion keydb/templates/svc-lb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
- name: {{ .Values.portName | quote }}
port: {{ .Values.port | int }}
protocol: TCP
targetPort: keydb
targetPort: {{ .Values.internalPortName | quote }}
{{- if .Values.service.appProtocol.enabled }}
appProtocol: redis
{{- end }}
Expand Down
4 changes: 2 additions & 2 deletions keydb/templates/svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ spec:
- name: {{ .Values.portName | quote }}
port: {{ .Values.port | int }}
protocol: TCP
targetPort: keydb
targetPort: {{ .Values.internalPortName | quote }}
{{- if .Values.service.appProtocol.enabled }}
appProtocol: redis
{{- end }}
- name: {{ .Values.exporter.portName | quote }}
port: {{ .Values.exporter.port | int }}
protocol: TCP
targetPort: redis-exporter
targetPort: {{ .Values.exporter.portName | quote }}
{{- if .Values.service.appProtocol.enabled }}
appProtocol: http
{{- end }}
Expand Down
2 changes: 2 additions & 0 deletions keydb/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ existingSecret: ""
existingSecretPasswordKey: "password"
port: 6379
portName: server
internalPort: 6379
internalPortName: keydb

threads: 2

Expand Down

0 comments on commit e55b641

Please sign in to comment.