From e55b64195ad0ff7941825798822bee2d36cda5d3 Mon Sep 17 00:00:00 2001 From: Andrey Voronkov Date: Mon, 13 Mar 2023 12:58:22 +0300 Subject: [PATCH] keydb: separate internal and external ports for keydb --- keydb/Chart.yaml | 2 +- keydb/templates/secret-utils.yaml | 5 ++--- keydb/templates/sts.yaml | 18 ++++++++++-------- keydb/templates/svc-headless.yaml | 2 +- keydb/templates/svc-lb.yaml | 2 +- keydb/templates/svc.yaml | 4 ++-- keydb/values.yaml | 2 ++ 7 files changed, 19 insertions(+), 16 deletions(-) diff --git a/keydb/Chart.yaml b/keydb/Chart.yaml index 663a629..77f6b14 100644 --- a/keydb/Chart.yaml +++ b/keydb/Chart.yaml @@ -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 diff --git a/keydb/templates/secret-utils.yaml b/keydb/templates/secret-utils.yaml index c40da33..ec9b8fb 100644 --- a/keydb/templates/secret-utils.yaml +++ b/keydb/templates/secret-utils.yaml @@ -11,11 +11,10 @@ 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 \ @@ -23,7 +22,7 @@ stringData: --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 }} diff --git a/keydb/templates/sts.yaml b/keydb/templates/sts.yaml index 9ce339f..7dd9927 100644 --- a/keydb/templates/sts.yaml +++ b/keydb/templates/sts.yaml @@ -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: @@ -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: @@ -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: @@ -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 }} @@ -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: diff --git a/keydb/templates/svc-headless.yaml b/keydb/templates/svc-headless.yaml index dbdb333..ea4298e 100644 --- a/keydb/templates/svc-headless.yaml +++ b/keydb/templates/svc-headless.yaml @@ -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 }} diff --git a/keydb/templates/svc-lb.yaml b/keydb/templates/svc-lb.yaml index 9e01377..4370915 100644 --- a/keydb/templates/svc-lb.yaml +++ b/keydb/templates/svc-lb.yaml @@ -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 }} diff --git a/keydb/templates/svc.yaml b/keydb/templates/svc.yaml index 7d8d807..1d1ef1d 100644 --- a/keydb/templates/svc.yaml +++ b/keydb/templates/svc.yaml @@ -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 }} diff --git a/keydb/values.yaml b/keydb/values.yaml index ed94104..bb0c7f3 100644 --- a/keydb/values.yaml +++ b/keydb/values.yaml @@ -13,6 +13,8 @@ existingSecret: "" existingSecretPasswordKey: "password" port: 6379 portName: server +internalPort: 6379 +internalPortName: keydb threads: 2