Hi!
I am in the process of migrating to kubernetes-config for our Spring Boot applications. We are relying on profile-specific configurations which might override some default values based on activated profiles.
My understanding from the documentation was that I could defined a ConfigMap like this
apiVersion: v1
kind: ConfigMap
metadata:
name: test-application
data:
test-application.properties: |
key=value1
test-application-profileA.properties: |
key=value2
If the application with the name test-application is started with only default-profiles active the value for property key should be value1 and if started with the profile profileA active the key should have value2.
The current implementation throws a duplicate key error when trying to combine the two "properties-files" into a single map ignoring the fact that one should, at lease in my opinion, take precedence over the other. The exception is thrown here
|
return input.entrySet().stream().map(e -> extractProperties(e.getKey(), e.getValue(), fileNames, environment)) |
For reproduction I created a small sample-project including a unit-test the demonstrates the behavior https://github.com/stoetti/spring-cloud-kubernetes-config-profile
Hi!
I am in the process of migrating to kubernetes-config for our Spring Boot applications. We are relying on profile-specific configurations which might override some default values based on activated profiles.
My understanding from the documentation was that I could defined a ConfigMap like this
If the application with the name
test-applicationis started with only default-profiles active the value for propertykeyshould bevalue1and if started with the profileprofileAactive thekeyshould havevalue2.The current implementation throws a duplicate key error when trying to combine the two "properties-files" into a single map ignoring the fact that one should, at lease in my opinion, take precedence over the other. The exception is thrown here
spring-cloud-kubernetes/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/SourceDataEntriesProcessor.java
Line 89 in a4e2115
For reproduction I created a small sample-project including a unit-test the demonstrates the behavior https://github.com/stoetti/spring-cloud-kubernetes-config-profile