From bb25bd94c8d2acd4bde3535b803a4aa0a0171d6a Mon Sep 17 00:00:00 2001 From: Ben Toogood Date: Thu, 23 Apr 2020 17:56:00 +0100 Subject: [PATCH 1/4] Log k8s requests --- runtime/kubernetes/kubernetes.go | 2 -- util/kubernetes/api/request.go | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/runtime/kubernetes/kubernetes.go b/runtime/kubernetes/kubernetes.go index 6de713bb..c26e2984 100644 --- a/runtime/kubernetes/kubernetes.go +++ b/runtime/kubernetes/kubernetes.go @@ -38,8 +38,6 @@ func (k *kubernetes) namespaceExists(name string) (bool, error) { return false, err } k.namespaces = namespaceList.Items - fmt.Println("HERE") - fmt.Println(k.namespaces) } // check if the namespace exists in the cache diff --git a/util/kubernetes/api/request.go b/util/kubernetes/api/request.go index e5a96509..2e4215ef 100644 --- a/util/kubernetes/api/request.go +++ b/util/kubernetes/api/request.go @@ -9,6 +9,8 @@ import ( "io" "net/http" "net/url" + + "github.com/micro/go-micro/v2/logger" ) // Request is used to construct a http request for the k8s API. @@ -217,6 +219,7 @@ func (r *Request) Do() *Response { } } + logger.Debugf("[%v] %v", req.Method, req.URL.String()) res, err := r.client.Do(req) if err != nil { return &Response{ From 8b3d223fc0eeb47a80dc86b222c2594ae0b7766a Mon Sep 17 00:00:00 2001 From: Ben Toogood Date: Thu, 23 Apr 2020 18:05:58 +0100 Subject: [PATCH 2/4] Remove hardcoded labels: --- util/kubernetes/client/client.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/util/kubernetes/client/client.go b/util/kubernetes/client/client.go index 76e7c52f..06df07fc 100644 --- a/util/kubernetes/client/client.go +++ b/util/kubernetes/client/client.go @@ -189,10 +189,6 @@ func (c *client) List(r *Resource, opts ...ListOption) error { o(&options) } - labels := map[string]string{ - "micro": "service", - } - return c.Get(r, GetLabels(labels), GetNamespace(options.Namespace)) } From cd35f503a03fd188bc2d7297dc782239d8860204 Mon Sep 17 00:00:00 2001 From: Ben Toogood Date: Thu, 23 Apr 2020 18:08:02 +0100 Subject: [PATCH 3/4] Remove hardcoded labels --- util/kubernetes/client/client.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/kubernetes/client/client.go b/util/kubernetes/client/client.go index 06df07fc..632a5342 100644 --- a/util/kubernetes/client/client.go +++ b/util/kubernetes/client/client.go @@ -189,7 +189,7 @@ func (c *client) List(r *Resource, opts ...ListOption) error { o(&options) } - return c.Get(r, GetLabels(labels), GetNamespace(options.Namespace)) + return c.Get(r, GetNamespace(options.Namespace)) } // Watch returns an event stream From f34d58cfbdfc0853fa89ba9898bc0a31e5586b45 Mon Sep 17 00:00:00 2001 From: Ben Toogood Date: Thu, 23 Apr 2020 18:14:06 +0100 Subject: [PATCH 4/4] Remove Debug --- util/kubernetes/api/request.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/util/kubernetes/api/request.go b/util/kubernetes/api/request.go index 2e4215ef..e5a96509 100644 --- a/util/kubernetes/api/request.go +++ b/util/kubernetes/api/request.go @@ -9,8 +9,6 @@ import ( "io" "net/http" "net/url" - - "github.com/micro/go-micro/v2/logger" ) // Request is used to construct a http request for the k8s API. @@ -219,7 +217,6 @@ func (r *Request) Do() *Response { } } - logger.Debugf("[%v] %v", req.Method, req.URL.String()) res, err := r.client.Do(req) if err != nil { return &Response{