move around k8s api

This commit is contained in:
Asim Aslam 2019-12-24 17:42:22 +00:00
parent 5c8d1ae2b9
commit 361fdfba04
4 changed files with 4 additions and 15 deletions

View File

@ -8,8 +8,6 @@ import (
"io"
"net/http"
"net/url"
"github.com/micro/go-micro/util/log"
)
// Request is used to construct a http request for the k8s API.
@ -103,7 +101,6 @@ func (r *Request) Body(in interface{}) *Request {
r.err = err
return r
}
log.Debugf("Request body: %v", b)
r.body = b
return r
}
@ -120,7 +117,6 @@ func (r *Request) Body(in interface{}) *Request {
return r
}
log.Debugf("Request body: %v", b)
r.body = b
return r
}
@ -202,8 +198,6 @@ func (r *Request) Do() *Response {
}
}
log.Debugf("kubernetes api request: %v", req)
res, err := r.client.Do(req)
if err != nil {
return &Response{
@ -211,8 +205,6 @@ func (r *Request) Do() *Response {
}
}
log.Debugf("kubernetes api response: %v", res)
// return res, err
return newResponse(res, err)
}

View File

@ -5,8 +5,6 @@ import (
"errors"
"io/ioutil"
"net/http"
"github.com/micro/go-micro/util/log"
)
// Errors ...
@ -82,13 +80,12 @@ func newResponse(res *http.Response, err error) *Response {
return r
}
log.Logf("kubernetes: request failed with code %v", r.res.StatusCode)
b, err := ioutil.ReadAll(r.res.Body)
if err == nil {
log.Log("kubernetes: request failed with body:")
log.Log(string(b))
r.err = errors.New(string(b))
return r
}
r.err = ErrUnknown
return r

View File

@ -11,7 +11,7 @@ import (
"path"
"strconv"
"github.com/micro/go-micro/util/kubernetes/client/api"
"github.com/micro/go-micro/util/kubernetes/api"
"github.com/micro/go-micro/util/log"
)