-
Notifications
You must be signed in to change notification settings - Fork 3.4k
pkg/fswatcher: Rewrite without underlying use of fsnotify #38537
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
Conversation
8ee23e6
to
ea63121
Compare
7f7d4a2
to
c6cdbde
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good overall. Given there are still a few unknowns w.r.t. symlinks in the logic, have you tested this in a life K8s cluster and checked if it correctly detected updates to a ConfigMap/Secret mount?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have you tested this in a life K8s cluster and checked if it correctly detected updates to a ConfigMap/Secret mount?
IIRC you need to project the ConfigMap/Secret for k8s to do the weird symlink dance, like we do for e.g. the Hubble server TLS cert.
I did some local testing to see what happens when a secret is projected to filesystem and is then subsequently updated. I deployed a basic pod which mounts a secret:
And the resulting structure looks like this with the original key
After I edit the key and a few seconds have passed
The directory structure looks as follows:
To the best of my knowledge you can't edit symlinks, so it looks like when a new directory I will try to add exactly this test case into the My gut tells me that new fswatcher should be able to handle this very well since we do |
c6cdbde
to
6ab81bf
Compare
Added a new test that mimics the kubernetes secret projection and a subsequent value update -- the fswatcher works for it without any additional changes 🥳 |
CI error seems like it could be related.
That code is triggered via fswatcher notifications. Need to look at the test setup, maybe something about the new timing in tests is not working as expected. |
4aa1566
to
30b7475
Compare
30b7475
to
d23c96f
Compare
Remove reliance on fsnotify by replacing with a polling mechanism to check for modifications to tracked files. There is a default interval that is configurable depending on the usage, and it is also significantly shortened when running tests. Signed-off-by: Glib Smaga <code@gsmaga.com>
d23c96f
to
f4c1205
Compare
/test |
Should we backport this? |
I think it's worth backporting, yeah. It should help CI health among other things. Backport may not be clean depending on the status of the slog migration PR which caused a rebase conflict halfway through this PR |
Remove reliance on fsnotify by replacing with a polling mechanism to check for modifications to tracked files.
There is a default interval that is configurable depending on the usage, and it is also significantly shortened when running tests.
Superseeds #37909
Fixes #25666
The original test cases were kept pretty much as-is, except they are now deterministic (at least so far on the mac)