Comment why it is ok to expect upstreams slice to not be empty

This commit is contained in:
Chris Piraino 2020-04-30 09:32:09 -05:00
parent 9b9dfa8eeb
commit c30a7bfdfe
1 changed files with 3 additions and 0 deletions

View File

@ -272,6 +272,9 @@ func (s *Server) listenersFromSnapshotIngressGateway(cfgSnap *proxycfg.ConfigSna
var resources []proto.Message
for listenerKey, upstreams := range cfgSnap.IngressGateway.Upstreams {
if listenerKey.Protocol == "tcp" {
// We rely on the invariant of upstreams slice always having at least 1
// member, because this key/value pair is created only when a
// GatewayService is returned in the RPC
u := upstreams[0]
id := u.Identifier()