From c7cbb729b72568e6062ac17ce4ff99325fe75e88 Mon Sep 17 00:00:00 2001 From: Marco Amador Date: Wed, 16 Mar 2022 18:25:53 +0000 Subject: [PATCH] add destination port when port discovery is active and delegation is true Signed-off-by: Marco Amador --- pkg/router/istio.go | 4 ++-- pkg/router/istio_test.go | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/router/istio.go b/pkg/router/istio.go index d6f7ce799..8183e4a02 100644 --- a/pkg/router/istio.go +++ b/pkg/router/istio.go @@ -488,8 +488,8 @@ func makeDestination(canary *flaggerv1.Canary, host string, weight int) istiov1a // set destination port when an ingress gateway is specified if canary.Spec.Service.PortDiscovery && - len(canary.Spec.Service.Gateways) > 0 && - canary.Spec.Service.Gateways[0] != "mesh" { + (len(canary.Spec.Service.Gateways) > 0 && + canary.Spec.Service.Gateways[0] != "mesh" || canary.Spec.Service.Delegation) { dest = istiov1alpha3.DestinationWeight{ Destination: istiov1alpha3.Destination{ Host: host, diff --git a/pkg/router/istio_test.go b/pkg/router/istio_test.go index 5ec52012c..9b549846a 100644 --- a/pkg/router/istio_test.go +++ b/pkg/router/istio_test.go @@ -372,6 +372,9 @@ func TestIstioRouter_Delegate(t *testing.T) { assert.Equal(t, 0, len(vs.Spec.Hosts)) assert.Equal(t, 0, len(vs.Spec.Gateways)) + + port := vs.Spec.Http[0].Route[0].Destination.Port.Number + assert.Equal(t, uint32(mocks.canary.Spec.Service.Port), port) }) t.Run("invalid", func(t *testing.T) {