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

Promtail: fix filetarget to not be stuck if no files was detected on startup #4461

Merged
merged 2 commits into from
Oct 21, 2021

Conversation

rsteneteg
Copy link
Contributor

@rsteneteg rsteneteg commented Oct 12, 2021

Signed-off-by: Roger Steneteg rsteneteg@ea.com

What this PR does / why we need it:
Fixes a bug causing Promtail FileTargets to be stuck if no files was matched during startup

The root issue is that for statefulsets where the pod name is the same, all labels match, so the filetargetmanager already have a target with the same labels, so it will not do anything, and the filetarget has stopped because the logfile no longer exists because the path to the logfile has changed since it contains the UID of the pod which is not the same. So to fix this the manager now updates the filetarget with the new path, allowing the filetarget to pick up the new log file.

The issue with the previous fix where the manager removed the target if it was not Ready() (meaning the target has no files to tail) had the side effect that it stopped the filetarget, and removed the target from the manager preventing that filetarget from being recreated.

Which issue(s) this PR fixes:
Fixes #4460

Special notes for your reviewer:

Checklist

  • Documentation added
  • Tests updated

Signed-off-by: Roger Steneteg <rsteneteg@ea.com>
Copy link
Contributor

@cyriltovena cyriltovena 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FileTarget stuck if no log is found on startup
2 participants