Skip to content

selectiveNamespaces not working #2272

Description

@ElectroLutz

Describe the bug
We're currently upgrading vom Spring Boot 3.5 to Spring Boot 4.1 and Spring Cloud 2025.1.2. We came across a weird behavior regarding the kubernetes auto-discovery.

We use Spring Cloud Kubenetes 5.0.2 with the following configuration:

spring:
  cloud:
    kubernetes:
      discovery:
        enabled: true
        namespaces:
          - some-namespace

after upgrading our discovery failed, because instead only querying the single given namespace it tried to do it cluster-wide. The service account, the pod has, doesn't allow this.

After debugging (for hours) we found out that creating a selectiveNamespaces (with s at the end) Bean with the desired namespace fixed the problem. Otherwise Spring would just collect some Strings (since it's defined as List) it could find as a Bean.

I think it might be related to this commits: df4fc11 10acbb9 5671518
They changed the name of the Bean quite a bit, but the final version is missing the s.

Or maybe we're doing something wrong. But I guess using some random defined String Beans for this is not the correct way anyway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions