chore(server): db health check (#14779)
#### PR Dependency Tree * **PR #14779** 👈 This tree was auto-generated by [Charcoal](https://github.com/danerwilliams/charcoal) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Added conditional init checks to service deployments and jobs to wait for the database proxy before starting * Exposed a new health port (9801) for the database proxy to enable readiness probing * **Tests** * Minor test reordering and formatting changes (no behavioral changes) <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -25,6 +25,22 @@ spec:
|
|||||||
serviceAccountName: {{ include "front.serviceAccountName" . }}
|
serviceAccountName: {{ include "front.serviceAccountName" . }}
|
||||||
securityContext:
|
securityContext:
|
||||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||||
|
{{- with .Values.global.database.gcloud }}
|
||||||
|
{{- if .enabled }}
|
||||||
|
initContainers:
|
||||||
|
- name: wait-for-cloud-sql-proxy
|
||||||
|
image: busybox:1.36.1
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -ec
|
||||||
|
- |
|
||||||
|
until wget -q -T 2 -O /dev/null "http://{{ $.Values.global.database.host }}:9801/startup"; do
|
||||||
|
echo "waiting for cloud sql proxy to become ready"
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
containers:
|
containers:
|
||||||
- name: {{ .Chart.Name }}
|
- name: {{ .Chart.Name }}
|
||||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ spec:
|
|||||||
targetPort: cloud-sql-proxy
|
targetPort: cloud-sql-proxy
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
name: cloud-sql-proxy
|
name: cloud-sql-proxy
|
||||||
|
- port: 9801
|
||||||
|
targetPort: 9801
|
||||||
|
protocol: TCP
|
||||||
|
name: health
|
||||||
selector:
|
selector:
|
||||||
{{- include "gcloud-sql-proxy.selectorLabels" . | nindent 4 }}
|
{{- include "gcloud-sql-proxy.selectorLabels" . | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
@@ -23,6 +23,22 @@ spec:
|
|||||||
{{- toYaml . | nindent 8 }}
|
{{- toYaml . | nindent 8 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
serviceAccountName: {{ include "graphql.serviceAccountName" . }}
|
serviceAccountName: {{ include "graphql.serviceAccountName" . }}
|
||||||
|
{{- with .Values.global.database.gcloud }}
|
||||||
|
{{- if .enabled }}
|
||||||
|
initContainers:
|
||||||
|
- name: wait-for-cloud-sql-proxy
|
||||||
|
image: busybox:1.36.1
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -ec
|
||||||
|
- |
|
||||||
|
until wget -q -T 2 -O /dev/null "http://{{ $.Values.global.database.host }}:9801/startup"; do
|
||||||
|
echo "waiting for cloud sql proxy to become ready"
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
containers:
|
containers:
|
||||||
- name: {{ .Chart.Name }}
|
- name: {{ .Chart.Name }}
|
||||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||||
|
|||||||
@@ -13,6 +13,22 @@ spec:
|
|||||||
template:
|
template:
|
||||||
spec:
|
spec:
|
||||||
serviceAccountName: {{ include "graphql.serviceAccountName" . }}
|
serviceAccountName: {{ include "graphql.serviceAccountName" . }}
|
||||||
|
{{- with .Values.global.database.gcloud }}
|
||||||
|
{{- if .enabled }}
|
||||||
|
initContainers:
|
||||||
|
- name: wait-for-cloud-sql-proxy
|
||||||
|
image: busybox:1.36.1
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
command:
|
||||||
|
- /bin/sh
|
||||||
|
- -ec
|
||||||
|
- |
|
||||||
|
until wget -q -T 2 -O /dev/null "http://{{ $.Values.global.database.host }}:9801/startup"; do
|
||||||
|
echo "waiting for cloud sql proxy to become ready"
|
||||||
|
sleep 2
|
||||||
|
done
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
containers:
|
containers:
|
||||||
- name: {{ .Chart.Name }}
|
- name: {{ .Chart.Name }}
|
||||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ import type {
|
|||||||
UpsertCalendarSubscriptionInput,
|
UpsertCalendarSubscriptionInput,
|
||||||
} from '../../../models';
|
} from '../../../models';
|
||||||
import { Models } from '../../../models';
|
import { Models } from '../../../models';
|
||||||
import { CalendarModule } from '../index';
|
|
||||||
import { CalendarCronJobs } from '../cron';
|
import { CalendarCronJobs } from '../cron';
|
||||||
|
import { CalendarModule } from '../index';
|
||||||
import {
|
import {
|
||||||
CalendarProvider,
|
CalendarProvider,
|
||||||
CalendarProviderFactory,
|
CalendarProviderFactory,
|
||||||
@@ -614,9 +614,13 @@ test('pollAccounts skips syncing when cluster lock is unavailable', async t => {
|
|||||||
'listAllWithAccountForSync',
|
'listAllWithAccountForSync',
|
||||||
async () => []
|
async () => []
|
||||||
);
|
);
|
||||||
const syncAccountMock = mock.method(calendarService, 'syncAccount', async () => {
|
const syncAccountMock = mock.method(
|
||||||
|
calendarService,
|
||||||
|
'syncAccount',
|
||||||
|
async () => {
|
||||||
return;
|
return;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
await calendarCronJobs.pollAccounts();
|
await calendarCronJobs.pollAccounts();
|
||||||
|
|
||||||
@@ -649,9 +653,13 @@ test('pollAccounts only syncs due accounts', async t => {
|
|||||||
] as any
|
] as any
|
||||||
);
|
);
|
||||||
|
|
||||||
const syncAccountMock = mock.method(calendarService, 'syncAccount', async () => {
|
const syncAccountMock = mock.method(
|
||||||
|
calendarService,
|
||||||
|
'syncAccount',
|
||||||
|
async () => {
|
||||||
return;
|
return;
|
||||||
});
|
}
|
||||||
|
);
|
||||||
|
|
||||||
await calendarCronJobs.pollAccounts();
|
await calendarCronJobs.pollAccounts();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user