@Override public ServiceInstance getLocalServiceInstance() { String serviceName = properties.getServiceName(); String podName = System.getenv(HOSTNAME); ServiceInstance defaultInstance = new DefaultServiceInstance(serviceName, "localhost", 8080, false); Endpoints endpoints = client.endpoints().withName(serviceName).get(); if (Utils.isNullOrEmpty(podName) || endpoints == null) { return defaultInstance; } try { return endpoints.getSubsets() .stream() .filter(s -> s.getAddresses().get(0).getTargetRef().getName().equals(podName)) .map(s -> (ServiceInstance) new KubernetesServiceInstance(serviceName, s.getAddresses().stream().findFirst().orElseThrow(IllegalStateException::new), s.getPorts().stream().findFirst().orElseThrow(IllegalStateException::new), false)) .findFirst().orElse(defaultInstance); } catch (Throwable t) { return defaultInstance; } }
public EndpointAddressBuilder( EndpointAddressFluent<?> fluent , EndpointAddress instance ){ this.fluent = fluent; fluent.withIP(instance.getIP()); fluent.withTargetRef(instance.getTargetRef()); } public EndpointAddressBuilder( EndpointAddress instance ){
public EndpointAddressBuilder( EndpointAddress instance ){ this.fluent = this; this.withIP(instance.getIP()); this.withTargetRef(instance.getTargetRef()); }
public EndpointAddressBuilder( EndpointAddress instance ){ this.fluent = this; this.withIp(instance.getIp()); this.withTargetRef(instance.getTargetRef()); }
public EndpointAddressBuilder( EndpointAddressFluent<?> fluent , EndpointAddress instance ){ this.fluent = fluent; fluent.withIp(instance.getIp()); fluent.withTargetRef(instance.getTargetRef()); } public EndpointAddressBuilder( EndpointAddress instance ){
@Override public ServiceInstance getLocalServiceInstance() { String serviceName = properties.getServiceName(); String podName = System.getenv(HOSTNAME); ServiceInstance defaultInstance = new DefaultServiceInstance(serviceName, "localhost", 8080, false); Endpoints endpoints = client.endpoints().withName(serviceName).get(); if (Utils.isNullOrEmpty(podName) || endpoints == null) { return defaultInstance; } try { return endpoints.getSubsets() .stream() .filter(s -> s.getAddresses().get(0).getTargetRef().getName().equals(podName)) .map(s -> (ServiceInstance) new KubernetesServiceInstance(serviceName, s.getAddresses().stream().findFirst().orElseThrow(IllegalStateException::new), s.getPorts().stream().findFirst().orElseThrow(IllegalStateException::new), false)) .findFirst().orElse(defaultInstance); } catch (Throwable t) { return defaultInstance; } }
public EndpointAddressBuilder(EndpointAddress instance,Boolean validationEnabled){ this.fluent = this; this.withHostname(instance.getHostname()); this.withIp(instance.getIp()); this.withTargetRef(instance.getTargetRef()); this.validationEnabled = validationEnabled; }
public EndpointAddressBuilder(EndpointAddressFluent<?> fluent,EndpointAddress instance,Boolean validationEnabled){ this.fluent = fluent; fluent.withHostname(instance.getHostname()); fluent.withIp(instance.getIp()); fluent.withTargetRef(instance.getTargetRef()); this.validationEnabled = validationEnabled; } public EndpointAddressBuilder(EndpointAddress instance){
public EndpointAddressFluentImpl(EndpointAddress instance){ this.withHostname(instance.getHostname()); this.withIp(instance.getIp()); this.withTargetRef(instance.getTargetRef()); }
for (EndpointSubset subset : endpoints.getSubsets()) { for (EndpointAddress address : subset.getAddresses()) { String podName = address.getTargetRef().getName(); podNames.add(podName); String privateIp = address.getIp();