mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 22:17:14 +00:00
Merge pull request #22204 from thockin/path-colon
Validate volume paths do not have ':'
This commit is contained in:
commit
b05cf6d53a
@ -1965,7 +1965,7 @@
|
|||||||
},
|
},
|
||||||
"mountPath": {
|
"mountPath": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Path within the container at which the volume should be mounted."
|
"description": "Path within the container at which the volume should be mounted. Must not contain ':'."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -6293,7 +6293,7 @@
|
|||||||
},
|
},
|
||||||
"mountPath": {
|
"mountPath": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Path within the container at which the volume should be mounted."
|
"description": "Path within the container at which the volume should be mounted. Must not contain ':'."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -16826,7 +16826,7 @@
|
|||||||
},
|
},
|
||||||
"mountPath": {
|
"mountPath": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Path within the container at which the volume should be mounted."
|
"description": "Path within the container at which the volume should be mounted. Must not contain ':'."
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -814,7 +814,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">mountPath</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">mountPath</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Path within the container at which the volume should be mounted.</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">Path within the container at which the volume should be mounted. Must not contain <em>:</em>.</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||||
<td class="tableblock halign-left valign-top"></td>
|
<td class="tableblock halign-left valign-top"></td>
|
||||||
@ -5591,7 +5591,7 @@ Populated by the system when a graceful deletion is requested. Read-only. More i
|
|||||||
</div>
|
</div>
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
<div id="footer-text">
|
<div id="footer-text">
|
||||||
Last updated 2016-02-27 01:28:36 UTC
|
Last updated 2016-02-29 20:12:48 UTC
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -764,7 +764,7 @@ span.icon > [class^="icon-"], span.icon > [class*=" icon-"] { cursor: default; }
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">mountPath</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">mountPath</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Path within the container at which the volume should be mounted.</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">Path within the container at which the volume should be mounted. Must not contain <em>:</em>.</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">true</p></td>
|
||||||
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
<td class="tableblock halign-left valign-top"><p class="tableblock">string</p></td>
|
||||||
<td class="tableblock halign-left valign-top"></td>
|
<td class="tableblock halign-left valign-top"></td>
|
||||||
@ -7488,7 +7488,7 @@ The resulting set of endpoints can be viewed as:<br>
|
|||||||
</div>
|
</div>
|
||||||
<div id="footer">
|
<div id="footer">
|
||||||
<div id="footer-text">
|
<div id="footer-text">
|
||||||
Last updated 2016-02-27 01:28:28 UTC
|
Last updated 2016-02-29 20:12:40 UTC
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
@ -742,7 +742,7 @@ type VolumeMount struct {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
// Optional: Defaults to false (read-write).
|
// Optional: Defaults to false (read-write).
|
||||||
ReadOnly bool `json:"readOnly,omitempty"`
|
ReadOnly bool `json:"readOnly,omitempty"`
|
||||||
// Required.
|
// Required. Must not contain ':'.
|
||||||
MountPath string `json:"mountPath"`
|
MountPath string `json:"mountPath"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -866,7 +866,8 @@ type VolumeMount struct {
|
|||||||
// Mounted read-only if true, read-write otherwise (false or unspecified).
|
// Mounted read-only if true, read-write otherwise (false or unspecified).
|
||||||
// Defaults to false.
|
// Defaults to false.
|
||||||
ReadOnly bool `json:"readOnly,omitempty"`
|
ReadOnly bool `json:"readOnly,omitempty"`
|
||||||
// Path within the container at which the volume should be mounted.
|
// Path within the container at which the volume should be mounted. Must
|
||||||
|
// not contain ':'.
|
||||||
MountPath string `json:"mountPath"`
|
MountPath string `json:"mountPath"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1565,7 +1565,7 @@ var map_VolumeMount = map[string]string{
|
|||||||
"": "VolumeMount describes a mounting of a Volume within a container.",
|
"": "VolumeMount describes a mounting of a Volume within a container.",
|
||||||
"name": "This must match the Name of a Volume.",
|
"name": "This must match the Name of a Volume.",
|
||||||
"readOnly": "Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.",
|
"readOnly": "Mounted read-only if true, read-write otherwise (false or unspecified). Defaults to false.",
|
||||||
"mountPath": "Path within the container at which the volume should be mounted.",
|
"mountPath": "Path within the container at which the volume should be mounted. Must not contain ':'.",
|
||||||
}
|
}
|
||||||
|
|
||||||
func (VolumeMount) SwaggerDoc() map[string]string {
|
func (VolumeMount) SwaggerDoc() map[string]string {
|
||||||
|
@ -1091,6 +1091,8 @@ func validateVolumeMounts(mounts []api.VolumeMount, volumes sets.String, fldPath
|
|||||||
}
|
}
|
||||||
if len(mnt.MountPath) == 0 {
|
if len(mnt.MountPath) == 0 {
|
||||||
allErrs = append(allErrs, field.Required(idxPath.Child("mountPath"), ""))
|
allErrs = append(allErrs, field.Required(idxPath.Child("mountPath"), ""))
|
||||||
|
} else if strings.Contains(mnt.MountPath, ":") {
|
||||||
|
allErrs = append(allErrs, field.Invalid(idxPath.Child("mountPath"), mnt.MountPath, "must not contain ':'"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return allErrs
|
return allErrs
|
||||||
|
@ -1134,6 +1134,7 @@ func TestValidateVolumeMounts(t *testing.T) {
|
|||||||
"empty name": {{Name: "", MountPath: "/foo"}},
|
"empty name": {{Name: "", MountPath: "/foo"}},
|
||||||
"name not found": {{Name: "", MountPath: "/foo"}},
|
"name not found": {{Name: "", MountPath: "/foo"}},
|
||||||
"empty mountpath": {{Name: "abc", MountPath: ""}},
|
"empty mountpath": {{Name: "abc", MountPath: ""}},
|
||||||
|
"colon mountpath": {{Name: "abc", MountPath: "foo:bar"}},
|
||||||
}
|
}
|
||||||
for k, v := range errorCases {
|
for k, v := range errorCases {
|
||||||
if errs := validateVolumeMounts(v, volumes, field.NewPath("field")); len(errs) == 0 {
|
if errs := validateVolumeMounts(v, volumes, field.NewPath("field")); len(errs) == 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user