Skip to content

Commit 6088515

Browse files
raman-mben-bartholomewdependabot[bot]antikorolPaulARoy
authored
Merge PR #2162 from release/23.3 | Release 23.3.4 | v23.3 Hotfixes | Blue Olympic Balumbes release
* #2084 Apply default config file paths in `GetMergedOcelotJson` when providing the `folder` argument of `AddOcelot` (#2120) * Adding unit test first * Fixing default global config file not being found in folder * Adding PR trait to test * Backing out whitespace changes * Code review by @raman-m * Create Configuration feature folder and move test classes * Adjust namespace and review what we have * Acceptance tests for #2084 user scenario --------- Co-authored-by: Raman Maksimchuk <[email protected]> * Bump Steeltoe.Discovery.Eureka from 3.2.5 to 3.2.8 in /src/Ocelot.Provider.Eureka (#2122) * Bump Steeltoe.Discovery.Eureka in /src/Ocelot.Provider.Eureka Bumps [Steeltoe.Discovery.Eureka](https://github.com/SteeltoeOSS/Steeltoe) from 3.2.5 to 3.2.8. - [Release notes](https://github.com/SteeltoeOSS/Steeltoe/releases) - [Changelog](https://github.com/SteeltoeOSS/Steeltoe/blob/main/Steeltoe.Release.ruleset) - [Commits](SteeltoeOSS/Steeltoe@3.2.5...3.2.8) --- updated-dependencies: - dependency-name: Steeltoe.Discovery.Eureka dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * Bump Steeltoe.Discovery.ClientCore from 3.2.5 to 3.2.8 --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Raman Maksimchuk <[email protected]> * #2110 Review load balancing and independent fetching the list of services in `Kube` provider (#2111) * Move the creation of the services list from the class field to the method, to prevent modification list from different threads * Early return after data checking * Add unit test for concurrent get list of services * Add logging for invalid service configuration error in RoundRobin load balancer * Code review by @raman-m * Workaround for mistakes made during acceptance testing of load balancing versus service discovery, where tests designed for parallel requests were mistakenly executed sequentially. This resulted in load balancers being loaded by sequential `HttpClient` calls, which was a significant oversight. * Let's DRY StickySessionsTests * Add acceptance tests, but... RoundRobin is not actually RoundRobin 😁 -> 😆 * Independent static indexing iterators per route via service names * Stabilize `CookieStickySessions` load balancer. Review tests after refactoring of `RoundRobin` load balancer * Refactor Lease operation for load balancing. Review LeastConnection load balancer * Leasing mechanism in Round Robin load balancer * Acceptance tests, final version * Apply Retry pattern for K8s endpoint integration * Fix IDE warnings and messages * Follow suggestions and fix issues from code review by @ggnaegi * Bump KubeClient from 2.4.10 to 2.5.8 * Fix warnings * Final version of `Retry` pattern --------- Co-authored-by: Raman Maksimchuk <[email protected]> * Downgrade the Warning to Information on missing `Content-Length` header in `MultiplexingMiddleware` (#2146) * fix: downgrade the warning to information on missing content-length header * chore: add route name to logs * test: fixing multiplexing middleware tests * Code review by @raman-m --------- Co-authored-by: Paul Roy <[email protected]> Co-authored-by: Raman Maksimchuk <[email protected]> * Correct the broken link to the GraphQL sample's `README.md` (#2149) Signed-off-by: Emmanuel Ferdman <[email protected]> Co-authored-by: Raman Maksimchuk <[email protected]> * #2116 Escaping unsafe pattern values of `Regex` constructor ​​derived from URL query parameter values containing special `Regex` chars (#2150) * regex escape handling for url templates * refactored regex method to lamda version * Quick code review by @raman-m * added acceptance test for url regex bug * moved acceptance test to routing tests * Convert to theory: define 2 test cases --------- Co-authored-by: Raman Maksimchuk <[email protected]> * #2119 Review load balancing (2nd round) and redesign `DefaultConsulServiceBuilder` with `ConsulProviderFactory` refactoring to make it thread safe and friendly (#2151) * Review tests * History of Service Discovery testing: add traits * LoadBalancer traits * #2119 Steps to Reproduce * Reuse service handlers of `ConcurrentSteps` * Reuse service counters of `ConcurrentSteps` * Add LoadBalancer namespace and move classes * Move `Lease` * Move `LeaseEventArgs` * Analyze load balancers aka `ILoadBalancerAnalyzer` interface objects * Prefer using named local methods as delegates over anonymous methods for awesome call stack, ensuring the delegate's typed result matches the typed balancer's creator. Additionally, employ an IServiceProvider workaround. * Review load balancing. Assert service & leasing counters as concurrent step. Final version of acceptance test. * Fixed naming violation for asynchronous methods: `Lease` -> `LeaseAsync` * Fix ugly reflection issue of dymanic detection in favor of static type property * Propagate the `ConsulRegistryConfiguration` object through `HttpContext` in the scoped version of the default service builder, utilizing the injected `IHttpContextAccessor` object. Update `ConsulProviderFactory`. Update docs. Update tests. * Add tests from clean experiment * Final review of the tests * Review `IHttpContextAccessor` logic. Convert anonymous delegates to named ones in placeholders processing * Tried to enhance more, but failed --------- Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: Emmanuel Ferdman <[email protected]> Co-authored-by: Ben Bartholomew <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Roman <[email protected]> Co-authored-by: Paul Roy <[email protected]> Co-authored-by: Paul Roy <[email protected]> Co-authored-by: Emmanuel Ferdman <[email protected]> Co-authored-by: Finn <[email protected]>
2 parents 8c0180a + acda395 commit 6088515

File tree

106 files changed

+3563
-2605
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+3563
-2605
lines changed

ReleaseNotes.md

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,31 @@
1-
Technical release, version {0}
1+
## 🔥 Hot fixing v[23.3](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.0) (version {0}) aka [Blue Olympic Balumbes](https://www.youtube.com/live/j-Ou-ggS718?si=fPPwmOwjYEZq70H9&t=9518) release
2+
> Codenamed: **[Blue Olympic Fiend](https://www.youtube.com/live/j-Ou-ggS718?si=fPPwmOwjYEZq70H9&t=9518)**
3+
> Read the Docs: [Ocelot 23.3](https://ocelot.readthedocs.io/en/{0}/)
4+
> Hot fixed versions: [23.3.0](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.0), [23.3.3](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.3)
5+
> Milestone: [v23.3 Hotfixes](https://github.com/ThreeMammals/Ocelot/milestone/8)
6+
7+
❤️ A heartfelt "Thank You" to [Roman Shevchik](https://github.com/antikorol) and [Massimiliano Innocenti](https://github.com/minnocenti901) for their contributions in testing and reporting the [Service Discovery](https://github.com/ThreeMammals/Ocelot/labels/Service%20Discovery) issues, #2110 and #2119, respectively!
8+
9+
### ℹ️ About
10+
This release delivers a number of bug fixes for the predecessor's [23.3.0](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.0) release, which is full of new features but was not tested well. All bugs were combined into the [v23.3 Hotfixes](https://github.com/ThreeMammals/Ocelot/milestone/8) milestone.
11+
12+
Following the substantial refactoring of [Service Discovery](https://github.com/ThreeMammals/Ocelot/blob/main/docs/features/servicediscovery.rst) providers in the [23.3.0](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.0) release, the community identified and we have acknowledged several [critical service discovery defects](https://github.com/ThreeMammals/Ocelot/issues?q=is%3Aissue+milestone%3A%22v23.3+Hotfixes%22+label%3A%22Service+Discovery%22) with providers such as [Kube](https://github.com/ThreeMammals/Ocelot/blob/main/docs/features/kubernetes.rst) and [Consul](https://github.com/ThreeMammals/Ocelot/blob/main/docs/features/servicediscovery.rst#consul). The `Kube` provider, while somewhat unstable, remained operational; however, the `Consul` provider was entirely non-functional.
13+
14+
📓 If your projects rely on the [Service Discovery](https://ocelot.readthedocs.io/en/latest/features/servicediscovery.html) feature and cannot function without it, please upgrade to this version to utilize the full list of features of version [23.3.0](https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.0).
15+
16+
### 🧑‍💻 Technical Information
17+
A comprehensive explanation of the technical details would span several pages; therefore, it is advisable for fans of Ocelot to review all pertinent technical information within the issue descriptions associated with [the milestone](https://github.com/ThreeMammals/Ocelot/milestone/8).
18+
Our team has implemented some **Breaking Changes** which we urge you to review carefully (details follow).
19+
20+
### ⚠️ Breaking Changes
21+
Listed by priority:
22+
- `ILoadBalancer` interface alteration: Method `Lease` is now `LeaseAsync`.
23+
Interface FQN: `Ocelot.LoadBalancer.LoadBalancers.ILoadBalancer`
24+
Method FQN: `Ocelot.LoadBalancer.LoadBalancers.ILoadBalancer.LeaseAsync`
25+
- `DefaultConsulServiceBuilder` constructor modification: The first parameter's type has been changed from `Func<ConsulRegistryConfiguration>` to `IHttpContextAccessor`.
26+
Class FQN: `Ocelot.Provider.Consul.DefaultConsulServiceBuilder`
27+
Constructor signature: `public DefaultConsulServiceBuilder(IHttpContextAccessor contextAccessor, IConsulClientFactory clientFactory, IOcelotLoggerFactory loggerFactory)`
28+
- Adjustments to `Lease` type: The `Lease` has been restructured from a class to a structure and elevated in the namespace hierarchy.
29+
Struct FQN: `Ocelot.LoadBalancer.Lease`
30+
31+
📓 Should your [custom solutions](https://ocelot.readthedocs.io/en/latest/search.html?q=custom) involve overriding default Ocelot classes and their behavior, redevelopment or at least recompilation of the solution, followed by deployment, will be necessary.

build.cake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#tool nuget:?package=ReportGenerator&version=5.2.4
44
#addin nuget:?package=Newtonsoft.Json&version=13.0.3
55
#addin nuget:?package=System.Text.Encodings.Web&version=8.0.0
6-
#addin nuget:?package=Cake.Coveralls&version=1.1.0
6+
#addin nuget:?package=Cake.Coveralls&version=4.0.0
77

88
#r "Spectre.Console"
99
using Spectre.Console

docs/features/graphql.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ We wanted to show how easy it is to integrate the `GraphQL for .NET <https://git
1212
Please see the sample project `OcelotGraphQL <https://github.com/ThreeMammals/Ocelot/tree/main/samples/OcelotGraphQL>`_.
1313
Using a combination of the `graphql-dotnet <https://github.com/graphql-dotnet/graphql-dotnet>`_ project and Ocelot :doc:`../features/delegatinghandlers` features, this is pretty easy to do.
1414
However we do not intend to integrate more closely with **GraphQL** at the moment.
15-
Check out the samples `README.md <https://github.com/ThreeMammals/Ocelot/blob/main/samples/OcelotGraphQL/README.md>`_ and that should give you enough instruction on how to do this!
15+
Check out the samples `README.md <https://github.com/ThreeMammals/Ocelot/blob/main/samples/GraphQL/README.md>`_ and that should give you enough instruction on how to do this!
1616

1717
Future
1818
------

docs/features/servicediscovery.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,10 +246,12 @@ However, the quickest and most streamlined approach is to inherit directly from
246246
247247
public class MyConsulServiceBuilder : DefaultConsulServiceBuilder
248248
{
249-
public MyConsulServiceBuilder(Func<ConsulRegistryConfiguration> configurationFactory, IConsulClientFactory clientFactory, IOcelotLoggerFactory loggerFactory)
250-
: base(configurationFactory, clientFactory, loggerFactory) { }
249+
public MyConsulServiceBuilder(IHttpContextAccessor contextAccessor, IConsulClientFactory clientFactory, IOcelotLoggerFactory loggerFactory)
250+
: base(contextAccessor, clientFactory, loggerFactory) { }
251+
251252
// I want to use the agent service IP address as the downstream hostname
252-
protected override string GetDownstreamHost(ServiceEntry entry, Node node) => entry.Service.Address;
253+
protected override string GetDownstreamHost(ServiceEntry entry, Node node)
254+
=> entry.Service.Address;
253255
}
254256
255257
**Second**, we must inject the new behavior into DI, as demonstrated in the Ocelot versus Consul setup:
@@ -543,7 +545,7 @@ But you can leave this ``Type`` option for compatibility between both designs.
543545
.. _KV Store: https://developer.hashicorp.com/consul/docs/dynamic-app-config/kv
544546
.. _3 seconds TTL: https://github.com/search?q=repo%3AThreeMammals%2FOcelot+TimeSpan.FromSeconds%283%29&type=code
545547
.. _catalog nodes: https://developer.hashicorp.com/consul/api-docs/catalog#list-nodes
546-
.. _the acceptance test: https://github.com/search?q=repo%3AThreeMammals%2FOcelot+Should_return_service_address_by_overridden_service_builder_when_there_is_a_node&type=code
548+
.. _the acceptance test: https://github.com/search?q=repo%3AThreeMammals%2FOcelot+ShouldReturnServiceAddressByOverriddenServiceBuilderWhenThereIsANode&type=code
547549
.. _346: https://github.com/ThreeMammals/Ocelot/issues/346
548550
.. _909: https://github.com/ThreeMammals/Ocelot/pull/909
549551
.. _954: https://github.com/ThreeMammals/Ocelot/issues/954

docs/index.rst

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
.. _@thiagoloureiro: https://github.com/thiagoloureiro
1313
.. _@bbenameur: https://github.com/bbenameur
1414

15-
.. _23.3: https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.0
16-
.. _23.3.0: https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.0
1715
.. _23.2.0: https://github.com/ThreeMammals/Ocelot/releases/tag/23.2.0
16+
.. _23.3.0: https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.0
17+
.. _23.3.3: https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.3
18+
.. _23.3.4: https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.4
19+
.. _23.3: https://github.com/ThreeMammals/Ocelot/releases/tag/23.3.4
1820

1921
.. _954: https://github.com/ThreeMammals/Ocelot/issues/954
2022
.. _957: https://github.com/ThreeMammals/Ocelot/issues/957
@@ -53,14 +55,34 @@ The main features are :doc:`../features/configuration` and :doc:`../features/rou
5355

5456
We **do** follow development process which is described in :doc:`../building/releaseprocess`.
5557

58+
Patches
59+
-------
60+
61+
- `23.3.3`_, on Jun 11, 2024. Technical release with DevOps patch.
62+
- `23.3.4`_, on Oct 3, 2024. Hot fixing version `23.3.0`_, codenamed `Blue Olympic Balumbes <https://www.youtube.com/live/j-Ou-ggS718?si=fPPwmOwjYEZq70H9&t=9518>`_ release.
63+
64+
:htm:`<details><summary>Codename decoding links</summary>`
65+
66+
- **for men** :htm:`&rarr;` naked `Blue Olympic Fiend <https://www.youtube.com/live/j-Ou-ggS718?si=fPPwmOwjYEZq70H9&t=9518>`_
67+
- **for women** :htm:`&rarr;` not a well-dressed woman sings at the opening ceremony, so "Not `Celine Dion <https://www.celinedion.com/>`_"
68+
- **for black men** :htm:`&rarr;` don't care about White movements, so enjoy `Black Men's Basketball Final <https://www.youtube.com/watch?v=Xci7dzk-bFk>`_ in `Paris 2024 <https://www.youtube.com/hashtag/paris2024>`_:
69+
be proud of Stephen Curry, "just give me a ball" boy, as an absolute rockstar, made `shot 1 <https://www.youtube.com/watch?v=Xci7dzk-bFk&t=832s>`_, `shot 2 <https://www.youtube.com/watch?v=Xci7dzk-bFk&t=1052s>`_, `shot 3 <https://www.youtube.com/watch?v=Xci7dzk-bFk&t=1087s>`_ and final `shot 4 <https://www.youtube.com/watch?v=Xci7dzk-bFk&t=1216s>`_.
70+
71+
:htm:`</details>`
72+
5673
Release Notes
5774
-------------
5875

5976
| Release Tag: `23.3.0`_
60-
| Release Codename: **Twilight Texas**
61-
:htm:`&rarr;` `for men <https://www.timeanddate.com/eclipse/solar/2024-april-8>`_
62-
:htm:`&rarr;` `for women <https://www.goodreads.com/series/50439-twilight-texas>`_
63-
:htm:`&rarr;` `for black men <https://rollingout.com/2024/06/03/eclipse-darkness-busta-rhymes-twista/>`_
77+
| Release Codename: `Twilight Texas <https://www.timeanddate.com/eclipse/solar/2024-april-8>`_
78+
79+
:htm:`<details><summary>Codename decoding links</summary>`
80+
81+
- `for men <https://www.timeanddate.com/eclipse/map/2024-april-8>`_
82+
- `for women <https://www.goodreads.com/series/50439-twilight-texas>`_
83+
- `for black men <https://rollingout.com/2024/06/03/eclipse-darkness-busta-rhymes-twista/>`_
84+
85+
:htm:`</details>`
6486

6587
What's new?
6688
^^^^^^^^^^^
@@ -133,8 +155,8 @@ Ocelot extra packages
133155
If both `Circuit Breaker`_ and `Timeout`_ have :ref:`qos-configuration` with their respective properties in the ``QoSOptions`` of the route JSON, then the :ref:`qos-circuit-breaker-strategy` will take precedence in the constructed resilience pipeline.
134156
For more details, refer to PR `2086`_.
135157

136-
Stabilization aka bug fixing
137-
""""""""""""""""""""""""""""
158+
Stabilization (bug fixing)
159+
^^^^^^^^^^^^^^^^^^^^^^^^^^
138160

139161
- Fixed `2034`_ in PR `2045`_ by `@raman-m`_
140162
- Fixed `2039`_ in PR `2050`_ by `@PaulARoy`_
@@ -146,8 +168,8 @@ Stabilization aka bug fixing
146168

147169
See `all bugs <https://github.com/ThreeMammals/Ocelot/issues?q=is%3Aissue+milestone%3ASpring%2724+is%3Aclosed+label%3Abug>`_ of the `Spring'24 <https://github.com/ThreeMammals/Ocelot/milestone/6>`_ milestone
148170

149-
Documentation for version `23.3`_
150-
"""""""""""""""""""""""""""""""""
171+
Documentation Summary
172+
^^^^^^^^^^^^^^^^^^^^^
151173

152174
- :doc:`../features/caching`: New :ref:`cch-enablecontenthashing-option` and :ref:`cch-global-configuration` sections
153175
- :doc:`../features/configuration`: New :ref:`config-version-policy` and :ref:`config-route-metadata` sections

samples/OpenTracing/Ocelot.Samples.OpenTracing.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
</PropertyGroup>
88
<ItemGroup>
99
<PackageReference Include="Jaeger" Version="1.0.3" />
10-
1110
</ItemGroup>
1211
<ItemGroup>
1312
<ProjectReference Include="..\..\src\Ocelot.Tracing.OpenTracing\Ocelot.Tracing.OpenTracing.csproj" />
@@ -23,7 +22,7 @@
2322
</ItemGroup>
2423
<!-- Conditionally obtain references for the net 8.0 target -->
2524
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
26-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
25+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
2726
</ItemGroup>
2827
<ItemGroup>
2928
<Content Update="appsettings.Development.json">

src/Ocelot.Administration/Ocelot.Administration.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,28 +31,28 @@
3131
<ProjectReference Include="..\Ocelot\Ocelot.csproj" />
3232
</ItemGroup>
3333
<ItemGroup>
34-
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507">
34+
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
3535
<PrivateAssets>all</PrivateAssets>
3636
</PackageReference>
3737
<PackageReference Include="IdentityServer4.AccessTokenValidation" Version="3.0.1" />
3838
<PackageReference Include="IdentityServer4" Version="4.1.2" />
3939
</ItemGroup>
4040
<ItemGroup>
41-
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.0.0" />
41+
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
4242
</ItemGroup>
4343
<!-- Conditionally obtain references for the net 6.0 target -->
4444
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
45-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.25" />
45+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="6.0.33" />
4646
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" />
4747
</ItemGroup>
4848
<!-- Conditionally obtain references for the net 7.0 target -->
4949
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
50-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.14" />
50+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.20" />
5151
<PackageReference Include="System.Text.Encodings.Web" Version="7.0.0" />
5252
</ItemGroup>
5353
<!-- Conditionally obtain references for the net 8.0 target -->
5454
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
55-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.0" />
55+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.8" />
5656
<PackageReference Include="System.Text.Encodings.Web" Version="8.0.0" />
5757
</ItemGroup>
5858
</Project>

src/Ocelot.Cache.CacheManager/Ocelot.Cache.CacheManager.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,36 +31,36 @@
3131
<ProjectReference Include="..\Ocelot\Ocelot.csproj" />
3232
</ItemGroup>
3333
<ItemGroup>
34-
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.507">
34+
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
3535
<PrivateAssets>all</PrivateAssets>
3636
</PackageReference>
3737
<PackageReference Include="CacheManager.Core" Version="2.0.0-beta-1629" />
3838
<PackageReference Include="CacheManager.Microsoft.Extensions.Configuration" Version="2.0.0-beta-1629" />
3939
<PackageReference Include="CacheManager.Microsoft.Extensions.Logging" Version="2.0.0-beta-1629" />
4040
</ItemGroup>
4141
<ItemGroup>
42-
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="1.0.0" />
42+
<PackageReference Update="Microsoft.SourceLink.GitHub" Version="8.0.0" />
4343
</ItemGroup>
4444
<!-- Conditionally obtain references for the net 6.0 target -->
4545
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
4646
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
4747
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="6.0.0" />
4848
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
4949
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
50-
<PackageReference Include="Microsoft.NETCore.Platforms" Version="6.0.11" />
50+
<PackageReference Include="Microsoft.NETCore.Platforms" Version="6.0.13" />
5151
</ItemGroup>
5252
<!-- Conditionally obtain references for the net 7.0 target -->
5353
<ItemGroup Condition=" '$(TargetFramework)' == 'net7.0' ">
5454
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
55-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.0" />
55+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
5656
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
5757
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
5858
<PackageReference Include="Microsoft.NETCore.Platforms" Version="7.0.4" />
5959
</ItemGroup>
6060
<!-- Conditionally obtain references for the net 8.0 target -->
6161
<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
6262
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
63-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.0" />
63+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
6464
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
6565
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
6666
<PackageReference Include="Microsoft.NETCore.Platforms" Version="8.0.0-preview.7.23375.6" />

src/Ocelot.Provider.Consul/Consul.cs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,16 @@ public virtual async Task<List<Service>> GetAsync()
3333

3434
var entries = entriesTask.Result.Response ?? Array.Empty<ServiceEntry>();
3535
var nodes = nodesTask.Result.Response ?? Array.Empty<Node>();
36-
var services = new List<Service>();
37-
38-
if (entries.Length != 0)
39-
{
40-
_logger.LogDebug(() => $"{nameof(Consul)} Provider: Found total {entries.Length} service entries for '{_configuration.KeyOfServiceInConsul}' service.");
41-
_logger.LogDebug(() => $"{nameof(Consul)} Provider: Found total {nodes.Length} catalog nodes.");
42-
var collection = BuildServices(entries, nodes);
43-
services.AddRange(collection);
44-
}
45-
else
36+
if (entries.Length == 0)
4637
{
4738
_logger.LogWarning(() => $"{nameof(Consul)} Provider: No service entries found for '{_configuration.KeyOfServiceInConsul}' service!");
39+
return new();
4840
}
4941

50-
return services;
42+
_logger.LogDebug(() => $"{nameof(Consul)} Provider: Found total {entries.Length} service entries for '{_configuration.KeyOfServiceInConsul}' service.");
43+
_logger.LogDebug(() => $"{nameof(Consul)} Provider: Found total {nodes.Length} catalog nodes.");
44+
return BuildServices(entries, nodes)
45+
.ToList();
5146
}
5247

5348
protected virtual IEnumerable<Service> BuildServices(ServiceEntry[] entries, Node[] nodes)

src/Ocelot.Provider.Consul/ConsulClientFactory.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ namespace Ocelot.Provider.Consul;
44

55
public class ConsulClientFactory : IConsulClientFactory
66
{
7+
// TODO We need this overloaded method ->
8+
//public IConsulClient Get(ServiceProviderConfiguration config)
79
public IConsulClient Get(ConsulRegistryConfiguration config)
810
=> new ConsulClient(c => OverrideConfig(c, config));
911

10-
private static void OverrideConfig(ConsulClientConfiguration to, ConsulRegistryConfiguration from)
12+
// TODO ->
13+
//private static void OverrideConfig(ConsulClientConfiguration to, ServiceProviderConfiguration from)
14+
// Factory which consumes concrete types is a bad factory! A more abstract types are required
15+
private static void OverrideConfig(ConsulClientConfiguration to, ConsulRegistryConfiguration from) // TODO Why ConsulRegistryConfiguration? We use ServiceProviderConfiguration props only! :)
1116
{
1217
to.Address = new Uri($"{from.Scheme}://{from.Host}:{from.Port}");
1318

0 commit comments

Comments
 (0)