From 40410411ebffee7162a7b7e739d924102856ece1 Mon Sep 17 00:00:00 2001 From: Mahima Singh <105724608+smahima27@users.noreply.github.com> Date: Tue, 5 May 2026 14:56:46 +0530 Subject: [PATCH] P4DEVOPS-11504: add waitForRedis init container to deployment-api --- .../vmpooler/templates/deployment-api.yaml | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/helm-charts/vmpooler/templates/deployment-api.yaml b/helm-charts/vmpooler/templates/deployment-api.yaml index f89bec8..f23926d 100644 --- a/helm-charts/vmpooler/templates/deployment-api.yaml +++ b/helm-charts/vmpooler/templates/deployment-api.yaml @@ -32,6 +32,29 @@ spec: serviceAccountName: {{ include "vmpooler.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.api.waitForRedis }} + initContainers: + - name: wait-for-redis + image: "{{ .Values.redis.image.registry }}/{{ .Values.redis.image.repository }}:{{ .Values.redis.image.tag }}" + imagePullPolicy: {{ .Values.redis.image.pullPolicy }} + command: + - /bin/sh + - -c + - | + until redis-cli -h redis-master -p 6379 -a "$REDIS_PASSWORD" ping | grep -q PONG; do + echo "Waiting for Redis to be ready..." + sleep 2 + done + echo "Redis is ready." + env: + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: redis + key: redis-password + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + {{- end }} containers: - name: {{ $fullName }}-api securityContext: