Merge pull request #81397 from ddebroy/win-socket

Support Kubelet PluginWatcher in Windows
This commit is contained in:
Kubernetes Prow Robot
2019-08-28 01:37:12 -07:00
committed by GitHub
7 changed files with 227 additions and 1 deletions

View File

@@ -135,3 +135,20 @@ func LocalEndpoint(path, file string) (string, error) {
}
return filepath.Join(u.String(), file+".sock"), nil
}
// IsUnixDomainSocket returns whether a given file is a AF_UNIX socket file
func IsUnixDomainSocket(filePath string) (bool, error) {
fi, err := os.Stat(filePath)
if err != nil {
return false, fmt.Errorf("stat file %s failed: %v", filePath, err)
}
if fi.Mode()&os.ModeSocket == 0 {
return false, nil
}
return true, nil
}
// NormalizePath is a no-op for Linux for now
func NormalizePath(path string) string {
return path
}