From ec929b3d2f044c8f08e6ca26bcc51e0f02482f1f Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Thu, 23 Apr 2020 17:14:30 +0100 Subject: [PATCH] log error and ensure we pass through namespace --- runtime/kubernetes/kubernetes.go | 2 +- util/kubernetes/api/response.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/runtime/kubernetes/kubernetes.go b/runtime/kubernetes/kubernetes.go index 9ac90ce1..c26e2984 100644 --- a/runtime/kubernetes/kubernetes.go +++ b/runtime/kubernetes/kubernetes.go @@ -461,7 +461,7 @@ func (k *kubernetes) Read(opts ...runtime.ReadOption) ([]*runtime.Service, error labels["micro"] = options.Type } - srvs, err := k.getService(labels) + srvs, err := k.getService(labels, client.GetNamespace(options.Namespace)) if err != nil { return nil, err } diff --git a/util/kubernetes/api/response.go b/util/kubernetes/api/response.go index 1d835ae9..bd486413 100644 --- a/util/kubernetes/api/response.go +++ b/util/kubernetes/api/response.go @@ -3,6 +3,7 @@ package api import ( "encoding/json" "errors" + "fmt" "io/ioutil" "net/http" ) @@ -50,9 +51,8 @@ func (r *Response) Into(data interface{}) error { defer r.res.Body.Close() decoder := json.NewDecoder(r.res.Body) - err := decoder.Decode(&data) - if err != nil { - return ErrDecode + if err := decoder.Decode(&data); err != nil { + return fmt.Errorf("%v: %v", ErrDecode, err) } return r.err