From 2454d8d4c343096845dcdab74559ba1d36f67564 Mon Sep 17 00:00:00 2001 From: James Sturtevant Date: Wed, 28 Aug 2024 10:31:58 -0700 Subject: [PATCH] Revert "fix: handle socket file detection on Windows" This reverts commit 4060ee60c1d2e5ba1fba1f8729adfc211cee1b6f. --- pkg/kubelet/cm/devicemanager/manager.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkg/kubelet/cm/devicemanager/manager.go b/pkg/kubelet/cm/devicemanager/manager.go index 6264cb12dd9..bca6b516be7 100644 --- a/pkg/kubelet/cm/devicemanager/manager.go +++ b/pkg/kubelet/cm/devicemanager/manager.go @@ -203,12 +203,15 @@ func (m *ManagerImpl) CleanupPluginDirectory(dir string) error { if filePath == m.checkpointFile() { continue } - stat, err := os.Stat(filePath) + // TODO: Until the bug - https://github.com/golang/go/issues/33357 is fixed, os.stat wouldn't return the + // right mode(socket) on windows. Hence deleting the file, without checking whether + // its a socket, on windows. + stat, err := os.Lstat(filePath) if err != nil { klog.ErrorS(err, "Failed to stat file", "path", filePath) continue } - if stat.IsDir() || stat.Mode()&os.ModeSocket == 0 { + if stat.IsDir() { continue } err = os.RemoveAll(filePath)