Fix Eureka Dynamic Port Assignment overriding user-configured ports#1666
Open
Fix Eureka Dynamic Port Assignment overriding user-configured ports#1666
Conversation
- Detect explicitly configured eureka:instance:port or eureka:instance:securePort to avoid overwriting - Add public UseAspNetCoreUrls property (default: true, to match Consul) to allow disabling dynamic port detection. Made-with: Cursor
Contributor
Summary - All Code Coverage (ubuntu-latest)
|
bart-vmware
reviewed
Mar 31, 2026
src/Discovery/src/Eureka/Configuration/EurekaInstanceOptions.cs
Outdated
Show resolved
Hide resolved
src/Discovery/src/Eureka/Configuration/EurekaInstanceOptions.cs
Outdated
Show resolved
Hide resolved
- Replace per-port flags with single IsPortConfigured, set in PostConfigure after all user Configure callbacks have run - Skip listen address detection when ports are already configured - Revert changes to EurekaServiceCollectionExtensions - Add test for ports configured via code-based options configurer Made-with: Cursor
bart-vmware
reviewed
Apr 1, 2026
src/Discovery/src/Eureka/Configuration/EurekaInstanceOptions.cs
Outdated
Show resolved
Hide resolved
- Add assertions to DynamicPortAssignmentTest to verify opposite port is not enabled - Document UseAspNetCoreUrls ignore conditions in Eureka and Consul options - Remove IsPortConfigured and introduce ShouldSetPortsFromListenAddresses - Update PostConfigureEurekaInstanceOptions to use ShouldSetPortsFromListenAddresses Made-with: Cursor
bart-vmware
requested changes
Apr 1, 2026
src/Discovery/src/Consul/Configuration/ConsulDiscoveryOptions.cs
Outdated
Show resolved
Hide resolved
src/Discovery/src/Eureka/Configuration/EurekaInstanceOptions.cs
Outdated
Show resolved
Hide resolved
src/Discovery/src/Eureka/Configuration/EurekaInstanceOptions.cs
Outdated
Show resolved
Hide resolved
src/Discovery/src/Eureka/Configuration/EurekaInstanceOptions.cs
Outdated
Show resolved
Hide resolved
- move remarks into summaries => schema - break up too-complex ShouldSetPortsFromListenAddresses, move check to callers - re-introduce IsPortConfigured and add corresponding test
bart-vmware
reviewed
Apr 2, 2026
src/Discovery/src/Eureka/Configuration/EurekaInstanceOptions.cs
Outdated
Show resolved
Hide resolved
- use calculated property to check for configured ports - reduce cognitive complexity on SetPortsFromListenAddresses
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
eureka:instance:portoreureka:instance:securePortto avoid overwriting.UseAspNetCoreUrlsproperty (default:true, to match Consul) to allow disabling dynamic port detection.Fixes #1665
Quality checklist
If your change affects other repositories, such as Documentation, Samples and/or MainSite, add linked PRs here.