Skip to content

Commit

Permalink
fix multiple egress hosts select same service error (#33766)
Browse files Browse the repository at this point in the history
  • Loading branch information
kebe7jun committed Jul 2, 2021
1 parent 8dd4a1f commit d4255f0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 1 addition & 4 deletions pilot/pkg/model/sidecar.go
Expand Up @@ -659,10 +659,7 @@ func (ilw *IstioEgressListenerWrapper) selectServices(services []*Service, confi
if svc := matchingService(importedHosts, s, ilw); svc != nil {
importedServices = append(importedServices, svc)
}
}

// Check if there is an import of form */host or */*
if wnsFound {
} else if wnsFound { // Check if there is an import of form */host or */*
if svc := matchingService(wildcardHosts, s, ilw); svc != nil {
importedServices = append(importedServices, svc)
}
Expand Down
7 changes: 7 additions & 0 deletions pilot/pkg/model/sidecar_test.go
Expand Up @@ -1389,6 +1389,13 @@ func TestIstioEgressListenerWrapper(t *testing.T) {
expected: []*Service{},
namespace: "a",
},
{
name: "multiple hosts selected same service",
listenerHosts: map[string][]host.Name{"a": {wildcardService}, "*": {wildcardService}},
services: []*Service{serviceA8000},
expected: []*Service{serviceA8000},
namespace: "a",
},
}

for _, tt := range tests {
Expand Down

0 comments on commit d4255f0

Please sign in to comment.