github.com/kubeshop/testkube@v1.17.23/pkg/logs/healthcheck.go (about) 1 package logs 2 3 import ( 4 "context" 5 "net/http" 6 ) 7 8 // RunHealthCheckHandler is a handler for health check events 9 // we need HTTP as GRPC probes starts from Kubernetes 1.25 10 func (ls *LogsService) RunHealthCheckHandler(ctx context.Context) error { 11 mux := http.NewServeMux() 12 mux.HandleFunc("/health", func(w http.ResponseWriter, r *http.Request) { 13 w.WriteHeader(http.StatusOK) 14 }) 15 16 ls.httpServer = &http.Server{ 17 Addr: ls.httpAddress, 18 Handler: mux, 19 } 20 21 ls.log.Infow("starting health check handler", "address", ls.httpAddress) 22 return ls.httpServer.ListenAndServe() 23 }