feat(probe): support readiness path
This commit is contained in:
parent
ae29216252
commit
c3fb551904
1
main.go
1
main.go
@ -19,6 +19,7 @@ func main() {
|
||||
Image: "nginx",
|
||||
Path: "/api",
|
||||
Health: "/",
|
||||
Ready: "/",
|
||||
},
|
||||
},
|
||||
Env: map[string]string{
|
||||
|
@ -26,6 +26,7 @@ type ImagesConfiguration struct {
|
||||
Image string
|
||||
Path string
|
||||
Health string
|
||||
Ready string
|
||||
}
|
||||
|
||||
type CreatedApplication struct {
|
||||
@ -53,6 +54,7 @@ type service struct {
|
||||
Image string
|
||||
Path string
|
||||
Health string
|
||||
Ready string
|
||||
}
|
||||
|
||||
func NewApplication(ctx *pulumi.Context, configuration *Configuration) (*CreatedApplication, error) {
|
||||
@ -72,6 +74,7 @@ func NewApplication(ctx *pulumi.Context, configuration *Configuration) (*Created
|
||||
Image: image.Image,
|
||||
Path: image.Path,
|
||||
Health: image.Health,
|
||||
Ready: image.Ready,
|
||||
}
|
||||
if image.Path == "" {
|
||||
serviceConfiguration.Path = "/"
|
||||
@ -79,6 +82,9 @@ func NewApplication(ctx *pulumi.Context, configuration *Configuration) (*Created
|
||||
if image.Health == "" {
|
||||
serviceConfiguration.Health = "/"
|
||||
}
|
||||
if image.Ready == "" {
|
||||
serviceConfiguration.Ready = "/"
|
||||
}
|
||||
if slices.Contains(preventDuplicatePath, serviceConfiguration.Path) {
|
||||
return nil, errors.New("duplicate path in ingress applicationConfiguration")
|
||||
}
|
||||
@ -140,6 +146,7 @@ func (application *application) createResources(ctx *pulumi.Context) (*CreatedAp
|
||||
ImageReference: &workload.ImageReference{
|
||||
Image: service.Image,
|
||||
Health: service.Health,
|
||||
Ready: service.Ready,
|
||||
},
|
||||
}
|
||||
deployment, err := deploymentConfiguration.CreateDeployment(ctx, namespace, application, appLabels)
|
||||
|
@ -18,6 +18,7 @@ type DeploymentConfiguration struct {
|
||||
type ImageReference struct {
|
||||
Image string
|
||||
Health string
|
||||
Ready string
|
||||
}
|
||||
|
||||
func (deployment *DeploymentConfiguration) CreateDeployment(
|
||||
@ -72,6 +73,12 @@ func (deployment *DeploymentConfiguration) CreateDeployment(
|
||||
InitialDelaySeconds: pulumi.Int(70),
|
||||
PeriodSeconds: pulumi.Int(15),
|
||||
},
|
||||
ReadinessProbe: &v1.ProbeArgs{
|
||||
HttpGet: &v1.HTTPGetActionArgs{
|
||||
Path: pulumi.String(deployment.ImageReference.Ready),
|
||||
Port: pulumi.Int(80),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user