Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gloo): Use correct route table name in case service name was overwritten #1300

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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