diff --git a/cmd/vsphere-cloud-controller-manager/main.go b/cmd/vsphere-cloud-controller-manager/main.go index 38767db43..353baea5b 100644 --- a/cmd/vsphere-cloud-controller-manager/main.go +++ b/cmd/vsphere-cloud-controller-manager/main.go @@ -269,8 +269,9 @@ func initializeWatch(_ *appconfig.CompletedConfig, paths []string) (watch *fsnot case err := <-watch.Errors: klog.Warningf("watcher receives err: %v\n", err) case event := <-watch.Events: - if event.Op != fsnotify.Chmod { - klog.Fatalf("restarting pod because received event %v\n", event) + // only restart pod when monitor an update event on watched file + if event.Op&fsnotify.Write == fsnotify.Write { + klog.Errorf("restarting pod because received event %v\n", event) stopCh <- struct{}{} } else { klog.V(5).Infof("watcher receives %s on the mounted file %s\n", event.Op.String(), event.Name)