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

pull/7678/head
Chris Piraino 2020-04-30 09:32:09 -05:00
parent 881760f701
commit c44f877758
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 var resources []proto.Message
for listenerKey, upstreams := range cfgSnap.IngressGateway.Upstreams { for listenerKey, upstreams := range cfgSnap.IngressGateway.Upstreams {
if listenerKey.Protocol == "tcp" { 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] u := upstreams[0]
id := u.Identifier() id := u.Identifier()