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
31819c55
Unverified
Commit
31819c55
authored
Aug 08, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Aug 08, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #81038 from tedyu/automated-cherry-pick-of-#80945-upstream-release-1.15
Automated cherry pick of #80945: Validate CSI Inline Migration unconditionally
parents
b3a664ee
46a1cbf3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
18 deletions
+4
-18
validation.go
pkg/apis/storage/validation/validation.go
+1
-5
validation_test.go
pkg/apis/storage/validation/validation_test.go
+3
-13
No files found.
pkg/apis/storage/validation/validation.go
View file @
31819c55
...
...
@@ -187,11 +187,7 @@ func validateVolumeAttachmentSource(source *storage.VolumeAttachmentSource, fldP
allErrs
=
append
(
allErrs
,
field
.
Required
(
fldPath
.
Child
(
"persistentVolumeName"
),
"must specify non empty persistentVolumeName"
))
}
case
source
.
InlineVolumeSpec
!=
nil
:
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
CSIMigration
)
{
allErrs
=
append
(
allErrs
,
storagevalidation
.
ValidatePersistentVolumeSpec
(
source
.
InlineVolumeSpec
,
""
,
true
,
fldPath
.
Child
(
"inlineVolumeSpec"
))
...
)
}
else
{
allErrs
=
append
(
allErrs
,
field
.
Forbidden
(
fldPath
,
"may not specify inlineVolumeSpec when CSIMigration feature is disabled"
))
}
allErrs
=
append
(
allErrs
,
storagevalidation
.
ValidatePersistentVolumeSpec
(
source
.
InlineVolumeSpec
,
""
,
true
,
fldPath
.
Child
(
"inlineVolumeSpec"
))
...
)
}
return
allErrs
}
...
...
pkg/apis/storage/validation/validation_test.go
View file @
31819c55
...
...
@@ -393,14 +393,6 @@ func TestVolumeAttachmentValidation(t *testing.T) {
},
},
},
}
for
_
,
volumeAttachment
:=
range
migrationDisabledSuccessCases
{
if
errs
:=
ValidateVolumeAttachment
(
&
volumeAttachment
);
len
(
errs
)
!=
0
{
t
.
Errorf
(
"expected success: %v %v"
,
volumeAttachment
,
errs
)
}
}
migrationDisabledErrorCases
:=
[]
storage
.
VolumeAttachment
{
{
// InlineSpec specified with migration disabled
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
"foo"
},
...
...
@@ -413,13 +405,11 @@ func TestVolumeAttachmentValidation(t *testing.T) {
},
},
}
for
_
,
volumeAttachment
:=
range
migrationDisabledErrorCases
{
if
errs
:=
ValidateVolumeAttachment
(
&
volumeAttachment
);
len
(
errs
)
==
0
{
t
.
Errorf
(
"expected failure: %v %v"
,
volumeAttachment
,
errs
)
for
_
,
volumeAttachment
:=
range
migrationDisabledSuccessCases
{
if
errs
:=
ValidateVolumeAttachment
(
&
volumeAttachment
);
len
(
errs
)
!=
0
{
t
.
Errorf
(
"expected success: %v %v"
,
volumeAttachment
,
errs
)
}
}
}
func
TestVolumeAttachmentUpdateValidation
(
t
*
testing
.
T
)
{
...
...
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