spring-cloud-netflix
spring-cloud-netflix copied to clipboard
EurekaReactiveDiscoveryClient.getInstances() assumes vipAddress.
Hi, I'm using Spring Cloud Gateway (v 2.2.2 release) and activated eureka discovery (eureka server v 2.1.0.RELEASE) I have a spring application (not spring boot) registered into Eureka : we used Eureka Client library (v 1.9.18) for the registration For the registration, i set :
eureka.secureVipAddress=customer-api-transcap
eureka.port.enabled=false # because application is over https
eureka.securePort=443
eureka.securePort.enabled=true
The registration is ok into eureka (i see app and instance UP) But in spring cloud gateway, the route for the service is NEVER created. By debugging Spring cloud gateway, i've noticed that only the instance defined with vipAdress in Eureka are taken (not the instance with ONLY secureVipAdress) For me it's a bug
Please see below :
Into Eureka : Only secureVipAddress is set :
<application>
<name>CUSTOMER-API-TRANSCAP</name>
<instance>
<instanceId>xl11lsrv0545.bnet.luxds.net</instanceId>
<hostName>xl11lsrv0545.bnet.luxds.net</hostName>
<app>CUSTOMER-API-TRANSCAP</app>
<ipAddr>10.177.1.175</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="false">80</port>
<securePort enabled="true">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>10</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1585718912043</registrationTimestamp>
<lastRenewalTimestamp>1585744377083</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1585718912043</serviceUpTimestamp>
</leaseInfo>
<metadata>
<startup>750209327</startup>
</metadata>
<appGroupName>UNKNOWN</appGroupName>
<homePageUrl>https://bil1ih66d/</homePageUrl>
<statusPageUrl>http://xl11lsrv0545.bnet.luxds.net:80/Status</statusPageUrl>
<secureHealthCheckUrl>https://xl11lsrv0545.bnet.luxds.net:443</healthcheck>
</secureHealthCheckUrl>
<secureVipAddress>customer-api-transcap</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1585718912043</lastUpdatedTimestamp>
<lastDirtyTimestamp>1585718911328</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
In spring cloud gateway : /actuator/gateway/routes is empty :
[]
When i registered the application with both secureVipAdress and vipAdress, the route is created by Spring Cloud Gateway
In Eureka :
<application>
<name>CUSTOMER-API-TRANSCAP</name>
<instance>
<instanceId>xl11lsrv0545.bnet.luxds.net</instanceId>
<hostName>xl11lsrv0545.bnet.luxds.net</hostName>
<app>CUSTOMER-API-TRANSCAP</app>
<ipAddr>10.177.1.175</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">80</port>
<securePort enabled="true">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">
<name>MyOwn</name>
</dataCenterInfo>
<leaseInfo>
<renewalIntervalInSecs>10</renewalIntervalInSecs>
<durationInSecs>90</durationInSecs>
<registrationTimestamp>1585753201828</registrationTimestamp>
<lastRenewalTimestamp>1585754578144</lastRenewalTimestamp>
<evictionTimestamp>0</evictionTimestamp>
<serviceUpTimestamp>1585753201828</serviceUpTimestamp>
</leaseInfo>
<metadata>
<startup>1560134096</startup>
</metadata>
<appGroupName>UNKNOWN</appGroupName>
<homePageUrl>https://bil1ih66d/</homePageUrl>
<statusPageUrl>http://xl11lsrv0545.bnet.luxds.net:80/Status</statusPageUrl>
<healthCheckUrl>http://xl11lsrv0545.bnet.luxds.net:80/healthcheck</healthCheckUrl>
<secureHealthCheckUrl>
https://xl11lsrv0545.bnet.luxds.net:443/healthcheck
</secureHealthCheckUrl>
<vipAddress>customer-api-transcap</vipAddress>
<secureVipAddress>customer-api-transcap</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1585753201828</lastUpdatedTimestamp>
<lastDirtyTimestamp>1585753201082</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>
</application>
In Spring cloud gateway (routes) :
[
{
"predicate": "Paths: [/customer-api-transcap/**, /ms/customer-api-transcap/**], match trailing slash: true",
"metadata": {
"startup": "1560134096"
},
"route_id": "ReactiveCompositeDiscoveryClient_CUSTOMER-API-TRANSCAP",
"filters": [
"[[RewritePath /(?:.*?/)?customer-api-transcap/(?<remaining>.*) = '/${remaining}'], order = 1]",
"[com.bil.transversal.isp.filters.AuthenticationFilter$$Lambda$804/1662797699@227947f6, order = 20000]"
],
"uri": "lb://CUSTOMER-API-TRANSCAP",
"order": 0
}
]
And finally, in the spring application, I've to set these properties :
eureka.secureVipAddress=customer-api-transcap
eureka.vipAddress=customer-api-transcap
eureka.port.enabled=true # required for having vipAddress into Eureka instance
eureka.securePort=443
eureka.securePort.enabled=true
I must activate non secure port. The eureka client lib don't send vipAddress information if non secure is not activated
I think the problem comes from the code below : class org.springframework.cloud.netflix.eureka.reactive.EurekaReactiveDiscoveryClient Method: getInstances
@Override
public Flux<ServiceInstance> getInstances(String serviceId) {
return Flux
.defer(() -> Flux.fromIterable(
eurekaClient.getInstancesByVipAddress(serviceId, false)))
.map(EurekaServiceInstance::new);
}
Only the instances registered with VipAdress are taken
Regards
Transferred to spring-cloud-netflix as that is where the issue lies. There would have to be some decision made on how to do this as getInstancesByVipAddress()
takes a boolean, so you would get secure or not.
Ok thanks you Yes actually, only false is passed to the method
Hello everyone, is there a plan to fix this issue anytime soon? Thank you in advance for your answer, regards