Adding endpoint for log retrieval on the minion

This commit is contained in:
jhadvig
2014-08-27 21:41:32 +02:00
parent dec2673c84
commit f351691493
6 changed files with 110 additions and 7 deletions

View File

@@ -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
}