mirror of
https://github.com/minio/minio.git
synced 2025-11-10 05:59:43 -05:00
Update healthcheck related examples and add head support (#5650)
- Add head method for healthcheck endpoint. Some platforms/users may use the HTTP Head method to check for health status. - Add liveness and readiness probe examples in Kubernetes yaml example docs. Note that readiness probe not added to StatefulSet example due to https://github.com/kubernetes/kubernetes/issues/27114
This commit is contained in:
@@ -200,7 +200,7 @@ func guessIsHealthCheckReq(req *http.Request) bool {
|
||||
return false
|
||||
}
|
||||
aType := getRequestAuthType(req)
|
||||
return req.Method == http.MethodGet && aType == authTypeAnonymous &&
|
||||
return aType == authTypeAnonymous && (req.Method == http.MethodGet || req.Method == http.MethodHead) &&
|
||||
(req.URL.Path == healthCheckPathPrefix+healthCheckLivenessPath ||
|
||||
req.URL.Path == healthCheckPathPrefix+healthCheckReadinessPath)
|
||||
}
|
||||
|
||||
@@ -37,7 +37,9 @@ func registerHealthCheckRouter(mux *router.Router) {
|
||||
|
||||
// Liveness handler
|
||||
healthRouter.Methods(http.MethodGet).Path(healthCheckLivenessPath).HandlerFunc(LivenessCheckHandler)
|
||||
healthRouter.Methods(http.MethodHead).Path(healthCheckLivenessPath).HandlerFunc(LivenessCheckHandler)
|
||||
|
||||
// Readiness handler
|
||||
healthRouter.Methods(http.MethodGet).Path(healthCheckReadinessPath).HandlerFunc(ReadinessCheckHandler)
|
||||
healthRouter.Methods(http.MethodHead).Path(healthCheckReadinessPath).HandlerFunc(ReadinessCheckHandler)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user