-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathserver.go
More file actions
25 lines (21 loc) · 809 Bytes
/
Copy pathserver.go
File metadata and controls
25 lines (21 loc) · 809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package healthsrv
import (
"fmt"
"net/http"
builderconf "github.com/deis/builder/pkg/conf"
"github.com/deis/builder/pkg/controller"
"github.com/deis/builder/pkg/sshd"
)
// Start starts the healthcheck server on :$port and blocks. It only returns if the server fails,
// with the indicative error.
func Start(cnf *sshd.Config, nsLister NamespaceLister, bLister BucketLister, sshServerCircuit *sshd.Circuit) error {
mux := http.NewServeMux()
client, err := controller.New(cnf.ControllerHost, cnf.ControllerPort, builderconf.BuilderKeyLocation)
if err != nil {
return err
}
mux.Handle("/healthz", healthZHandler(bLister, sshServerCircuit))
mux.Handle("/readiness", readinessHandler(client, nsLister))
hostStr := fmt.Sprintf(":%d", cnf.HealthSrvPort)
return http.ListenAndServe(hostStr, mux)
}