I'm using Spring Boot 3 and I have an application-configmap ConfigMap in Kubernetes workspace which has application.yaml file and I would like to bootstrap the application using the ConfigMap.
In bootstrap-preproduction.yml, I have:
spring:
cloud:
config:
enabled: false
kubernetes:
config:
namespace: workspace
sources:
- name: application-configmap
bootstrap:
enabled: true
During the pod startup, I have logs where the config map is located but yml file is skipped and application does not start as its finding the DB configs.
2024-01-12T10:30:16.545Z INFO 1 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-workplace/kubernetes/workplace/workplace-default-sa/my-app/pp'}, BootstrapPropertySource {name='bootstrapProperties-workplace/kubernetes/workplace/workplace-default-sa/my-app/kubernetes'}, BootstrapPropertySource {name='bootstrapProperties-workplace/kubernetes/workplace/workplace-default-sa/my-app'}, BootstrapPropertySource {name='bootstrapProperties-workplace/kubernetes/workplace/workplace-default-sa/application/pp'}, BootstrapPropertySource {name='bootstrapProperties-workplace/kubernetes/workplace/workplace-default-sa/application/kubernetes'}, BootstrapPropertySource {name='bootstrapProperties-*workplace/kubernetes/workplace/workplace-default-sa/application'}]
2024-01-12T10:30:16.922Z WARN 1 --- [ main] o.s.c.k.c.c.SourceDataEntriesProcessor : entry : application-pp.yml will be skipped
2024-01-12T10:30:16.922Z WARN 1 --- [ main] o.s.c.k.c.c.SourceDataEntriesProcessor : entry : application.yml will be skipped*
2024-01-12T10:30:16.926Z INFO 1 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-configmap.application-configmap.workplace'}]
2024-01-12T10:30:17.019Z INFO 1 --- [ main] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-secret.my-app.workplace'}]
2024-01-12T10:30:17.040Z INFO 1 --- [ main] b.a.workplaceSpringAdminServerApplication : The following 2 profiles are active: "kubernetes", "pp"
I believe, there is no issue in the application.yml file as it was working correctly with the config server. I migrated this to the config map, and it has not been loaded during the bootstrap of the application.