From ad5db49c39b161fc38bc3b8ab83217ede957d716 Mon Sep 17 00:00:00 2001
From: Dominik Hebeler <dominik@suma-ev.de>
Date: Fri, 20 May 2022 15:09:03 +0200
Subject: [PATCH] added lifecycle hooks to scheduler

---
 chart/templates/deployment.yaml | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/chart/templates/deployment.yaml b/chart/templates/deployment.yaml
index d9d9011f4..03803baae 100644
--- a/chart/templates/deployment.yaml
+++ b/chart/templates/deployment.yaml
@@ -106,8 +106,7 @@ spec:
           securityContext:
             {{- toYaml .Values.securityContext | nindent 12 }}
           image: "{{ template "fpm_image" . }}"
-          command: ["/bin/bash", "-c"]
-          args: ["/usr/local/bin/php artisan schedule:run && /usr/local/bin/php artisan schedule:work"]
+          command: ["/usr/local/bin/php", "artisan", "schedule:work"]
           imagePullPolicy: {{ .Values.image.fpm.pullPolicy }}
           env:
           - name: APP_ENV
@@ -143,6 +142,13 @@ spec:
               cpu: 100m
               memory: 100M
             limits:
+          lifecycle:
+            postStart:
+            exec:
+              command: ["/usr/local/bin/php", "artisan" ,"schedule:run"]
+            preStop:
+            exec:
+              command: ["/usr/local/bin/php", "artisan" ,"schedule:run"]
         - name: worker
           securityContext:
             {{- toYaml .Values.securityContext | nindent 12 }}
-- 
GitLab