Skip to content

ConfigMap reload doesn't work: "The current number of Confimap PropertySources does not match the ones loaded from the Kubernetes - No reload will take place" #524

@neev-dev

Description

@neev-dev

Describe the bug
Apply the changes to a config map doesn't result in the config getting updated

Sample
This is what I could figure out based on debugging:

  • Initially loaded config is in “BootstrapPropertySource”; name is “bootstrapProperties-configmap.{value-of-spring-application-name}.{namespace}”. Properties are present as they are in the config map and they get wired into the bean annotated with @configuration and @ConfigurationProperties (w/ prefix) as expected.
    << configmap change is applied >>
  • ConfigMap change is detected; EventBasedConfigurationChangeDetector’s onEvent gets invoked. Configmap param contains the new data.
  • locateMapPropertySources comes back with one change - a ConfigMapPropertySource instance with the name “configmap.{value-of-spring-application-name}.{namespace}”.
  • findPropertySources() loops through all the sources in list to check if anyone is an instance of ConfigMapPropertySource. Since “BootstrapPropertySource” is not an instance of ConfigMapPropertySource, doesn’t consider it as part of the managed sources return list. At the end findPropertySources() returns an empty list.
  • Changed() method in ConfigurationChangeDetector logs "The current number of Confimap PropertySources does not match the ones loaded from the Kubernetes - No reload will take place”.
  • The configuration change is not considered for refreshing the config bean.

Also, I can only load one config map (with the same name as the application). spring.cloud.kubernetes.config.sources seem to get ignored.

Tried with spring.cloud.k8s versions 1.1.1.RELEASE and 1.0.5 with Spring cloud versions Hoxton.SR1 and Greewich.SR4.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions