From 563a82c717bd284fb6a849bcd4d37ae8d8f5e7d0 Mon Sep 17 00:00:00 2001 From: mdolinin Date: Mon, 24 Oct 2022 20:47:06 -0400 Subject: [PATCH] fix(gloo): Use correct route table name in case service name was overwritten --- pkg/router/gloo.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pkg/router/gloo.go b/pkg/router/gloo.go index 4972b9273..519a4a1d0 100644 --- a/pkg/router/gloo.go +++ b/pkg/router/gloo.go @@ -170,9 +170,8 @@ func (gr *GlooRouter) GetRoutes(canary *flaggerv1.Canary) ( mirrored bool, err error, ) { - apexName := canary.Spec.TargetRef.Name - primaryName := fmt.Sprintf("%s-%s-primaryupstream-%v", canary.Namespace, canary.Spec.TargetRef.Name, canary.Spec.Service.Port) - + apexName, _, _ := canary.GetServiceNames() + primaryUpstreamName := fmt.Sprintf("%s-%s-primaryupstream-%v", canary.Namespace, apexName, canary.Spec.Service.Port) routeTable, err := gr.glooClient.GatewayV1().RouteTables(canary.Namespace).Get(context.TODO(), apexName, metav1.GetOptions{}) if err != nil { err = fmt.Errorf("RouteTable %s.%s get query error: %w", apexName, canary.Namespace, err) @@ -185,7 +184,7 @@ func (gr *GlooRouter) GetRoutes(canary *flaggerv1.Canary) ( } for _, dst := range routeTable.Spec.Routes[0].Action.Destination.Destinations { - if dst.Destination.Upstream.Name == primaryName { + if dst.Destination.Upstream.Name == primaryUpstreamName { primaryWeight = int(dst.Weight) canaryWeight = 100 - primaryWeight return