-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ConfigReloadUtil does not use sources listed in env specific yml files #1843
Comments
Could someone please take a look at this issue? Please let me know if there is anything I can help to investigate and fix it. |
I'll take a look over the weekend and report back. |
Let's see if I understood your issue (I did not look at your sample just yet).
Understandable. This is what Spring's active profiles is for and in our case: For example:
If you have a configmap called : It looks like this is what you really want to use here. The other side of the question is what we are "tracking", or what is
This way we will listen for changes in all those namespaces and on all configmaps. If you want specific configmaps to be listened for, there is a way to do that also:
and we will listen only for changes in configmaps that have the label :
I hope this makes sense. If after these changes things still don't work as expected, change the sample with some instructions how to re-produce and I'll take a look. Thank you. |
@ryanjbaxter can you please add the feedback label? |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Hi @wind57 Thanks for taking a look. Setting |
hey, really glad it worked for you. Let's take one step at a time if you do not mind. If the initial query is solved, I would prefer if we close this ticket and, if you still have any questions, open a new one. TBH, I don't really understand your last question... so may be you can provide a sample or more details. Thank you |
Thanks for the quick response. With earlier versions of the spring-cloud I was able to provide a configmap source name in each application-<profile>.yaml file like below. Wondering if this is still available with current version? This was the original issue I was reporting here. application.yaml
application-prod-client1.yaml
|
so you were specifying which configmap to read via separate yaml files. So in That makes sense too :) and I don't see why that would not work. Reload should work with these too. Is that not what you are seeing in your app?
Please correct me if I'm wrong here. Thank you |
Yes. Thats is not working for me. I tried having different source names in different application.yaml and application-dev.yaml files. Spring reads only from the source mentioned in
Let me quickly test this.
I don't understand what do you mean. |
application.yaml
application-prod-client1.yaml
With above config, the app loads values from
but does not load values from When I delete the |
I will create a sample of my own (will share with you, of course) and see what is going on here. Though, as you have seen, there are other ways we recommend doing. |
Thank you so much. |
here is a PR against a project that I maintain that proves that things are correctly read: wind57/spring-k8s-samples#2 Basically clone this repo, switch to that branch and follow the README. The above is using bootstrap to load stuff. What you are using in your code, is the new way to load things, called "config data", and to my surprise, we might have a bug there : #1874 Either way, imho, this ticket can be closed. You have two solutions to work around your initial problem. Thank you. |
Hi @wind57 thanks much for taking time to test it out. I took a look at your changes. I think your app loads |
Did you actually try the changes you are implying above? I pushed new changes in the same branch that proves otherwise, please take a look. |
@ryanjbaxter can you add the feedback label back please? |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Describe the bug
I am trying to use config map to override some configs in my spring app. When I keep all the configurations in
application.yml
file the context gets reloaded and the values in the kubernetes config-map replaces the default config values inapplication.yml
.bootstrap.yaml
application.yml
The logs below confirm that the above configuration is correct.
However, I would like to have different config-maps for different environments like
test
andprod
. But it looks likeorg.springframework.cloud.kubernetes.commons.config.reload.ConfigReloadUtil
does not use thespring.cloud.kubernetes.config.name
orspring.cloud.kubernetes.config.sources[].name
from environment specific yml files. When I remove theconfig.name
fromapplication.yml
and add the same (and/orconfig.sources[].name
) to environment specific yml file like below, theConfigReloadUtil
does not detect the changes in the config map.application-dev.yml
Below log shows the context is not getting reloaded but I have updated the config map.
Could someone please help me fix this issue?
Environment:
Sample
Link to sample app: https://gitlab.com/baji/spring-configmap-example
The text was updated successfully, but these errors were encountered: