From 8b3a3f29a876c74710b7bb859946621a6f70f368 Mon Sep 17 00:00:00 2001 From: Sanket Sudake Date: Wed, 6 Apr 2022 09:41:54 +0530 Subject: [PATCH] Avoid tapservice call to executor with empty URL (#2402) We should avoid tap service call to executor if service URL retrieved from executor is empty. Added sanity checks to ensure that. Signed-off-by: Sanket Sudake --- pkg/executor/client/client.go | 2 +- pkg/router/functionHandler.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/executor/client/client.go b/pkg/executor/client/client.go index de363b88..4d32b261 100644 --- a/pkg/executor/client/client.go +++ b/pkg/executor/client/client.go @@ -160,7 +160,7 @@ func (c *Client) service() { } // TapService sends a TapServiceRequest over the request channel. -func (c *Client) TapService(fnMeta metav1.ObjectMeta, executorType fv1.ExecutorType, serviceURL *url.URL) { +func (c *Client) TapService(fnMeta metav1.ObjectMeta, executorType fv1.ExecutorType, serviceURL url.URL) { c.requestChan <- TapServiceRequest{ FnMetadata: metav1.ObjectMeta{ Name: fnMeta.Name, diff --git a/pkg/router/functionHandler.go b/pkg/router/functionHandler.go index b6f6340a..97923d55 100644 --- a/pkg/router/functionHandler.go +++ b/pkg/router/functionHandler.go @@ -455,10 +455,10 @@ func (roundTripper *RetryingRoundTripper) closeContext() { } func (fh *functionHandler) tapService(fn *fv1.Function, serviceURL *url.URL) { - if fh.executor == nil { + if fh.executor == nil || serviceURL == nil { return } - fh.executor.TapService(fn.ObjectMeta, fn.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType, serviceURL) + fh.executor.TapService(fn.ObjectMeta, fn.Spec.InvokeStrategy.ExecutionStrategy.ExecutorType, *serviceURL) } func (fh functionHandler) handler(responseWriter http.ResponseWriter, request *http.Request) {