New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly handle named pipe host mounts for Windows #69484
Changes from 4 commits
b4bb5dd
f8a69f1
2e19f70
119e2a1
5da66fd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -945,6 +945,38 @@ func CheckPersistentVolumeClaimModeBlock(pvc *v1.PersistentVolumeClaim) bool { | |
return utilfeature.DefaultFeatureGate.Enabled(features.BlockVolume) && pvc.Spec.VolumeMode != nil && *pvc.Spec.VolumeMode == v1.PersistentVolumeBlock | ||
} | ||
|
||
// IsWindowsUNCPath checks if path is prefixed with \\ | ||
// This can be used to skip any processing of paths | ||
// that point to SMB shares, local named pipes and local UNC path | ||
func IsWindowsUNCPath(goos, path string) bool { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit, why is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if goos != "windows" { | ||
return false | ||
} | ||
// Check for UNC prefix \\ | ||
if strings.HasPrefix(path, `\\`) { | ||
return true | ||
} | ||
return false | ||
} | ||
|
||
// IsWindowsLocalPath checks if path is a local path | ||
// prefixed with "/" or "\" like "/foo/bar" or "\foo\bar" | ||
func IsWindowsLocalPath(goos, path string) bool { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yujuhong I would prefer to keep |
||
if goos != "windows" { | ||
return false | ||
} | ||
if IsWindowsUNCPath(goos, path) { | ||
return false | ||
} | ||
if strings.Contains(path, ":") { | ||
return false | ||
} | ||
if !(strings.HasPrefix(path, `/`) || strings.HasPrefix(path, `\`)) { | ||
return false | ||
} | ||
return true | ||
} | ||
|
||
// MakeAbsolutePath convert path to absolute path according to GOOS | ||
func MakeAbsolutePath(goos, path string) string { | ||
if goos != "windows" { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this call
MakeAbsolutePath
instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yujuhong yes, done.