Skip to content

ConfigMap reloading not starting due to "PropertySources does not match the ones loaded from Kubernetes" #2148

@ilebor

Description

@ilebor

Describe the bug
spring-cloud-kubernetes-commons 3.3.1

After changing spring-cloud-dependencies from 2023.0.4 to 2025.0.1 I began to experience this problem: when I change a value in a config map I get "number of PropertySources does not match the ones loaded from Kubernetes" error (see logs below and sample)

ConfigReloadUtil : sources from locateMapPropertySources : [Fabric8ConfigMapPropertySource@1924459698 {name='configmap.xxx.app-xxx', properties={whoami=user-info!, logging.level.org.springframework.cloud.kubernetes.commons.config.reload=DEBUG}}]
ConfigReloadUtil : k8s property sources size: 1
ConfigReloadUtil : Fabric8ConfigMapPropertySource@1924459698 {name='configmap.xxx.app-xxx', properties={whoami=user-info!, logging.level.org.springframework.cloud.kubernetes.commons.config.reload=DEBUG}}
ConfigReloadUtil : app property sources size size: 2
ConfigReloadUtil : Fabric8ConfigMapPropertySource@1172991012 {name='configmap.xxx.app-xxx', properties={whoami=user-info!, logging.level.org.springframework.cloud.kubernetes.commons.config.reload=DEBUG}}
ConfigReloadUtil : MountSecretPropertySource {name='db-password'}
ConfigReloadUtil : The current number of PropertySources does not match the ones loaded from Kubernetes - No reload will take place

Something very similar was described and fixed here but I'm trying to achieve something a little different since I want to leave to kubernetes the secret definition and I don't want "enable-api: true".
Shouldn't "monitoring-secrets: false" leave secrets out of the reload mechanism? Should I change something in the configuration?
Please note that I'm using the spring-cloud-kubernetes-commons 3.3.1 (that should have fixed issue #2008).

Sample
I have this configuration

spring:
  config:
    import: "optional:kubernetes:xxx"
  cloud:
    kubernetes:
      reload:
        enabled: true
        mode: event
        strategy: refresh
        monitoring-secrets: false
      secrets:
        paths: /etc/secrets

and I have a secret mount configured in kubernetes.
Configuring the config map name in spring.cloud.kubernetes.config.name doesn't affect the problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions