Skip to content

Commit f3bbd44

Browse files
authored
Merge pull request cri-o#826 from mrunalp/info_sock
server: Use crio socket for info/inspect endpoints
2 parents c7b625d + a913cb0 commit f3bbd44

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

cmd/crio/main.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,9 @@ func main() {
413413
}()
414414

415415
go func() {
416-
err := service.StartInfoEndpoints()
417-
if err != nil {
416+
err := service.StartInfoEndpoints(lis)
417+
// graceful shutdown doesn't quite work with unix domain sockets
418+
if err != nil && !strings.Contains(err.Error(), "use of closed network connection") {
418419
logrus.Fatalf("Failed to start container inspect endpoint: %v", err)
419420
}
420421
}()

server/inspect.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package server
33
import (
44
"encoding/json"
55
"fmt"
6+
"net"
67
"net/http"
78
"path/filepath"
89

@@ -28,7 +29,7 @@ type CrioInfo struct {
2829

2930
// StartInfoEndpoints starts a http server that
3031
// serves container information requests and crio daemon information
31-
func (s *Server) StartInfoEndpoints() error {
32+
func (s *Server) StartInfoEndpoints(l net.Listener) error {
3233
mux := bone.New()
3334

3435
mux.Get("/info", http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
@@ -76,6 +77,5 @@ func (s *Server) StartInfoEndpoints() error {
7677
w.Write(js)
7778
}))
7879

79-
// TODO: Make this configurable
80-
return http.ListenAndServe("localhost:7373", mux)
80+
return http.Serve(l, mux)
8181
}

0 commit comments

Comments
 (0)