Skip to content
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

File Watch not triggering with Kubernetes ConfigMap changes #323

Closed
jondavidnd1 opened this issue Sep 23, 2024 · 4 comments · Fixed by #326
Closed

File Watch not triggering with Kubernetes ConfigMap changes #323

jondavidnd1 opened this issue Sep 23, 2024 · 4 comments · Fixed by #326
Labels
bug Something isn't working

Comments

@jondavidnd1
Copy link
Contributor

Describe the bug
I've mounted a kubernetes ConfigMap containing a YAML file onto a directory. My application can successfully read the config from the file on startup using the file provider. However, when attempting the watch the file, updates to the ConfigMap (which are available when reading the file), are not triggering the file watch function.

Expected behavior
I would expect that changes to the ConfigMap would eventually trigger the watch function.

Please provide the following information):

  • OS: linux/kubernetes
  • Koanf Version - v2.1.1, providers/file version - v1.0.0

Additional context
viper had a similar problem that was addressed in this issue: spf13/viper#284. I believe the fsnotify event loop should be updated to compare the curPath with realPath, and if they are different, consider that an event that should trigger the watch function.

@jondavidnd1 jondavidnd1 added the bug Something isn't working label Sep 23, 2024
@knadh
Copy link
Owner

knadh commented Sep 23, 2024

Hi @jondavidnd1. Would you be able to try this out in a K8s environment and perhaps send a PR? I am not familiar with K8s and don't have an env handy either?

To test, you can just copy the file provider code locally, tweak it, and plug that into koanf as the provider interface.

@jondavidnd1
Copy link
Contributor Author

Yeah, give me a few days and I'll try and submit something.

@jondavidnd1
Copy link
Contributor Author

@knadh I have manually tested the above PR against my use case and the standard use case creates, writes, removes on a normal file. Please have a look when you have time.

@jondavidnd1
Copy link
Contributor Author

Restarted PR to avoid a bunch of unnecessary commits.

@knadh knadh closed this as completed in #326 Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants