From f2b6600db72c6af82330c83ffe2bfcba25ff0eac Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 18 Feb 2021 18:48:40 +0100 Subject: [PATCH] :sparkles: Make sure to support Namespaces (#79) --- pkg/openfaas/cacher.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/openfaas/cacher.go b/pkg/openfaas/cacher.go index 501375a8..67fdada5 100644 --- a/pkg/openfaas/cacher.go +++ b/pkg/openfaas/cacher.go @@ -2,11 +2,13 @@ package openfaas import ( "context" - types2 "github.com/Templum/rabbitmq-connector/pkg/types" + "fmt" "log" "strings" "time" + types2 "github.com/Templum/rabbitmq-connector/pkg/types" + "github.com/Templum/rabbitmq-connector/pkg/config" "github.com/openfaas/faas-provider/types" ) @@ -102,7 +104,11 @@ func (c *Controller) crawlFunctions(ctx context.Context, namespaces []string, bu topics := c.extractTopicsFromAnnotations(fn) for _, topic := range topics { - builder.Append(topic, fn.Name) + if len(ns) > 0 { + builder.Append(topic, fmt.Sprintf("%s.%s", fn.Name, ns)) // Include Namespace to call the correct function + } else { + builder.Append(topic, fn.Name) + } } } }