feat(handlers): add individual handlers fetching
This commit is contained in:
parent
d33e9f19ea
commit
bb108ad9ba
10
probes.go
10
probes.go
@ -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 {
|
||||
|
5
types.go
5
types.go
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user