Update the util/kubernetes client to retrieve logs
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"crypto/tls"
|
||||
"errors"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -116,6 +117,21 @@ func (c *client) Get(r *Resource, labels map[string]string) error {
|
||||
Into(r.Value)
|
||||
}
|
||||
|
||||
// Logs returns logs for a pod
|
||||
func (c *client) Logs(podName string) (io.ReadCloser, error) {
|
||||
req := api.NewRequest(c.opts).
|
||||
Get().
|
||||
Resource("pod").
|
||||
SubResource("log").
|
||||
Name(podName)
|
||||
|
||||
resp, err := req.Raw()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp.Body, nil
|
||||
}
|
||||
|
||||
// Update updates API object
|
||||
func (c *client) Update(r *Resource) error {
|
||||
req := api.NewRequest(c.opts).
|
||||
|
Reference in New Issue
Block a user