-
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
Volume mount prevents refreshing configuration properties #462
Comments
can you list your |
See content of 'bootstrap.yaml' above (sorry, indentation is wrong in the ticket) |
|
I am terribly sorry, indeed my bootstrap.yml was incomplete (due to experiments to triage the issue)
and my application.yaml (since I read in another issue that the refresh endpoint must be enabled)
As soon as the commented "paths" gets enabled the refresh no longer works, no matter if I use the kubernetes watch API or polling mode. Disabling the volume mount immediately resolves the issue. Manually refreshing (through the http endpoint) updates the values from the volume. |
Current implementation triggers a reload event once a configmap is updated. However, this event occurs soon before the new configmap content is projected into the mounted volume. The implementation currently compares config sources in the current state of the environment against the content located from the mounted volume path (while not updated yet). Refer to the update mounted configmap delay at https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#mounted-configmaps-are-updated-automatically. It may need to add a feature to watch files system for any update to trigger a reload from mounted volume paths. @geoand @ryanjbaxter thought? |
Doesn't the current implementation only apply to reading the configmap for the API and not the file system? |
Even if there is some problem with the config map volume update, it should not prevent updating the API based configuration imho. |
even though it's technically separate from this issue, once spring-cloud/spring-cloud-commons#605 and/or spring-cloud/spring-cloud-config#1439 is available, that would allow application config to be updated in an eventually consistent manner while relying on standard Kubernetes ConfigMap volume mounting (no api access from the app) |
yes @geoand, the current implementation uses API to apply reading configmaps directly but not their projected contents from mounted volumes. @markfisher, that would be an awesome enhancement, it would help with this case to watch the projected files and eventually refresh configs. |
The issue reported here, might very likely be a cause of this bug, which seems that will be fixed in both The real enhancement here would be to actually watch the file mounted in the container, without We could have another way to watch, called So you would configure:
We would watch this file and reload the app when it changes. You can even mount that path as a ConfigMap/Secret and k8s will ultimately update the contents when those change. This is just an idea, but as usual, before I even start thinking about this, I need to debate it properly to understand the scope with @ryanjbaxter. |
I am not in favor of adding another mechanism for watching mounted file changes at the moment since the configuration watcher if already meant to solve this. |
How would config watcher solve watching for a mounted file though? It still uses the API and expects to catch a ConfigMap change via informers. What am I missing? |
It doesn't watch the mounted files it watches the configmaps and secrets backing those files. When one of those are changed it tells the app using those config maps and secrets after the k8s maximum period of time to refresh those files so it can refresh its configuration. Yes the config watcher uses the k8s api to do this, but it alleviates every app having to do this and instead we just have 1 app using the api. |
That's what I thought... Thank you, it makes sense. On a different note, do you think this issue can be closed after we close the one I linked? |
I think we can close this issue because the config watcher solves the OP request |
I have a simple spring boot application and provide two config maps using a volume mount (paths) and the config API access (config sources).
As soon as a
paths
is configured, the application will not refresh after a change of the config map. The config map values are updated in the volume, but the refresh does not take place. Using the refresh endpoint solves this, but needs to be done manually.I fact, when a
paths
configuration is present the refreshing of config-sources is prevented.Version: 1.0.2.RELEASE
bootstrap.yaml:
Used deployment:
The text was updated successfully, but these errors were encountered: