Skip to content

Commit 22e497d

Browse files
avachetteoktalz
authored andcommitted
BUG/MEDIUM: support alternative healthcheck endpoint
1 parent 79905b3 commit 22e497d

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
@@ -202,6 +202,7 @@ func addControllerMetricData(builder *Builder, chShutdown chan struct{}) {
202202
runningServices += ", prometheus"
203203
}
204204
rtr.GET("/healtz", requestHandler)
205+
rtr.GET("/healthz", requestHandler)
205206
// all others will be 404
206207
go func() {
207208
server := fasthttp.Server{
@@ -225,6 +226,7 @@ func addControllerMetricData(builder *Builder, chShutdown chan struct{}) {
225226
func addLocalDefaultService(builder *Builder, chShutdown chan struct{}) {
226227
rtr := router.New()
227228
rtr.GET("/healtz", requestHandler)
229+
rtr.GET("/healthz", requestHandler)
228230
// all others will be 404
229231
go func() {
230232
server := fasthttp.Server{
@@ -247,5 +249,11 @@ func addLocalDefaultService(builder *Builder, chShutdown chan struct{}) {
247249

248250
func requestHandler(ctx *fasthttp.RequestCtx) {
249251
ctx.SetStatusCode(fasthttp.StatusOK)
250-
ctx.Response.Header.Set("X-HAProxy-Ingress-Controller", "healtz")
252+
253+
switch string(ctx.Path()) {
254+
case "/healthz":
255+
ctx.Response.Header.Set("X-HAProxy-Ingress-Controller", "healthz")
256+
default:
257+
ctx.Response.Header.Set("X-HAProxy-Ingress-Controller", "healtz")
258+
}
251259
}

0 commit comments

Comments
 (0)