-
Notifications
You must be signed in to change notification settings - Fork 126
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
Invalidate host context provider cache when FQDN feature flag is toggled #2461
Invalidate host context provider cache when FQDN feature flag is toggled #2461
Conversation
🌐 Coverage report
|
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, just one comment that would make the cleanup in the host provider a little better.
// Update context when any host information changes. | ||
for { | ||
t := time.NewTimer(c.CheckInterval) | ||
select { | ||
case <-comm.Done(): | ||
t.Stop() | ||
features.RemoveFQDNOnChangeCallback(fqdnFeatureFlagCallbackID) | ||
close(fqdnFFChangeCh) |
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.
Please move to a defer on line 61 it would be cleaner in the case that a future change results in it not being unregistered.
defer func() {
features.RemoveFQDNOnChangeCallback(fqdnFeatureFlagCallbackID)
close(fqdnFFChangeCh)
}()
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.
Good point, thanks. Done in c008e54.
c008e54
to
c48a716
Compare
…led (#2461) * Add callback mechanism to notify when FQDN feature flag is toggled * Use callback to bust host provider cache * Moving const inside method * Fixing typo * Formatting for better readability * Fixing comment * Fixing comment * Check error from features.Apply * Simplify test * Increasing sleep times * Better cleanup of resources (cherry picked from commit 0640efd)
…led (#2461) (#2469) * Add callback mechanism to notify when FQDN feature flag is toggled * Use callback to bust host provider cache * Moving const inside method * Fixing typo * Formatting for better readability * Fixing comment * Fixing comment * Check error from features.Apply * Simplify test * Increasing sleep times * Better cleanup of resources (cherry picked from commit 0640efd) Co-authored-by: Shaunak Kashyap <ycombinator@gmail.com>
What does this PR do?
This PR invalidates the
host
context provider's cache whenever the FQDN feature flag is toggled.Why is it important?
With this change, the host context provider will regenerate host information - which includes the hostname / FQDN - whenever the FQDN feature flag is toggled.
Checklist
I have made corresponding changes to the documentationI have made corresponding change to the default configuration filesI have added an entry in./changelog/fragments
using the changelog toolI have added an integration test or an E2E testAuthor's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs
Questions to ask yourself