Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
6fa52786
Commit
6fa52786
authored
Nov 16, 2017
by
Brendan Burns
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update API, remove validation.
parent
1b7f028e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
10 deletions
+3
-10
types.go
pkg/apis/core/types.go
+3
-1
validation.go
pkg/apis/core/validation/validation.go
+0
-7
validation_test.go
pkg/apis/core/validation/validation_test.go
+0
-2
No files found.
pkg/apis/core/types.go
View file @
6fa52786
...
@@ -1530,7 +1530,9 @@ type VolumeMount struct {
...
@@ -1530,7 +1530,9 @@ type VolumeMount struct {
// Optional: Defaults to false (read-write).
// Optional: Defaults to false (read-write).
// +optional
// +optional
ReadOnly
bool
ReadOnly
bool
// Required. Must not contain ':'.
// Required. If the path is not an absolute path (e.g. some/path) it
// will be prepended with the appropriate root prefix for the operating
// system. On Linux this is '/', on Windows this is 'C:\'.
MountPath
string
MountPath
string
// Path within the volume from which the container's volume should be mounted.
// Path within the volume from which the container's volume should be mounted.
// Defaults to "" (volume's root).
// Defaults to "" (volume's root).
...
...
pkg/apis/core/validation/validation.go
View file @
6fa52786
...
@@ -1965,13 +1965,6 @@ func ValidateVolumeMounts(mounts []core.VolumeMount, volumes sets.String, contai
...
@@ -1965,13 +1965,6 @@ func ValidateVolumeMounts(mounts []core.VolumeMount, volumes sets.String, contai
if
mountpoints
.
Has
(
mnt
.
MountPath
)
{
if
mountpoints
.
Has
(
mnt
.
MountPath
)
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
idxPath
.
Child
(
"mountPath"
),
mnt
.
MountPath
,
"must be unique"
))
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
idxPath
.
Child
(
"mountPath"
),
mnt
.
MountPath
,
"must be unique"
))
}
}
if
!
path
.
IsAbs
(
mnt
.
MountPath
)
{
// 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
)
mountpoints
.
Insert
(
mnt
.
MountPath
)
if
len
(
mnt
.
SubPath
)
>
0
{
if
len
(
mnt
.
SubPath
)
>
0
{
allErrs
=
append
(
allErrs
,
validateLocalDescendingPath
(
mnt
.
SubPath
,
fldPath
.
Child
(
"subPath"
))
...
)
allErrs
=
append
(
allErrs
,
validateLocalDescendingPath
(
mnt
.
SubPath
,
fldPath
.
Child
(
"subPath"
))
...
)
...
...
pkg/apis/core/validation/validation_test.go
View file @
6fa52786
...
@@ -3849,10 +3849,8 @@ func TestValidateVolumeMounts(t *testing.T) {
...
@@ -3849,10 +3849,8 @@ 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
:
""
}},
"relative mountpath"
:
{{
Name
:
"abc"
,
MountPath
:
"bar"
}},
"mountpath collision"
:
{{
Name
:
"foo"
,
MountPath
:
"/path/a"
},
{
Name
:
"bar"
,
MountPath
:
"/path/a"
}},
"mountpath collision"
:
{{
Name
:
"foo"
,
MountPath
:
"/path/a"
},
{
Name
:
"bar"
,
MountPath
:
"/path/a"
}},
"absolute subpath"
:
{{
Name
:
"abc"
,
MountPath
:
"/bar"
,
SubPath
:
"/baz"
}},
"absolute subpath"
:
{{
Name
:
"abc"
,
MountPath
:
"/bar"
,
SubPath
:
"/baz"
}},
"windows absolute subpath"
:
{{
Name
:
"abc"
,
MountPath
:
"D"
,
SubPath
:
""
}},
"subpath in .."
:
{{
Name
:
"abc"
,
MountPath
:
"/bar"
,
SubPath
:
"../baz"
}},
"subpath in .."
:
{{
Name
:
"abc"
,
MountPath
:
"/bar"
,
SubPath
:
"../baz"
}},
"subpath contains .."
:
{{
Name
:
"abc"
,
MountPath
:
"/bar"
,
SubPath
:
"baz/../bat"
}},
"subpath contains .."
:
{{
Name
:
"abc"
,
MountPath
:
"/bar"
,
SubPath
:
"baz/../bat"
}},
"subpath ends in .."
:
{{
Name
:
"abc"
,
MountPath
:
"/bar"
,
SubPath
:
"./.."
}},
"subpath ends in .."
:
{{
Name
:
"abc"
,
MountPath
:
"/bar"
,
SubPath
:
"./.."
}},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment