-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How does discovery work with container networking? #19
Comments
@csterwa, @royclarkson or @scottfrederick could give us a little insight. |
Discovery "just works" with container networking. Some configuration is required in the apps and in the platform if you want the registering app and discovering app to communicate directly via IP address (i.e. container to container, bypassing the platform router). There's a blog post that provides some details, with Spring Cloud Services specifics. Setting |
Revisiting this now that I have more context on The To properly support container-to-container networking, there would need to be an option for the discovery logic to map from logical app name to the IP address of each running app instance's container. It doesn't appear that the CF API provides a way to get the in-container IP address of an app instance, only the IP address of the Diego cell that the container is running on and the port for the app instance. Using the Diego cell IP address and instance port is probably enough to bypass the Router and effectively support container-to-container communication. |
Cloud Foundry now supports DNS-based polyglot service discovery. This sample worked thought it's a naive implementation How about providing more generic DNS based Discovery Client? |
We're open to ideas. Isn't DNS-based discovery basically how java.net.URL works out of the box? |
Updated the sample to use |
Looks good. Maybe send a PR? If you can figure out how to write a test that would be awesome. |
Will do. I'll implement followings:
|
DNS-based discovery would work fine with newer versions of CF, but isn't supported on older versions. I don't see users asking for container-to-container support with spring-cloud-cloudfoundry right now, so I think going with the future-based DNS approach is fine. @making One approach would be to add a new property like |
I made two candidates. Can you give me advices which one should be appropriate. First one is using cf-java-client to retrieve application metadata and checks if internal domain is included in app's urls. index-based routes is used. so we don't need resolve ip address in this client. Second one is just relying on DNS and does not depends on cf-java-client. |
@making I haven't looked closely at the code or tested it myself, but did have an observation: One of the issues I have with the current It looks like your first option has the same limitation, but the second option does not as it just maps logical app name to an internal route. So that's one consideration. |
Since they are both configurable, would they be beneficial as is? We're close to an RC1, so if you'd like to submit a PR @making. |
@scottfrederick Container to container networking need network policy ( Supported both type I'll send a PR after I test it on PWS. |
Hello, I want to thank you all for this nice feature, it works as charm. I have one question regarding DNS based discovery: Is it safe to use it in web-flux/reactive application or we need some non-blocking DNS resolver for this one? |
There shouldn't be any manual DNS resolving happening |
Adds new two DiscoveryClient implementations that depend on native Service Discovery supported by Cloud Foundry. CloudFoundryAppServiceDiscoveryClient uses cf-java-client and find container's index-based route (e.g. 0.billing.apps.internal, 1.billing.apps.internal, 2.billing.apps.internal). SimpleDnsBasedDiscoveryClient simply uses DNS and resolve container's ip (e.g. 10.250.56.12, 10.254.160.118, 10.254.112.192). does not depend on cf-java-client By default, existing CloudFoundryDiscoveryClient is chosen. Configuring spring.cloud.cloudfoundry.discovery.use-dns=true enables CloudFoundryAppServiceDiscoveryClient. Configuring spring.cloud.cloudfoundry.discovery.use-dns=true and spring.cloud.cloudfoundry.discovery.use-container-ip=true enables SimpleDnsBasedDiscoveryClient. This DiscoveryClient eliminates the limitation of Turbine on Cloud Foundry and does not need Turbine Stream. In some environments (such as in a PaaS setting), the classic Turbine model of pulling metrics from all the distributed Hystrix commands does not work. See gh-19
Maybe something magic happens and it all works just fine. Would be good to try it and document it at least.
The text was updated successfully, but these errors were encountered: