Skip to content

Commit

Permalink
log if the number of services is not 1 for gateway listeners (istio#1…
Browse files Browse the repository at this point in the history
…6601)

* log if the number of services is not 1 for gateway listeners.

* fix test
  • Loading branch information
yangminzhu authored and istio-testing committed Aug 31, 2019
1 parent 3cd6c36 commit 4d0524d
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pilot/pkg/networking/core/v1alpha3/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,22 @@ func (configgen *ConfigGeneratorImpl) buildGatewayListeners(
// end shady logic

var si *model.ServiceInstance
serviceInstances := make([]*model.ServiceInstance, 0, len(node.ServiceInstances))
for _, w := range node.ServiceInstances {
if w.Endpoint.Port == int(portNumber) {
si = w
break
if si == nil {
si = w
}
serviceInstances = append(serviceInstances, w)
}
}
if len(serviceInstances) != 1 {
names := make([]host.Name, 0, len(serviceInstances))
for _, s := range serviceInstances {
names = append(names, s.Service.Hostname)
}
log.Warnf("buildGatewayListeners: found %d services on port %d: %v",
len(serviceInstances), portNumber, names)
}

pluginParams := &plugin.InputParams{
Expand Down

0 comments on commit 4d0524d

Please sign in to comment.