mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-11 06:02:18 +00:00
Adding endpoint for log retrieval on the minion
This commit is contained in:
@@ -20,6 +20,8 @@ import (
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
"net/http"
|
||||
"io"
|
||||
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
@@ -95,3 +97,21 @@ func (h *httpActionHandler) Run(podFullName, uuid string, container *api.Contain
|
||||
_, err := h.client.Get(url)
|
||||
return err
|
||||
}
|
||||
|
||||
// flusherWriter provides wrapper for responseWriter with HTTP streaming capabilities
|
||||
type FlushWriter struct {
|
||||
flusher http.Flusher
|
||||
writer io.Writer
|
||||
}
|
||||
|
||||
// Write is a flushWriter implementation of the io.Writer that sends any buffered data to the client.
|
||||
func (fw *FlushWriter) Write(p []byte) (n int, err error) {
|
||||
n, err = fw.writer.Write(p)
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
if fw.flusher != nil {
|
||||
fw.flusher.Flush()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user