-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
#954 #957 #1026 Customize Consul services creation in Consul
service discovery provider
#2067
Conversation
Consul
service discovery providerConsul
service discovery provider
@ignacy130 Hello Ignacy! @ggnaegi You are the primary reviewer for this PR. 😉 |
@raman-m Your idea is great, but I think we should rework it a bit first. We should think about polling and long polling and give the ability to the users to develop their own implementations. |
@ggnaegi, I understand you're expecting new method overrides for the next version of the provider with enhanced polling capabilities, correct? You'll have the opportunity to do so. 😉 Let's proceed with releasing this bug fix and the package update in version 23.3, shall we? |
The rest of the work
|
No JSON options because `ServiceDiscoveryProvider` are generalized for all types of providers
Update `IsValid(ServiceEntry entry)` Co-authored-by: Raynald Messié <redbird_project@yahoo.fr>
If it is null, search for a node in the common collection.
@ggnaegi Dev Complete! Docs written! |
Fixes #954 #957 #1026
Proposed Changes
This PR introduces general customization options for the
Consul
provider, taking inspiration from theKube
provider customization in PR #2052. However, this PR offers a more flexible design as outlined below 👇Consul
provider.IConsulServiceBuilder
service into theConsul
provider.DefaultConsulServiceBuilder
class's behavior.protected virtual ServiceHostAndPort GetServiceHostAndPort(ServiceEntry entry, Node node)
protected virtual string GetDownstreamHost(ServiceEntry entry, Node node)
In conclusion, customization hinges on the virtual methods of the
DefaultConsulServiceBuilder
class, allowing developers to override as needed for highly customized Consul setups in their environments.Initially, I considered introducing JSON overrides for the
ServiceDiscoveryProvider
section in the global configuration ofocelot.json
. However, I realized that approach was suboptimal. Writing C# code that inherits from theDefaultConsulServiceBuilder
class is a superior solution.Predecessors
Kube
service discovery provider #2052