Skip to content

Commit 8a16fc0

Browse files
avachetteoktalz
authored andcommitted
BUG/MEDIUM: support alternative healthcheck endpoint
1 parent 040f495 commit 8a16fc0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/controller/builder.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ func addControllerMetricData(builder *Builder, chShutdown chan struct{}) {
183183
runningServices += ", prometheus"
184184
}
185185
rtr.GET("/healtz", requestHandler)
186+
rtr.GET("/healthz", requestHandler)
186187
// all others will be 404
187188
go func() {
188189
server := fasthttp.Server{
@@ -206,6 +207,7 @@ func addControllerMetricData(builder *Builder, chShutdown chan struct{}) {
206207
func addLocalDefaultService(builder *Builder, chShutdown chan struct{}) {
207208
rtr := router.New()
208209
rtr.GET("/healtz", requestHandler)
210+
rtr.GET("/healthz", requestHandler)
209211
// all others will be 404
210212
go func() {
211213
server := fasthttp.Server{
@@ -228,5 +230,11 @@ func addLocalDefaultService(builder *Builder, chShutdown chan struct{}) {
228230

229231
func requestHandler(ctx *fasthttp.RequestCtx) {
230232
ctx.SetStatusCode(fasthttp.StatusOK)
231-
ctx.Response.Header.Set("X-HAProxy-Ingress-Controller", "healtz")
233+
234+
switch string(ctx.Path()) {
235+
case "/healthz":
236+
ctx.Response.Header.Set("X-HAProxy-Ingress-Controller", "healthz")
237+
default:
238+
ctx.Response.Header.Set("X-HAProxy-Ingress-Controller", "healtz")
239+
}
232240
}

0 commit comments

Comments
 (0)