Skip to content

Commit

Permalink
fix(gloo): Use correct route table name in case service name was over…
Browse files Browse the repository at this point in the history
…written
  • Loading branch information
mdolinin committed Oct 25, 2022
1 parent ec44f64 commit 563a82c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/router/gloo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 563a82c

Please sign in to comment.