From 7d4e049ea136c600ff7b4d285dff45022f79f3c7 Mon Sep 17 00:00:00 2001 From: andyzhangx Date: Thu, 24 Aug 2017 03:27:11 +0000 Subject: [PATCH] allow windows mount path fix according to review comments fix according to review comments --- pkg/api/validation/validation.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/api/validation/validation.go b/pkg/api/validation/validation.go index 86e4d584fc..b05a380a41 100644 --- a/pkg/api/validation/validation.go +++ b/pkg/api/validation/validation.go @@ -1860,7 +1860,11 @@ func ValidateVolumeMounts(mounts []api.VolumeMount, volumes sets.String, fldPath allErrs = append(allErrs, field.Invalid(idxPath.Child("mountPath"), mnt.MountPath, "must be unique")) } if !path.IsAbs(mnt.MountPath) { - allErrs = append(allErrs, field.Invalid(idxPath.Child("mountPath"), mnt.MountPath, "must be an absolute path")) + // also allow windows absolute path + p := mnt.MountPath + if len(p) < 2 || ((p[0] < 'A' || p[0] > 'Z') && (p[0] < 'a' || p[0] > 'z')) || p[1] != ':' { + allErrs = append(allErrs, field.Invalid(idxPath.Child("mountPath"), mnt.MountPath, "must be an absolute path")) + } } mountpoints.Insert(mnt.MountPath) if len(mnt.SubPath) > 0 {