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

Add support for polling watcher #126

Merged
merged 2 commits into from
Aug 19, 2021
Merged

Add support for polling watcher #126

merged 2 commits into from
Aug 19, 2021

Conversation

bojand
Copy link
Member

@bojand bojand commented Aug 19, 2021

github.com/fsnotify/fsnotify uses ionotify as the mechanism to detect for changes in the watched file system.

Within sandboxed or restricted environment contexts (such as gVisor), certain system calls may be prohibited under some specific scenarios.

This means that currently the fluent-bit-watcher component cannot be used in sandboxed environment properly. The changes to the underlying Fluent Bit config file (mounted from the fluentbit-operator secret) will not be detected properly, and fluent bit process will not be restarted when changes occur.

One approach to work around such issue is to watch files utilizing stat polling. Ideally fsnotify will support polling. There is an existing long standing issue open, that has some discussion and links to possible implementations. One such implementation has recently been added to hugo.

This PR brings in the identical implementation added in hugo. A new filenotify package is introduced from hugo/watch/filenotify.

We could use hugo/watch/filenotify package directly, however this brings in the whole of github.com/gohugoio/hugo as a go package dependency which is less than ideal for such a small addition.

Ideally we can remove this in future if and when poll support lands in fsnotify.

Tested that polling solution works under gVisor, and that non-polling solution works in containerd as expected.

Additional changes:

  • Added command line flag arguments to fluent-bit-watcher
  • Changed fluent-bit-watcher Dockerfile to build from all of source code
  • Added args support to FluentBit CRD

Add command line arguments to fluent-bit-watcher.
Add polling watcher support to fluent-bit-watcher.

Signed-off-by: Bojan <dbojan@gmail.com>
Signed-off-by: Bojan <dbojan@gmail.com>
@bojand bojand changed the title Add support polling watcher Add support for polling watcher Aug 19, 2021
Copy link
Member

@benjaminhuo benjaminhuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's looks wonderful, thanks @bojand!

Copy link
Member

@keladhruv keladhruv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants