Skip to content

Commit

Permalink
Merge pull request #1300 from mdolinin/fix/gloo-non-default-service-n…
Browse files Browse the repository at this point in the history
…ame-corretly-get-routes

fix(gloo): Use correct route table name in case service name was overwritten
  • Loading branch information
stefanprodan authored Oct 26, 2022
2 parents ec44f64 + 647f624 commit a7df345
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 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
3 changes: 1 addition & 2 deletions test/gloo/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -o errexit

GLOO_VER="1.11.13"
GLOO_VER="1.12.31"
REPO_ROOT=$(git rev-parse --show-toplevel)

mkdir -p ${REPO_ROOT}/bin
Expand All @@ -15,7 +15,6 @@ helm upgrade -i gloo gloo/gloo --version ${GLOO_VER} \
--set discovery.enabled=false

kubectl -n gloo-system rollout status deployment/gloo
kubectl -n gloo-system rollout status deployment/gateway
kubectl -n gloo-system get all

echo '>>> Installing Flagger'
Expand Down

0 comments on commit a7df345

Please sign in to comment.