Skip to content

Eureka registration ports always overridden even when config specifies them #1665

@andysworkshop

Description

@andysworkshop

Describe the bug

Our services run in Kubernetes. Applications run in containers on an unprivileged port 10443. The k8s service object in front of the application listens on 443 and load balances traffic to the container pods. This is analogous to the old-style common pattern of running application instances on VMs behind a webserver proxy like nginx.

We provide Eureka registration from our configuration json that leaves port blank and specifies securePort as 443 so that other services can reach it because the container port is private.

This was fine up to 4.0.0. Now there is a new Steeltoe DynamicPortAssignmentHostedService that apparently cannot be opted-out and always overrides our configuration setting of 443 with a detected setting of 10443. This breaks our applications.

Thankfully DynamicPortAssignmentHostedService is a service so I can hack it out like this, but it's ugly:

services.AddEurekaDiscoveryClient();

ServiceDescriptor? sd = services.First(s => s.ImplementationType != null && s.ImplementationType.ToString().Equals("Steeltoe.Discovery.Eureka.DynamicPortAssignmentHostedService"));
if (sd != null)
{
  services.Remove(sd);
}

Expected behavior

Please provide a config setting that prevents DynamicPortAssignmentHostedService from ever registering itself as a hosted service. If such a setting already exists then I apologise and would appreciate a pointer to the documentation.

Environment (please complete the following information):

  • Steeltoe Version [e.g. 2.3.0]

4.0.0, 4.0.1

Metadata

Metadata

Assignees

Labels

Type/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions