spring-cloud / spring-cloud/spring-cloud-commons

Property spring.cloud.client.hostname ignores spring.cloud.inetutils.ignoredInterfaces

Open
#113 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

closable enhancement
Dominant language
Java
Stars
751
Forks
744
Avg merge
1d 14h
Merged PRs (30d)
9

Description

I have added the following property to my application.properties:

spring.cloud.inetutils.ignoredInterfaces=lo.*

Enpoint /env shows following:

"applicationConfig: [classpath:/application.properties]": {
# other props ommited
"spring.cloud.inetutils.ignoredInterfaces": "lo.*",
},
"springCloudClientHostInfo": {
"spring.cloud.client.hostname": "222.222.222.222",
"spring.cloud.client.ipAddress": "222.222.222.222"
}

Ip address 222.222.222.222 is loopback interface.
ifconfig of the machine:

eth0      Link encap:Ethernet  HWaddr -----
          inet addr:ip1  Bcast:ip2  Mask:mask
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13203005620 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12536115751 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:19445457457463 (19.4 TB)  TX bytes:13799195707294 (13.7 TB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:49268347035 errors:0 dropped:0 overruns:0 frame:0
          TX packets:49268347035 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:33269183251521 (33.2 TB)  TX bytes:33269183251521 (33.2 TB)

lo:1      Link encap:Local Loopback  
          inet addr:222.222.222.222  Mask:255.255.255.255
          UP LOOPBACK RUNNING  MTU:65536  Metric:1

I suppose this is not correct behaviour for springCloudClientHostInfo. I debugged HostInfoEnvironmentPostProcessor where the properties spring.cloud.client.hostname and spring.cloud.client.ipAddress are added to environment -- at this stage InetUtilsProperties ignored interfaces variable is empty (looks like it was not yet postprocessed). Is there a quick fix for the issue?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with HostInfoEnvironmentPostProcessor and InetUtilsProperties, then reproduce the configuration using spring.cloud.inetutils.ignoredInterfaces=lo.* and inspect the /env output. Trace whether ignored interfaces are available when the client hostname and IP address are added; done means the configured loopback interface is excluded from spring.cloud.client.hostname and spring.cloud.client.ipAddress.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.