From e147b8d3c837e84ddc4179580c2930060881cc30 Mon Sep 17 00:00:00 2001 From: RouxAntoine Date: Fri, 6 Oct 2023 00:23:14 +0200 Subject: [PATCH] feature: support liveness pobe path --- main.go | 1 + pkg/application/generic.go | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 02e372a..bf666f4 100644 --- a/main.go +++ b/main.go @@ -18,6 +18,7 @@ func main() { { Image: "nginx", Path: "/api", + Health: "/", }, }, Env: map[string]string{ diff --git a/pkg/application/generic.go b/pkg/application/generic.go index af986d7..5b60efa 100644 --- a/pkg/application/generic.go +++ b/pkg/application/generic.go @@ -20,8 +20,9 @@ const ( ) type ImagesConfiguration struct { - Image string - Path string + Image string + Path string + Health string } type Configuration struct { @@ -88,6 +89,9 @@ func NewApplication(ctx *pulumi.Context, publicConfiguration *Configuration) (*A if publicImageConfiguration.Path == "" { localImagesConfiguration.Path = "/" } + if publicImageConfiguration.Health == "" { + localImagesConfiguration.Health = "/" + } if slices.Contains(preventDuplicatePath, localImagesConfiguration.Path) { return nil, errors.New("duplicate path in ingress configuration") } @@ -416,6 +420,12 @@ func createDeployment( }, }, Env: env, + LivenessProbe: &corev1.ProbeArgs{ + HttpGet: &corev1.HTTPGetActionArgs{ + Path: pulumi.String(configuration.ImageReference.Health), + Port: pulumi.Int(80), + }, + }, }, }, },