mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Merge pull request #13864 from feiskyer/logs-follow
Auto commit by PR queue bot
This commit is contained in:
commit
2da93a48b1
@ -230,6 +230,15 @@ func (tw *baseTimeoutWriter) Write(p []byte) (int, error) {
|
|||||||
return tw.w.Write(p)
|
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) {
|
func (tw *baseTimeoutWriter) WriteHeader(code int) {
|
||||||
tw.mu.Lock()
|
tw.mu.Lock()
|
||||||
defer tw.mu.Unlock()
|
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))
|
response.WriteError(http.StatusInternalServerError, fmt.Errorf("unable to convert %v into http.Flusher", response))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
fw := flushwriter.Wrap(response)
|
fw := flushwriter.Wrap(response.ResponseWriter)
|
||||||
response.Header().Set("Transfer-Encoding", "chunked")
|
response.Header().Set("Transfer-Encoding", "chunked")
|
||||||
response.WriteHeader(http.StatusOK)
|
response.WriteHeader(http.StatusOK)
|
||||||
err := s.host.GetKubeletContainerLogs(kubecontainer.GetPodFullName(pod), containerName, tail, follow, previous, fw, fw)
|
err := s.host.GetKubeletContainerLogs(kubecontainer.GetPodFullName(pod), containerName, tail, follow, previous, fw, fw)
|
||||||
|
Loading…
Reference in New Issue
Block a user