I'm trying to adapt my Spring boot application to k8s environment and want to use ConfigMaps as property sources. I faced that if I'm using
kubernetes:
config:
sources:
- name: application-config
for application with name appName
then any other ConfigMaps with Spring cloud kubernetes convention names like appName-kubernetes
or appName-dev
is silently ignored. Looks like listed sources in config.sources
overrides and disables usage of any other PropertySources from ConfigMaps.
I'm forced to use specific name for ConfigMap ('application-config' in sample above).
So question is - how (if) can I specify both config.sources
and simultaneously have ConfigMaps with names appName-*
picked up correctly?
After some debugging through ConfigMapPropertySource achieved this by
kubernetes:
config:
sources:
- name: application-config
- name: @project.artifactId@
name: @project.artifactId@
Now it loads application-config
, application-config-kubernetes
, appName-kubernetes
and other profile-specific ConfigMaps.