Spring-cloud-netflix: EurekaClientAutoConfiguration references ip-address improperly with ipAddress

Created on 25 Apr 2018  路  6Comments  路  Source: spring-cloud/spring-cloud-netflix

Before spring-boot 2.0 the property eureka.instance.ip-address was used to set the ip-address that our application should use when registering to Eureka.

But now it is not working. I was unable to find any information in the documentation about a change in this behavor.

Similar problems have been reported in older versions: https://github.com/spring-cloud/spring-cloud-netflix/issues/573 , https://github.com/spring-cloud/spring-cloud-netflix/issues/788

Sample app: https://github.com/RodrigoPetter/sample-app
Spring-boot: 2.0.1.RELEASE
spring-cloud-starter-netflix-eureka-client: 2.0.0.RC1

application.properties:
Main class annotations:
build.gradle

Something that i noticed is that in my /actuator/env there is a spring.cloud.client.ip-address with the value displayed in the Eureka, but I was unable to override it.

bug

All 6 comments

There has been no change. #573 was fixed.

AFAICT this is working with your application.
From /eureka/apps:

<!-- ... -->
<applications>
<application>
<name>DEMOAPPLICATION</name>
<instance>
<instanceId>192.168.2.115:DemoApplication</instanceId>
<hostName>"192.168.0.1"</hostName>
<app>DEMOAPPLICATION</app>
<ipAddr>"192.168.0.1"</ipAddr>
<port enabled="true">8080</port>
<!-- ... -->
</instance>
</application>
</applications>

What do you think the problem is?

Thanks for the fast reply Spencer.
You are right, it work as spected. I was looking in the wrong properti statusPageUrl.

Can you tell me why statusPageUrl and healthCheckUrl doesn't use neither the ip-address or hostname for theirs URIs?

I know i can use eureka.instance.status-page-url=https://${eureka.instance.ip-address}/health to force it to happen, but in older versions it was automatic.

Here is a sample from an old application where the unique propertie that i changed was ip-address and hostname and all the URLs follow the same ip/hostname 10.244.168.33

<instance>
<instanceId>10.255.0.58:document-service:9123</instanceId>
<hostName>10.244.168.33</hostName>
<app>DOCUMENT-SERVICE</app>
<ipAddr>10.244.168.33</ipAddr>
<status>UP</status>
<overriddenstatus>UNKNOWN</overriddenstatus>
<port enabled="true">9123</port>
<securePort enabled="false">443</securePort>
<countryId>1</countryId>
<dataCenterInfo class="com.netflix.appinfo.InstanceInfo$DefaultDataCenterInfo">...</dataCenterInfo>
<leaseInfo>...</leaseInfo>
<metadata class="java.util.Collections$EmptyMap"/>
<homePageUrl>http://10.244.168.33:9123/</homePageUrl>
<statusPageUrl>http://10.244.168.33:9123/info</statusPageUrl>
<healthCheckUrl>http://10.244.168.33:9123/health</healthCheckUrl>
<vipAddress>document-service</vipAddress>
<secureVipAddress>document-service</secureVipAddress>
<isCoordinatingDiscoveryServer>false</isCoordinatingDiscoveryServer>
<lastUpdatedTimestamp>1519758970852</lastUpdatedTimestamp>
<lastDirtyTimestamp>1519758970154</lastDirtyTimestamp>
<actionType>ADDED</actionType>
</instance>

Looks like a bug in DefaultManagementMetadataProvider.

You should remove the quotes from hostname and ip-address in your properties file.

Fixed via 0cfbac1b435a6375b343931096565ad9e3e72969

Was this page helpful?
0 / 5 - 0 ratings