Skip to content

Commit 87a2b71

Browse files
authored
Merge pull request kubernetes#134767 from lalitc375/slice
Enable DV for resourceslice
2 parents 905d72b + 2061ec2 commit 87a2b71

File tree

14 files changed

+515
-13
lines changed

14 files changed

+515
-13
lines changed

pkg/apis/resource/v1/zz_generated.validations.go

Lines changed: 68 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/resource/v1beta1/zz_generated.validations.go

Lines changed: 68 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/resource/v1beta2/zz_generated.validations.go

Lines changed: 68 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/resource/validation/validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,9 +1366,9 @@ func validateDeviceTaint(taint resource.DeviceTaint, fldPath *field.Path) field.
13661366
}
13671367
switch {
13681368
case taint.Effect == "":
1369-
allErrs = append(allErrs, field.Required(fldPath.Child("effect"), "")) // Required in a taint.
1369+
allErrs = append(allErrs, field.Required(fldPath.Child("effect"), "").MarkCoveredByDeclarative()) // Required in a taint.
13701370
case !validDeviceTaintEffects.Has(taint.Effect):
1371-
allErrs = append(allErrs, field.NotSupported(fldPath.Child("effect"), taint.Effect, sets.List(validDeviceTaintEffects)))
1371+
allErrs = append(allErrs, field.NotSupported(fldPath.Child("effect"), taint.Effect, sets.List(validDeviceTaintEffects)).MarkCoveredByDeclarative())
13721372
}
13731373

13741374
return allErrs

pkg/apis/resource/validation/validation_devicetaintrule_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ func TestValidateDeviceTaint(t *testing.T) {
296296
},
297297
"invalid-taint": {
298298
wantFailures: field.ErrorList{
299-
field.Required(field.NewPath("spec", "taint", "effect"), ""),
299+
field.Required(field.NewPath("spec", "taint", "effect"), "").MarkCoveredByDeclarative(),
300300
},
301301
taintRule: func() *resourceapi.DeviceTaintRule {
302302
claim := testDeviceTaintRule(goodName, validDeviceTaintRuleSpec)

pkg/apis/resource/validation/validation_resourceslice_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,11 +493,11 @@ func TestValidateResourceSlice(t *testing.T) {
493493
return field.ErrorList{
494494
field.Invalid(fldPath.Index(2).Child("key"), "", "name part must be non-empty"),
495495
field.Invalid(fldPath.Index(2).Child("key"), "", "name part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]')"),
496-
field.Required(fldPath.Index(2).Child("effect"), ""),
496+
field.Required(fldPath.Index(2).Child("effect"), "").MarkCoveredByDeclarative(),
497497

498498
field.Invalid(fldPath.Index(3).Child("key"), badName, "name part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my.name', or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]')"),
499499
field.Invalid(fldPath.Index(3).Child("value"), badName, "a valid label must be an empty string or consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyValue', or 'my_value', or '12345', regex used for validation is '(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])?')"),
500-
field.NotSupported(fldPath.Index(3).Child("effect"), resourceapi.DeviceTaintEffect("some-other-op"), []resourceapi.DeviceTaintEffect{resourceapi.DeviceTaintEffectNoExecute, resourceapi.DeviceTaintEffectNoSchedule}),
500+
field.NotSupported(fldPath.Index(3).Child("effect"), resourceapi.DeviceTaintEffect("some-other-op"), []resourceapi.DeviceTaintEffect{resourceapi.DeviceTaintEffectNoExecute, resourceapi.DeviceTaintEffectNoSchedule}).MarkCoveredByDeclarative(),
501501
}
502502
}(),
503503
slice: func() *resourceapi.ResourceSlice {

0 commit comments

Comments
 (0)