mirror of https://github.com/k3s-io/k3s
Fix kubelet logs --follow bug
parent
26da8d0f24
commit
800e8fb54c
|
@ -230,6 +230,15 @@ func (tw *baseTimeoutWriter) Write(p []byte) (int, error) {
|
|||
return tw.w.Write(p)
|
||||
}
|
||||
|
||||
func (tw *baseTimeoutWriter) Flush() {
|
||||
tw.mu.Lock()
|
||||
defer tw.mu.Unlock()
|
||||
|
||||
if flusher, ok := tw.w.(http.Flusher); ok {
|
||||
flusher.Flush()
|
||||
}
|
||||
}
|
||||
|
||||
func (tw *baseTimeoutWriter) WriteHeader(code int) {
|
||||
tw.mu.Lock()
|
||||
defer tw.mu.Unlock()
|
||||
|
|
|
@ -347,7 +347,7 @@ func (s *Server) getContainerLogs(request *restful.Request, response *restful.Re
|
|||
response.WriteError(http.StatusInternalServerError, fmt.Errorf("unable to convert %v into http.Flusher", response))
|
||||
return
|
||||
}
|
||||
fw := flushwriter.Wrap(response)
|
||||
fw := flushwriter.Wrap(response.ResponseWriter)
|
||||
response.Header().Set("Transfer-Encoding", "chunked")
|
||||
response.WriteHeader(http.StatusOK)
|
||||
err := s.host.GetKubeletContainerLogs(kubecontainer.GetPodFullName(pod), containerName, tail, follow, previous, fw, fw)
|
||||
|
|
Loading…
Reference in New Issue