Skip to content

Commit

Permalink
fix: add an initContainer
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyannn committed Jan 9, 2024
1 parent fb4f671 commit 4757fe8
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion langfuse/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,32 @@ spec:
serviceAccountName: {{ include "langfuse.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
initContainers:
- name: check-postgres
image: busybox:latest
env:
{{- if .Values.postgresql.enabled }}
- name: DATABASE_HOST
value: {{ include "langfuse.databaseHost" . | quote }}
- name: DATABASE_PORT
value: "5432"
{{- else }}
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: {{ include "langfuse.connectionSecret" . | quote }}
key: database-url
{{- end }}
command:
- sh
- -c
- >
until nc -z -v -w30
${DATABASE_HOST:-$(echo $DATABASE_URL | awk -F[/:] '{print $4}')}
${DATABASE_PORT:-$(echo $DATABASE_URL | awk -F[/:] '{print $5}'):-"5432"} ; do
echo 'Waiting for Postgres...' ;
sleep 5 ;
done
containers:
- name: {{ .Chart.Name }}
securityContext:
Expand Down Expand Up @@ -80,10 +106,16 @@ spec:
- configMapRef:
name: {{ include "langfuse.configMap" . }}
{{- include "langfuse.additionalSecrets" . }}
readinessProbe:
startupProbe:
tcpSocket:
port: http
failureThreshold: 30
periodSeconds: 10
livenessProbe:
httpGet:
path: /api/public/health
port: http
periodSeconds: 20
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
Expand Down

0 comments on commit 4757fe8

Please sign in to comment.