config-reloader: trigger reload after initial directory sync - #2528
Merged
vrutkovs merged 6 commits intoAug 31, 2026
Merged
Conversation
shunki-fujita
requested review from
AndrewChubatiuk and
vrutkovs
as code owners
August 21, 2026 06:35
shunki-fujita
marked this pull request as draft
August 21, 2026 06:36
shunki-fujita
force-pushed
the
config-reloader-initial-sync-reload
branch
2 times, most recently
from
August 21, 2026 07:02
623729e to
e7629bb
Compare
shunki-fujita
marked this pull request as ready for review
August 21, 2026 07:06
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Fix all with cubic | Re-trigger cubic
vrutkovs
requested changes
Aug 21, 2026
vrutkovs
requested changes
Aug 26, 2026
vrutkovs
left a comment
Collaborator
There was a problem hiding this comment.
Needs CHANGELOG entry too
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 3 files (changes from recent commits).
Tip: Review your code locally with the cubic CLI to iterate faster.
Fix all with cubic | Re-trigger cubic
vrutkovs
force-pushed
the
config-reloader-initial-sync-reload
branch
from
August 31, 2026 06:54
66ee787 to
6aab738
Compare
vrutkovs
approved these changes
Aug 31, 2026
vrutkovs
left a comment
Collaborator
There was a problem hiding this comment.
Thank you for your contribution!
vrutkovs
enabled auto-merge (squash)
August 31, 2026 06:55
vrutkovs
force-pushed
the
config-reloader-initial-sync-reload
branch
from
August 31, 2026 07:34
6aab738 to
1c5b6d7
Compare
Instead of caching the directory hash inside updateCache before the copy happens, return the hash and store it only once the sync succeeded. A failed sync leaves the hash uncommitted, so the next fsnotify event retries it naturally. This removes the dedicated initial-sync retry loop. Suggested by @vrutkovs in review.
Reloading before any directory was mirrored just re-reads the old content. Trigger the startup reload only when at least one watched pair (including watch-only dirs) completed its initial sync.
vrutkovs
force-pushed
the
config-reloader-initial-sync-reload
branch
from
August 31, 2026 07:34
1c5b6d7 to
938f5da
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2527
Problem
Since v0.72.0, VMAlert reads its rule files from an emptyDir populated by the
config-initinit container and synced by theconfig-reloadersidecar. If the rules ConfigMap is updated between the init container's copy and the sidecar starting, the sidecar's initial sync writes the new content to the target dir but never notifies the application. The application keeps serving the snapshot it read at startup, and if the ConfigMap never changes again, no fsnotify event ever fires — the stale state is permanent.Fix
dirWatcher.start()sends one reload signal after the initial directory sync, provided at least one watched directory completed it. This also applies to watch-only directories (no--target-dir): the same startup race exists there — a change landing between the application's first read and the watch being established produces no event — just with a smaller window.Tests