Skip to content

3.0.4 -> 3.1.3: KubernetesInformerDiscoveryClient used to log services with missing port-names, DiscoveryClientUtils logs without servicename #1679

@DRoppelt

Description

@DRoppelt

Describe the bug

we are migrating from Spring Boot 3.1 to 3.3 and as a result of that, spring-cloud-kubernetes is updated from 3.0.4 to 3.1.3

v3.0.4...v3.1.3

We found that somewhere during this upgrade, the class KubernetesInformerDiscoveryClient used to log missing ports during discovery including service-name. This logging has now moved to DiscoveryClientUtils, but is lacking the service-name in the logged message

Not sure if this rather a feature request than a bug. It is rather hard to troubleshoot discovery-issues when no context is given which service is giving issues

Sample
Before: https://github.com/spring-cloud/spring-cloud-kubernetes/blob/v3.0.4/spring-cloud-kubernetes-client-discovery/src/main/java/org/springframework/cloud/kubernetes/client/discovery/KubernetesInformerDiscoveryClient.java#L223-L227

2024-07-25T10:53:09.613+02:00  WARN [] --- [synchronous endpoint registry updater] o.s.c.k.c.d.KubernetesInformerDiscoveryClient: Could not find a port named 'http-web', 'https', or 'http' for service 'solr'.
2024-07-25T10:53:09.613+02:00  WARN [] --- [synchronous endpoint registry updater] o.s.c.k.c.d.KubernetesInformerDiscoveryClient: Make sure that either the primary-port-name label has been added to the service, or that spring.cloud.kubernetes.discovery.primary-port-name
2024-07-25T10:53:09.614+02:00  WARN [] --- [synchronous endpoint registry updater] o.s.c.k.c.d.KubernetesInformerDiscoveryClient: Alternatively name the primary port 'https' or 'http'
2024-07-25T10:53:09.614+02:00  WARN [] --- [synchronous endpoint registry updater] o.s.c.k.c.d.KubernetesInformerDiscoveryClient: An incorrect configuration may result in non-deterministic behaviour.

After: https://github.com/spring-cloud/spring-cloud-kubernetes/blob/v3.1.3/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/discovery/DiscoveryClientUtils.java#L128

2024-07-25T09:57:12.919470823+02:00  WARN [] --- [synchronous endpoint registry updater] o.s.c.k.c.d.DiscoveryClientUtils: Make sure that either the primary-port-name label has been added to the service,
or spring.cloud.kubernetes.discovery.primary-port-name has been configured.
Alternatively name the primary port 'https' or 'http'
An incorrect configuration may result in non-deterministic behaviour.

where this is the crucial part that is now missing

for service 'solr'.

Please let me know if you need more information or if this suffices as a bug report.

I could work on a PR to give more context info?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions