Skip to content

Commit

Permalink
fix: fix array out of bunds when listener address not ready
Browse files Browse the repository at this point in the history
  • Loading branch information
lwpk110 committed Jul 26, 2024
1 parent e926534 commit f35c952
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/controller/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,12 @@ func (d *Discovery) getListenerAddress(
discoveryLog.Error(err, "failed to get listener", "cacheKey", cacheKey)
return nil, err
}

listenerAddresses := listener.Status.IngressAddresses
if len(listenerAddresses) == 0 {
discoveryLog.Info("not found listener address", "listener.status", listener.Status)
return nil, errors.New("not found listener address")
}
address := &listener.Status.IngressAddresses[0]
cacheObj[cacheKey] = address
return address, nil
Expand Down

0 comments on commit f35c952

Please sign in to comment.