From 6a93aefa55da89d5d4de9c86092b68485e93a5bd Mon Sep 17 00:00:00 2001 From: nicktrn <55853254+nicktrn@users.noreply.github.com> Date: Fri, 22 Mar 2024 22:01:48 +0000 Subject: [PATCH] lifecycle hooks are back --- apps/kubernetes-provider/src/index.ts | 54 +++++++++++++++++++++++---- 1 file changed, 46 insertions(+), 8 deletions(-) diff --git a/apps/kubernetes-provider/src/index.ts b/apps/kubernetes-provider/src/index.ts index cf49b9bd3..1b0c99cf1 100644 --- a/apps/kubernetes-provider/src/index.ts +++ b/apps/kubernetes-provider/src/index.ts @@ -78,6 +78,20 @@ class KubernetesTaskOperations implements TaskOperations { // memory: "50Mi", // }, // }, + lifecycle: { + preStop: { + httpGet: { + path: "/preStop?cause=index", + port: 8000, + }, + }, + postStart: { + httpGet: { + path: "/postStart?cause=index", + port: 8000, + }, + }, + }, env: [ { name: "DEBUG", @@ -171,11 +185,29 @@ class KubernetesTaskOperations implements TaskOperations { // resources: { // limits: opts.machine, // }, + lifecycle: { + preStop: { + httpGet: { + path: "/preStop?cause=create", + port: 8000, + }, + }, + postStart: { + httpGet: { + path: "/postStart?cause=create", + port: 8000, + }, + }, + }, env: [ { name: "DEBUG", value: "true", }, + { + name: "HTTP_SERVER_PORT", + value: "8000", + }, { name: "TRIGGER_ENV_ID", value: opts.envId, @@ -295,14 +327,20 @@ class KubernetesTaskOperations implements TaskOperations { // resources: { // limits: opts.machine, // }, - // lifecycle: { - // postStart: { - // httpGet: { - // path: "/connect", - // port: 8000, - // }, - // }, - // }, + lifecycle: { + preStop: { + httpGet: { + path: "/preStop?cause=restore", + port: 8000, + }, + }, + postStart: { + httpGet: { + path: "/postStart?cause=restore", + port: 8000, + }, + }, + }, volumeMounts: [ { name: "taskinfo",