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

View File

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

View File

@ -11,7 +11,7 @@ import (
"path" "path"
"strconv" "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" "github.com/micro/go-micro/util/log"
) )