Skip to content

Commit

Permalink
feat: ✨ Added Lifecycle Hook and Termination Grace Period
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcrisap committed May 10, 2024
1 parent 2e96887 commit 0bc3ded
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions charts/trino/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ The following table lists the configurable parameters of the Trino chart and the
| `coordinator.resources` | | `{}` |
| `coordinator.livenessProbe` | | `{}` |
| `coordinator.readinessProbe` | | `{}` |
| `coordinator.lifecycle` | | `{}` |
| `coordinator.terminationGracePeriodSeconds` | | `30` |
| `coordinator.nodeSelector` | | `{}` |
| `coordinator.tolerations` | | `[]` |
| `coordinator.affinity` | | `{}` |
Expand All @@ -79,6 +81,8 @@ The following table lists the configurable parameters of the Trino chart and the
| `worker.resources` | | `{}` |
| `worker.livenessProbe` | | `{}` |
| `worker.readinessProbe` | | `{}` |
| `worker.lifecycle` | | `{}` |
| `worker.terminationGracePeriodSeconds` | | `30` |
| `worker.nodeSelector` | | `{}` |
| `worker.tolerations` | | `[]` |
| `worker.affinity` | | `{}` |
Expand Down
3 changes: 3 additions & 0 deletions charts/trino/templates/deployment-coordinator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ spec:
{{- end }}
imagePullSecrets:
{{- toYaml .Values.imagePullSecrets | nindent 8 }}
terminationGracePeriodSeconds: {{ .Values.coordinator.terminationGracePeriodSeconds }}
containers:
- name: {{ .Chart.Name }}-coordinator
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
Expand Down Expand Up @@ -122,6 +123,8 @@ spec:
timeoutSeconds: {{ .Values.coordinator.readinessProbe.timeoutSeconds | default 5 }}
failureThreshold: {{ .Values.coordinator.readinessProbe.failureThreshold | default 6 }}
successThreshold: {{ .Values.coordinator.readinessProbe.successThreshold | default 1 }}
lifecycle:
{{- toYaml .Values.coordinator.lifecycle | nindent 12 }}
resources:
{{- toYaml .Values.coordinator.resources | nindent 12 }}
{{- with .Values.coordinator.nodeSelector }}
Expand Down
3 changes: 3 additions & 0 deletions charts/trino/templates/deployment-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ spec:
{{- end }}
imagePullSecrets:
{{- toYaml .Values.imagePullSecrets | nindent 8 }}
terminationGracePeriodSeconds: {{ .Values.worker.terminationGracePeriodSeconds }}
containers:
- name: {{ .Chart.Name }}-worker
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
Expand Down Expand Up @@ -99,6 +100,8 @@ spec:
timeoutSeconds: {{ .Values.worker.readinessProbe.timeoutSeconds | default 5 }}
failureThreshold: {{ .Values.worker.readinessProbe.failureThreshold | default 6 }}
successThreshold: {{ .Values.worker.readinessProbe.successThreshold | default 1 }}
lifecycle:
{{- toYaml .Values.worker.lifecycle | nindent 12 }}
resources:
{{- toYaml .Values.worker.resources | nindent 12 }}
{{- with .Values.worker.nodeSelector }}
Expand Down
19 changes: 19 additions & 0 deletions charts/trino/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,13 @@ coordinator:
# failureThreshold: 6
# successThreshold: 1

lifecycle: {}
# preStop:
# exec:
# command: ["/bin/sh", "-c", "sleep 120"]

terminationGracePeriodSeconds: 30

nodeSelector: {}

tolerations: []
Expand Down Expand Up @@ -247,6 +254,18 @@ worker:
# failureThreshold: 6
# successThreshold: 1

lifecycle: {}
# To enable Graceful shutdown, Define a lifecycle preStop like bellow,
# Set the `terminationGracePeriodSeconds` to a value greater than or equal to the configured `shutdown.grace-period`.
# Configure `shutdown.grace-period` in `additionalConfigProperties` as `shutdown.grace-period=2m` (default is 2 minutes).
# Allow the operation on `accessControl` because isn't allow by default.
# Check the documentaion on https://trino.io/docs/current/admin/graceful-shutdown.html
# preStop:
# exec:
# command: ["/bin/sh", "-c", "curl -v -X PUT -d '\"SHUTTING_DOWN\"' -H \"Content-type: application/json\" http://localhost:8081/v1/info/state"]

terminationGracePeriodSeconds: 30

nodeSelector: {}

tolerations: []
Expand Down

0 comments on commit 0bc3ded

Please sign in to comment.