Allow fsnotify to reload config files on k8s (or symlinks)
This commit is contained in:
parent
70fdfeb926
commit
f6c6c2b2c0
1 changed files with 13 additions and 0 deletions
|
@ -110,6 +110,19 @@ func (p *Provider) addWatcher(pool *safe.Pool, directory string, configurationCh
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
case evt := <-watcher.Events:
|
case evt := <-watcher.Events:
|
||||||
|
if evt.Op == fsnotify.Remove {
|
||||||
|
err = watcher.Remove(evt.Name)
|
||||||
|
if err != nil {
|
||||||
|
log.WithoutContext().WithField(log.ProviderName, providerName).
|
||||||
|
Errorf("Could not remove watcher for %s: %s", directory, err)
|
||||||
|
}
|
||||||
|
err = watcher.Add(directory)
|
||||||
|
if err != nil {
|
||||||
|
log.WithoutContext().WithField(log.ProviderName, providerName).
|
||||||
|
Errorf("Could not re-add watcher for %s: %s", directory, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if p.Directory == "" {
|
if p.Directory == "" {
|
||||||
_, evtFileName := filepath.Split(evt.Name)
|
_, evtFileName := filepath.Split(evt.Name)
|
||||||
_, confFileName := filepath.Split(p.Filename)
|
_, confFileName := filepath.Split(p.Filename)
|
||||||
|
|
Loading…
Reference in a new issue