Skip to content

spring-cloud-kubernetes-config options and autoconfigure not working with reload. #635

@krisiye

Description

@krisiye

Describe the bug

Attempting to configure spring-cloud-kubernetes-config to just add support for kubernetes configMaps. (and disable secrets and discovery client) However would like to support config reload with event. It appears that when bringing up spring boot with the configuration below along with AutoConfigure, we run into a bean resolution issue as posted below.

Sample Configuration

spring:
  cloud:
    kubernetes:
      config:
        enabled: true
      secrets:
        enabled: false
      discovery:
        enabled: false
      reload:
        enabled: true
        monitoring-config-maps: true

Exception:

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.cloud.kubernetes.config.reload.ConfigReloadAutoConfiguration$ConfigReloadAutoConfigurationBeans': Unsatisfied dependency expressed through field 'secretsPropertySourceLocator'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.cloud.kubernetes.config.SecretsPropertySourceLocator' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

If the above seems a valid set of configs, Ideally, i would expect the configuration flags that either define or not define a given bean to be honored for autoconfigs as well.

Tested with:

Spring Boot: 2.3.3.RELEASE
spring-cloud-kubernetes-config: 1.1.3.RELEASE

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions