use of io.kubernetes.client.extended.network.exception.NoAvailableAddressException in project java by kubernetes-client.
the class EndpointsLoadBalancer method getTargetIP.
@Override
public String getTargetIP(int port) throws NoAvailableAddressException {
V1Endpoints ep = endpointsSupplier.get();
if (ep == null || ep.getSubsets() == null) {
throw new NoAvailableAddressException();
}
List<String> availableIPs = getAllAvailableIPs(port);
if (availableIPs.size() == 0) {
throw new NoAvailableAddressException();
}
return this.strategy.chooseIP(availableIPs);
}
Aggregations