From c35cad96dd3f35c56357977d85bff14cc91fcaa5 Mon Sep 17 00:00:00 2001 From: haoqixu Date: Thu, 14 Sep 2023 00:31:06 +0800 Subject: [PATCH] fix incorrect use of fsnotify in configtls --- config/configtls/clientcasfilereloader.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/configtls/clientcasfilereloader.go b/config/configtls/clientcasfilereloader.go index 01cebc7af78..1ee9c72ef9f 100644 --- a/config/configtls/clientcasfilereloader.go +++ b/config/configtls/clientcasfilereloader.go @@ -112,7 +112,7 @@ func (r *clientCAsFileReloader) handleWatcherEvents() { // NOTE: k8s configmaps uses symlinks, we need this workaround. // original configmap file is removed. // SEE: https://martensson.io/go-fsnotify-and-kubernetes-configmaps/ - if event.Op == fsnotify.Remove || event.Op == fsnotify.Chmod { + if event.Has(fsnotify.Remove) || event.Has(fsnotify.Chmod) { // remove the watcher since the file is removed if err := r.watcher.Remove(event.Name); err != nil { r.lastReloadError = err @@ -123,7 +123,7 @@ func (r *clientCAsFileReloader) handleWatcherEvents() { } r.reload() } - if event.Op == fsnotify.Write { + if event.Has(fsnotify.Write) { r.reload() } }