Skip to content

Commit

Permalink
feat: make container lifecycle configurable (#17)
Browse files Browse the repository at this point in the history
# Motivations
I would like to send custom broadcast messages from the pre-stop hook.

# Modifications
- This PR moves the current Deployment's container `lifecycle` to the
values under `server.lifecycle` and makes the default the previous
default values
- Makes the `terminationGracePeriodSeconds` configurable to allow
long-running `preStop` lifecycle hooks
  • Loading branch information
USA-RedDragon authored Feb 21, 2024
1 parent 6136631 commit f9d48e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
10 changes: 4 additions & 6 deletions charts/palworld/templates/deployments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,10 @@ spec:
- name: server
image: "{{ .Values.server.image.repository }}:{{ .Values.server.image.tag }}"
imagePullPolicy: {{ .Values.server.image.imagePullPolicy }}
{{- with .Values.server.lifecycle }}
lifecycle:
preStop:
exec:
command:
- "sh"
- "-c"
- rcon-cli save && backup
{{- toYaml . | nindent 12 }}
{{- end }}
resources:
{{- with .Values.server.resources }}
{{- toYaml . | nindent 12 }}
Expand Down Expand Up @@ -93,6 +90,7 @@ spec:
volumeMounts:
- mountPath: /palworld
name: datadir
terminationGracePeriodSeconds: {{ .Values.server.terminationGracePeriodSeconds }}
{{- with .Values.server.image.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
Expand Down
10 changes: 10 additions & 0 deletions charts/palworld/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,16 @@ server:
# - rcon-cli Info | grep -q "Welcome to Pal Server"
# initialDelaySeconds: 60

# Container lifecycle
terminationGracePeriodSeconds: 30
lifecycle:
preStop:
exec:
command:
- "sh"
- "-c"
- rcon-cli save && backup

# Service configuration
#
service:
Expand Down

0 comments on commit f9d48e4

Please sign in to comment.