From 2729fa02bc54086a11e3354443aa3aa241c9193e Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Wed, 20 Dec 2017 10:44:24 -1000 Subject: [PATCH] Stop using "default" as default service namespace (#61) Previously the destinations service would look for services in the "default" namespace if the service name didn't have at least two labels. However, the "default" namespace is almost always the wrong namespace. The only reasonable default namespace is the namespace of the client service, which isn't given to the destinations service. Therefore it shouldn't try to default the namespace. Accordingly, stop defaulting the namespace to "default". Validated by manually testing the emojivoto service before and after the proxy implemented namespace defaulting itself. --- controller/destination/server.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/controller/destination/server.go b/controller/destination/server.go index 7e3ba082e..6d28c5258 100644 --- a/controller/destination/server.go +++ b/controller/destination/server.go @@ -85,12 +85,16 @@ func (s *server) Get(dest *common.Destination, stream pb.Destination_GetServer) } // service.namespace.svc.cluster.local domains := strings.Split(host, ".") - service := domains[0] - namespace := "default" - if len(domains) > 1 { - namespace = domains[1] + + if len(domains) < 2 { + err := fmt.Errorf("not a service: %s", host) + log.Error(err) + return err } + service := domains[0] + namespace := domains[1] + id := namespace + "/" + service listener := endpointListener{stream: stream}