Major enhancements #6

Merged
Piotr Icikowski merged 3 commits from enhancements into devel 2024-03-01 23:46:04 +01:00
2 changed files with 15 additions and 0 deletions
Showing only changes of commit bb108ad9ba - Show all commits

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. // ServeHTTP implements Kubeprobes.
func (kp *kubeprobes) ServeHTTP(w http.ResponseWriter, r *http.Request) { func (kp *kubeprobes) ServeHTTP(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path { switch r.URL.Path {

View File

@ -5,6 +5,11 @@ import "net/http"
// Kubeprobes represents liveness & readiness probes handler. // Kubeprobes represents liveness & readiness probes handler.
type Kubeprobes interface { type Kubeprobes interface {
http.Handler 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. // Option represents a [Kubeprobes] constructor option.