Skip to content
Snippets Groups Projects
Commit f795591e authored by Luqman Rizal's avatar Luqman Rizal
Browse files

Add helm test suite

* add simple health check for supported services
* fix auth env DB_PORT value
parent 6efc6685
No related branches found
No related tags found
No related merge requests found
......@@ -45,7 +45,7 @@ spec:
name: {{ include "supabase.secret.db" . }}
key: username
- name: DB_PORT
value: {{ .Values.analytics.environment.DB_PORT | quote }}
value: {{ .Values.auth.environment.DB_PORT | quote }}
command: ["/bin/sh", "-c"]
args:
- |
......
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "supabase.fullname" . }}-test-analytics
labels:
{{- include "supabase.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
ttlSecondsAfterFinished: 100
template:
spec:
containers:
- name: test-analytics
image: kdevup/curljq
command:
- /bin/bash
- -c
- |
curl -sfo /dev/null \
http://{{ include "supabase.analytics.fullname" . }}:{{ .Values.analytics.service.port }}/health
echo "Sevice {{ include "supabase.analytics.fullname" . }} is healthy."
restartPolicy: Never
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "supabase.fullname" . }}-test-auth
labels:
{{- include "supabase.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
ttlSecondsAfterFinished: 100
template:
spec:
containers:
- name: test-auth
image: kdevup/curljq
command:
- /bin/bash
- -c
- |
curl -sfo /dev/null \
http://{{ include "supabase.auth.fullname" . }}:{{ .Values.auth.service.port }}/health
echo "Sevice {{ include "supabase.auth.fullname" . }} is healthy."
restartPolicy: Never
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "supabase.fullname" . }}-test-db
labels:
{{- include "supabase.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
ttlSecondsAfterFinished: 100
template:
spec:
containers:
- command:
- /bin/sh
- -c
- |
pg_isready -h $(DB_HOST) -p $(DB_PORT) -U $(DB_USER) || $(echo "\e[0;31mFailed to connect to the database." && exit 1)
echo "Database is ready"
env:
- name: DB_HOST
{{- if .Values.db.enabled }}
value: {{ include "supabase.db.fullname" . | quote }}
{{- else }}
value: {{ .Values.auth.environment.DB_HOST | quote }}
{{- end }}
- name: DB_USER
valueFrom:
secretKeyRef:
name: {{ include "supabase.secret.db" . }}
key: username
- name: DB_PORT
value: {{ .Values.auth.environment.DB_PORT | quote }}
image: postgres:15-alpine
imagePullPolicy: IfNotPresent
name: test-db
restartPolicy: Never
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "supabase.fullname" . }}-test-imgproxy
labels:
{{- include "supabase.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
ttlSecondsAfterFinished: 100
template:
spec:
containers:
- name: test-imgproxy
image: kdevup/curljq
command:
- /bin/bash
- -c
- |
curl -sfo /dev/null \
http://{{ include "supabase.imgproxy.fullname" . }}:{{ .Values.imgproxy.service.port }}/health
echo "Sevice {{ include "supabase.imgproxy.fullname" . }} is healthy."
restartPolicy: Never
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "supabase.fullname" . }}-test-kong
labels:
{{- include "supabase.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
ttlSecondsAfterFinished: 100
template:
spec:
containers:
- env:
- name: DASHBOARD_USERNAME
valueFrom:
secretKeyRef:
key: username
name: {{ include "supabase.fullname" . }}-dashboard
- name: DASHBOARD_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: {{ include "supabase.fullname" . }}-dashboard
name: test-kong
image: kdevup/curljq
command:
- /bin/bash
- -c
- |
RETURN_CODE=$(curl -sL \
-w "%{http_code}\n" \
-o /dev/null \
http://${DASHBOARD_USERNAME}:${DASHBOARD_PASSWORD}@{{ include "supabase.kong.fullname" . }}:{{ .Values.kong.service.port }})
! [[ "$RETURN_CODE" =~ 20[0-9] ]] && echo -e "\e[0;31mFailed to get a valid response." && exit 1
echo "Successfully connected."
restartPolicy: Never
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "supabase.fullname" . }}-test-meta
labels:
{{- include "supabase.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
ttlSecondsAfterFinished: 100
template:
spec:
containers:
- name: test-meta
image: kdevup/curljq
command:
- /bin/bash
- -c
- |
curl -sfo /dev/null \
http://{{ include "supabase.meta.fullname" . }}:{{ .Values.meta.service.port }}/health
echo "Sevice {{ include "supabase.meta.fullname" . }} is healthy."
restartPolicy: Never
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "supabase.fullname" . }}-test-realtime
labels:
{{- include "supabase.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
ttlSecondsAfterFinished: 100
template:
spec:
containers:
- name: test-realtime
image: kdevup/curljq
command:
- /bin/bash
- -c
- |
curl -sfo /dev/null \
http://{{ include "supabase.realtime.fullname" . }}:{{ .Values.realtime.service.port }}
echo "Sevice {{ include "supabase.realtime.fullname" . }} is healthy."
restartPolicy: Never
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "supabase.fullname" . }}-test-rest
labels:
{{- include "supabase.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
ttlSecondsAfterFinished: 100
template:
spec:
containers:
- name: test-rest
image: kdevup/curljq
command:
- /bin/bash
- -c
- |
curl -sfo /dev/null \
http://{{ include "supabase.rest.fullname" . }}:{{ .Values.rest.service.port }}
echo "Sevice {{ include "supabase.rest.fullname" . }} is healthy."
restartPolicy: Never
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "supabase.fullname" . }}-test-storage
labels:
{{- include "supabase.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
ttlSecondsAfterFinished: 100
template:
spec:
containers:
- name: test-storage
image: kdevup/curljq
command:
- /bin/bash
- -c
- |
curl -sfo /dev/null \
http://{{ include "supabase.storage.fullname" . }}:{{ .Values.storage.service.port }}/status
echo "Sevice {{ include "supabase.storage.fullname" . }} is healthy."
restartPolicy: Never
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "supabase.fullname" . }}-test-studio
labels:
{{- include "supabase.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
ttlSecondsAfterFinished: 100
template:
spec:
containers:
- name: test-studio
image: kdevup/curljq
command:
- /bin/bash
- -c
- |
curl -sfo /dev/null \
http://{{ include "supabase.studio.fullname" . }}:{{ .Values.studio.service.port }}/api/profile
echo "Sevice {{ include "supabase.studio.fullname" . }} is healthy."
restartPolicy: Never
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment