Skip to content

Commit 6fb27af

Browse files
committed
add var to simplify redis init checks
Signed-off-by: cabrinha <yuppie@hey.com>
1 parent fd39fe9 commit 6fb27af

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

dist/chart/templates/gateway-plugin/deployment.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{- if .Values.gateway.enable }}
2+
{{- $redisHost := default (printf "%s-redis-master" (include "aibrix.fullname" .)) .Values.gatewayPlugin.dependencies.redis.host }}
23
apiVersion: apps/v1
34
kind: Deployment
45
metadata:
@@ -63,9 +64,9 @@ spec:
6364
secretKeyRef:
6465
name: {{ include "aibrix.fullname" . }}-redis
6566
key: redis-password
66-
command: ['sh', '-c', 'until printf ''AUTH %s\nping\n'' "$REDIS_PASSWORD" | nc {{ .Values.gatewayPlugin.dependencies.redis.host }} {{ .Values.gatewayPlugin.dependencies.redis.port }} -w 1 | grep -c PONG; do echo waiting for redis; sleep 2; done']
67+
command: ['sh', '-c', 'until printf ''AUTH %s\nping\n'' "$REDIS_PASSWORD" | nc {{ $redisHost }} {{ .Values.gatewayPlugin.dependencies.redis.port }} -w 1 | grep -c PONG; do echo waiting for redis; sleep 2; done']
6768
{{- else }}
68-
command: ['sh', '-c', 'until echo "ping" | nc {{ .Values.gatewayPlugin.dependencies.redis.host }} {{ .Values.gatewayPlugin.dependencies.redis.port }} -w 1 | grep -c PONG; do echo waiting for redis; sleep 2; done']
69+
command: ['sh', '-c', 'until echo "ping" | nc {{ $redisHost }} {{ .Values.gatewayPlugin.dependencies.redis.port }} -w 1 | grep -c PONG; do echo waiting for redis; sleep 2; done']
6970
{{- end }}
7071
containers:
7172
- name: gateway-plugin

dist/chart/templates/metadata-service/deployment.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
{{- $redisHost := default (printf "%s-redis-master" (include "aibrix.fullname" .)) .Values.metadata.service.redis.host }}
12
apiVersion: apps/v1
23
kind: Deployment
34
metadata:
@@ -29,9 +30,9 @@ spec:
2930
secretKeyRef:
3031
name: {{ include "aibrix.fullname" . }}-redis
3132
key: redis-password
32-
command: ['sh', '-c', 'until printf ''AUTH %s\nping\n'' "$REDIS_PASSWORD" | nc {{ .Values.metadata.service.redis.host }} {{ .Values.metadata.service.redis.port }} -w 1 | grep -c PONG; do echo waiting for redis; sleep 2; done']
33+
command: ['sh', '-c', 'until printf ''AUTH %s\nping\n'' "$REDIS_PASSWORD" | nc {{ $redisHost }} {{ .Values.metadata.service.redis.port }} -w 1 | grep -c PONG; do echo waiting for redis; sleep 2; done']
3334
{{- else }}
34-
command: ['sh', '-c', 'until echo "ping" | nc {{ .Values.metadata.service.redis.host }} {{ .Values.metadata.service.redis.port }} -w 1 | grep -c PONG; do echo waiting for redis; sleep 2; done']
35+
command: ['sh', '-c', 'until echo "ping" | nc {{ $redisHost }} {{ .Values.metadata.service.redis.port }} -w 1 | grep -c PONG; do echo waiting for redis; sleep 2; done']
3536
{{- end }}
3637
containers:
3738
- name: metadata-service
@@ -60,7 +61,7 @@ spec:
6061
periodSeconds: 5
6162
env:
6263
- name: REDIS_HOST
63-
value: {{ default (printf "%s-redis-master" (include "aibrix.fullname" .)) .Values.metadata.service.redis.host }}
64+
value: {{ $redisHost }}
6465
- name: REDIS_PORT
6566
value: "{{ .Values.metadata.service.redis.port }}"
6667
{{- if .Values.metadata.redis.enablePassword }}

0 commit comments

Comments
 (0)