Skip to content

Commit 4c0b2be

Browse files
committed
fix(gloo): Use correct route table name in case service name was overwritten
Signed-off-by: mdolinin <[email protected]>
1 parent ec44f64 commit 4c0b2be

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pkg/router/gloo.go

+3-4
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,8 @@ func (gr *GlooRouter) GetRoutes(canary *flaggerv1.Canary) (
170170
mirrored bool,
171171
err error,
172172
) {
173-
apexName := canary.Spec.TargetRef.Name
174-
primaryName := fmt.Sprintf("%s-%s-primaryupstream-%v", canary.Namespace, canary.Spec.TargetRef.Name, canary.Spec.Service.Port)
175-
173+
apexName, _, _ := canary.GetServiceNames()
174+
primaryUpstreamName := fmt.Sprintf("%s-%s-primaryupstream-%v", canary.Namespace, apexName, canary.Spec.Service.Port)
176175
routeTable, err := gr.glooClient.GatewayV1().RouteTables(canary.Namespace).Get(context.TODO(), apexName, metav1.GetOptions{})
177176
if err != nil {
178177
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) (
185184
}
186185

187186
for _, dst := range routeTable.Spec.Routes[0].Action.Destination.Destinations {
188-
if dst.Destination.Upstream.Name == primaryName {
187+
if dst.Destination.Upstream.Name == primaryUpstreamName {
189188
primaryWeight = int(dst.Weight)
190189
canaryWeight = 100 - primaryWeight
191190
return

0 commit comments

Comments
 (0)