Skip to content

Commit

Permalink
Merge pull request #650 from uselagoon/api-db-probes
Browse files Browse the repository at this point in the history
feat: apiDB/keycloakDB startup/readiness/liveness probes and startup/shutdown time
  • Loading branch information
tobybellwood authored Mar 21, 2024
2 parents 1935823 + e013503 commit fd98325
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 13 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ install-lagoon-core: install-minio
--set api.image.repository=$(IMAGE_REGISTRY)/api \
--set api.image.tag=$(IMAGE_TAG) \
--set apiDB.image.repository=$(IMAGE_REGISTRY)/api-db \
--set apiDB.image.tag=testing-updated-db-images \
--set apiRedis.image.repository=$(IMAGE_REGISTRY)/api-redis \
--set authServer.image.repository=$(IMAGE_REGISTRY)/auth-server \
--set autoIdler.enabled=false \
Expand All @@ -197,6 +198,7 @@ install-lagoon-core: install-minio
--set keycloak.image.repository=$(IMAGE_REGISTRY)/keycloak \
--set keycloak.image.tag=$(IMAGE_TAG) \
--set keycloakDB.image.repository=$(IMAGE_REGISTRY)/keycloak-db \
--set keycloakDB.image.tag=testing-updated-db-images \
--set logs2notifications.image.repository=$(IMAGE_REGISTRY)/logs2notifications \
--set logs2notifications.email.disabled=true \
--set logs2notifications.microsoftteams.disabled=true \
Expand Down
10 changes: 10 additions & 0 deletions charts/lagoon-core/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,13 @@ annotations:
description: modify keycloak liveness and readiness endpoint
- kind: changed
description: updated insights-handler to v0.0.4
- kind: fixed
description: apiDB livenessProbe access denied
- kind: added
description: apiDB readinessProbe uses sql query
- kind: added
description: apiDB startupProbe waits for init completion
- kind: added
description: apiDB configurable terminationGracePeriodSeconds
- kind: added
description: keycloakDB aligns to apiDB
8 changes: 6 additions & 2 deletions charts/lagoon-core/ci/linter-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ api:

apiDB:
image:
repository: uselagoon/api-db
# TODO - update repo/tag before v2.18 release
repository: testlagoon/api-db
tag: testing-updated-db-images
storageSize: 16Gi
resources:
requests:
Expand Down Expand Up @@ -84,7 +86,9 @@ keycloak:

keycloakDB:
image:
repository: uselagoon/keycloak-db
# TODO - update repo/tag before v2.18 release
repository: testlagoon/keycloak-db
tag: testing-updated-db-images
resources:
requests:
cpu: "10m"
Expand Down
9 changes: 7 additions & 2 deletions charts/lagoon-core/templates/api-db.statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ spec:
volumeMounts:
- name: {{ include "lagoon-core.apiDB.fullname" . }}-data
mountPath: /var/lib/mysql
{{- with .Values.apiDB.readinessProbe }}
readinessProbe:
tcpSocket:
port: mariadb
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.apiDB.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 10 }}
Expand All @@ -78,6 +79,10 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.apiDB.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds:
{{- toYaml . | nindent 8 }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: {{ include "lagoon-core.apiDB.fullname" . }}-data
Expand Down
16 changes: 11 additions & 5 deletions charts/lagoon-core/templates/keycloak-db.statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ spec:
volumeMounts:
- name: {{ include "lagoon-core.keycloakDB.fullname" . }}-data
mountPath: /var/lib/mysql
livenessProbe:
tcpSocket:
port: mariadb
{{- with .Values.keycloakDB.readinessProbe }}
readinessProbe:
tcpSocket:
port: mariadb
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.keycloakDB.livenessProbe }}
livenessProbe:
{{- toYaml . | nindent 10 }}
{{- end }}
{{- with .Values.keycloakDB.startupProbe }}
startupProbe:
{{- toYaml . | nindent 10 }}
Expand All @@ -77,6 +79,10 @@ spec:
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.keycloakDB.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds:
{{- toYaml . | nindent 8 }}
{{- end }}
volumeClaimTemplates:
- metadata:
name: {{ include "lagoon-core.keycloakDB.fullname" . }}-data
Expand Down
30 changes: 26 additions & 4 deletions charts/lagoon-core/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -169,21 +169,29 @@ apiDB:

storageSize: 128Gi

terminationGracePeriodSeconds: 30

startupProbe:
# 60*10s period = 10 minutes
failureThreshold: 60
tcpSocket:
port: mariadb
exec:
command:
- test
- -f
- /tmp/mariadb-init-complete

livenessProbe:
exec:
command:
- mysqladmin
- --host=localhost
- --port=3306
- --connect-timeout=4
- ping

readinessProbe:
exec:
command:
- /usr/share/container-scripts/mysql/readiness-probe.sh

apiRedis:
image:
repository: uselagoon/api-redis
Expand Down Expand Up @@ -295,12 +303,26 @@ keycloakDB:
additionalEnvs:
# FOO: Bar

terminationGracePeriodSeconds: 30

startupProbe:
# 60*10s period = 10 minutes
failureThreshold: 60
tcpSocket:
port: mariadb

livenessProbe:
exec:
command:
- mysqladmin
- --connect-timeout=4
- ping

readinessProbe:
exec:
command:
- /usr/share/container-scripts/mysql/readiness-probe.sh

broker:
replicaCount: 3
image:
Expand Down

0 comments on commit fd98325

Please sign in to comment.