Skip to content

Commit

Permalink
Merge pull request #1145 from anovateam/route_port_on_delegation
Browse files Browse the repository at this point in the history
istio: Add destination port when port discovery and delegation are true
  • Loading branch information
stefanprodan authored Mar 18, 2022
2 parents eca6fa7 + c7cbb72 commit 08deddc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/router/istio.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions pkg/router/istio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 08deddc

Please sign in to comment.