mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
Improve comments for when hostPath in Windows needs to be transformed
Signed-off-by: Deep Debroy <ddebroy@docker.com>
This commit is contained in:
parent
f8a69f1086
commit
2e19f70922
@ -219,6 +219,8 @@ func makeMounts(pod *v1.Pod, podDir string, container *v1.Container, hostName, h
|
|||||||
containerPath := mount.MountPath
|
containerPath := mount.MountPath
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
// Append C: only if it looks like a local path. Do not process UNC path/SMB shares/named pipes
|
// Append C: only if it looks like a local path. Do not process UNC path/SMB shares/named pipes
|
||||||
|
// NOTE: strings.HasPrefix(hostPath, "\\") checks for prefix "\" as in "\foo\bar" and not "\\foo\bar"
|
||||||
|
// IsWindowsUNCPath checks for prefix "\\" as in "\\foo\bar" and not "\foo\bar"
|
||||||
if (strings.HasPrefix(hostPath, "/") || strings.HasPrefix(hostPath, "\\")) && !strings.Contains(hostPath, ":") && !volumeutil.IsWindowsUNCPath(runtime.GOOS, hostPath) {
|
if (strings.HasPrefix(hostPath, "/") || strings.HasPrefix(hostPath, "\\")) && !strings.Contains(hostPath, ":") && !volumeutil.IsWindowsUNCPath(runtime.GOOS, hostPath) {
|
||||||
hostPath = "c:" + hostPath
|
hostPath = "c:" + hostPath
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user