Search in sources :

Example 1 with NoAvailableAddressException

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);
}
Also used : V1Endpoints(io.kubernetes.client.openapi.models.V1Endpoints) NoAvailableAddressException(io.kubernetes.client.extended.network.exception.NoAvailableAddressException)

Aggregations

NoAvailableAddressException (io.kubernetes.client.extended.network.exception.NoAvailableAddressException)1 V1Endpoints (io.kubernetes.client.openapi.models.V1Endpoints)1