mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 21:47:07 +00:00
commit
45d998d411
@ -79,6 +79,7 @@ type ApiServer struct {
|
|||||||
prefix string
|
prefix string
|
||||||
storage map[string]RESTStorage
|
storage map[string]RESTStorage
|
||||||
ops *Operations
|
ops *Operations
|
||||||
|
logserver http.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
// New creates a new ApiServer object.
|
// New creates a new ApiServer object.
|
||||||
@ -89,6 +90,7 @@ func New(storage map[string]RESTStorage, prefix string) *ApiServer {
|
|||||||
storage: storage,
|
storage: storage,
|
||||||
prefix: prefix,
|
prefix: prefix,
|
||||||
ops: NewOperations(),
|
ops: NewOperations(),
|
||||||
|
logserver: http.StripPrefix("/logs/", http.FileServer(http.Dir("/var/log/"))),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,6 +122,10 @@ func (server *ApiServer) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|||||||
server.handleIndex(w)
|
server.handleIndex(w)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if strings.HasPrefix(url.Path, "/logs/") {
|
||||||
|
server.logserver.ServeHTTP(w, req)
|
||||||
|
return
|
||||||
|
}
|
||||||
if !strings.HasPrefix(url.Path, server.prefix) {
|
if !strings.HasPrefix(url.Path, server.prefix) {
|
||||||
server.notFound(req, w)
|
server.notFound(req, w)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user