Skip to content

Commit e4c93b6

Browse files
✨ make sure the cloud provider vsphere pod restart only on modify event and restart gracefully
Signed-off-by: xudong liu <[email protected]>
1 parent 0dcfa4d commit e4c93b6

File tree

1 file changed

+3
-2
lines changed
  • cmd/vsphere-cloud-controller-manager

1 file changed

+3
-2
lines changed

cmd/vsphere-cloud-controller-manager/main.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,9 @@ func initializeWatch(_ *appconfig.CompletedConfig, paths []string) (watch *fsnot
269269
case err := <-watch.Errors:
270270
klog.Warningf("watcher receives err: %v\n", err)
271271
case event := <-watch.Events:
272-
if event.Op != fsnotify.Chmod {
273-
klog.Fatalf("restarting pod because received event %v\n", event)
272+
// only restart pod when monitor an update event on watched file
273+
if event.Op&fsnotify.Write == fsnotify.Write {
274+
klog.Errorf("restarting pod because received event %v\n", event)
274275
stopCh <- struct{}{}
275276
} else {
276277
klog.V(5).Infof("watcher receives %s on the mounted file %s\n", event.Op.String(), event.Name)

0 commit comments

Comments
 (0)