Update vendor files to point to kubernetes-1.12.0-beta.1
This commit is contained in:
20
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go
generated
vendored
20
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation.go
generated
vendored
@@ -18,6 +18,7 @@ package validation
|
||||
|
||||
import (
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
"k8s.io/apimachinery/pkg/util/validation"
|
||||
"k8s.io/apimachinery/pkg/util/validation/field"
|
||||
)
|
||||
@@ -84,6 +85,25 @@ func ValidateDeleteOptions(options *metav1.DeleteOptions) field.ErrorList {
|
||||
*options.PropagationPolicy != metav1.DeletePropagationOrphan {
|
||||
allErrs = append(allErrs, field.NotSupported(field.NewPath("propagationPolicy"), options.PropagationPolicy, []string{string(metav1.DeletePropagationForeground), string(metav1.DeletePropagationBackground), string(metav1.DeletePropagationOrphan), "nil"}))
|
||||
}
|
||||
allErrs = append(allErrs, validateDryRun(field.NewPath("dryRun"), options.DryRun)...)
|
||||
return allErrs
|
||||
}
|
||||
|
||||
func ValidateCreateOptions(options *metav1.CreateOptions) field.ErrorList {
|
||||
return validateDryRun(field.NewPath("dryRun"), options.DryRun)
|
||||
}
|
||||
|
||||
func ValidateUpdateOptions(options *metav1.UpdateOptions) field.ErrorList {
|
||||
return validateDryRun(field.NewPath("dryRun"), options.DryRun)
|
||||
}
|
||||
|
||||
var allowedDryRunValues = sets.NewString(metav1.DryRunAll)
|
||||
|
||||
func validateDryRun(fldPath *field.Path, dryRun []string) field.ErrorList {
|
||||
allErrs := field.ErrorList{}
|
||||
if !allowedDryRunValues.HasAll(dryRun...) {
|
||||
allErrs = append(allErrs, field.NotSupported(fldPath, dryRun, allowedDryRunValues.List()))
|
||||
}
|
||||
return allErrs
|
||||
}
|
||||
|
||||
|
33
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation_test.go
generated
vendored
33
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation/validation_test.go
generated
vendored
@@ -17,6 +17,7 @@ limitations under the License.
|
||||
package validation
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -92,3 +93,35 @@ func TestValidateLabels(t *testing.T) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestValidDryRun(t *testing.T) {
|
||||
tests := [][]string{
|
||||
{},
|
||||
{"All"},
|
||||
{"All", "All"},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(fmt.Sprintf("%v", test), func(t *testing.T) {
|
||||
if errs := validateDryRun(field.NewPath("dryRun"), test); len(errs) != 0 {
|
||||
t.Errorf("%v should be a valid dry-run value: %v", test, errs)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestInvalidDryRun(t *testing.T) {
|
||||
tests := [][]string{
|
||||
{"False"},
|
||||
{"All", "False"},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
t.Run(fmt.Sprintf("%v", test), func(t *testing.T) {
|
||||
if len(validateDryRun(field.NewPath("dryRun"), test)) == 0 {
|
||||
t.Errorf("%v shouldn't be a valid dry-run value", test)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user