server: Use crio socket for info/inspect endpoints
Signed-off-by: Mrunal Patel <mpatel@redhat.com>
This commit is contained in:
parent
f08a5f7162
commit
a913cb0b5d
2 changed files with 6 additions and 5 deletions
|
@ -413,8 +413,9 @@ func main() {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
err := service.StartInfoEndpoints()
|
err := service.StartInfoEndpoints(lis)
|
||||||
if err != nil {
|
// graceful shutdown doesn't quite work with unix domain sockets
|
||||||
|
if err != nil && !strings.Contains(err.Error(), "use of closed network connection") {
|
||||||
logrus.Fatalf("Failed to start container inspect endpoint: %v", err)
|
logrus.Fatalf("Failed to start container inspect endpoint: %v", err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
|
@ -3,6 +3,7 @@ package server
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ type CrioInfo struct {
|
||||||
|
|
||||||
// StartInfoEndpoints starts a http server that
|
// StartInfoEndpoints starts a http server that
|
||||||
// serves container information requests and crio daemon information
|
// serves container information requests and crio daemon information
|
||||||
func (s *Server) StartInfoEndpoints() error {
|
func (s *Server) StartInfoEndpoints(l net.Listener) error {
|
||||||
mux := bone.New()
|
mux := bone.New()
|
||||||
|
|
||||||
mux.Get("/info", http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
mux.Get("/info", http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||||
|
@ -76,6 +77,5 @@ func (s *Server) StartInfoEndpoints() error {
|
||||||
w.Write(js)
|
w.Write(js)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// TODO: Make this configurable
|
return http.Serve(l, mux)
|
||||||
return http.ListenAndServe("localhost:7373", mux)
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue