feat(handlers): add individual handlers fetching

This commit is contained in:
Piotr Icikowski 2024-03-01 23:38:04 +01:00
parent d33e9f19ea
commit bb108ad9ba
Signed by: Piotr Icikowski
GPG Key ID: 3931CA47A91F7666
2 changed files with 15 additions and 0 deletions

View File

@ -93,6 +93,16 @@ func (kp *kubeprobes) handleReadiness(w http.ResponseWriter, _ *http.Request) {
}
}
// GetLivenessHandler implements Kubeprobes.
func (kp *kubeprobes) GetLivenessHandler() http.Handler {
return http.HandlerFunc(kp.handleLiveness)
}
// GetReadinessHandler implements Kubeprobes.
func (kp *kubeprobes) GetReadinessHandler() http.Handler {
return http.HandlerFunc(kp.handleReadiness)
}
// ServeHTTP implements Kubeprobes.
func (kp *kubeprobes) ServeHTTP(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path {

View File

@ -5,6 +5,11 @@ import "net/http"
// Kubeprobes represents liveness & readiness probes handler.
type Kubeprobes interface {
http.Handler
// GetLivenessHandler returns [http.Handler] for liveness probes.
GetLivenessHandler() http.Handler
// GetReadinessHandler returns [http.Handler] for readiness probes.
GetReadinessHandler() http.Handler
}
// Option represents a [Kubeprobes] constructor option.