Merge pull request #29302 from tengqm/fix-examples-test

Fix examples test
pull/29503/head
Kubernetes Prow Robot 2021-08-22 08:46:00 -07:00 committed by GitHub
commit 5c95d82945
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 8 deletions

View File

@ -149,8 +149,11 @@ func getCodecForObject(obj runtime.Object) (runtime.Codec, error) {
func validateObject(obj runtime.Object) (errors field.ErrorList) {
podValidationOptions := validation.PodValidationOptions{
AllowMultipleHugePageResources: true,
AllowDownwardAPIHugePages: true,
AllowDownwardAPIHugePages: true,
AllowInvalidPodDeletionCost: false,
AllowIndivisibleHugePagesValues: true,
AllowWindowsHostProcessField: true,
AllowExpandedDNSConfig: true,
}
quotaValidationOptions := validation.ResourceQuotaValidationOptions{
@ -182,20 +185,23 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
case *api.Namespace:
errors = validation.ValidateNamespace(t)
case *api.PersistentVolume:
errors = validation.ValidatePersistentVolume(t)
opts := validation.PersistentVolumeSpecValidationOptions{
AllowReadWriteOncePod: true,
}
errors = validation.ValidatePersistentVolume(t, opts)
case *api.PersistentVolumeClaim:
if t.Namespace == "" {
t.Namespace = api.NamespaceDefault
}
errors = validation.ValidatePersistentVolumeClaim(t)
opts := validation.PersistentVolumeClaimSpecValidationOptions{
AllowReadWriteOncePod: true,
}
errors = validation.ValidatePersistentVolumeClaim(t, opts)
case *api.Pod:
if t.Namespace == "" {
t.Namespace = api.NamespaceDefault
}
opts := validation.PodValidationOptions{
AllowMultipleHugePageResources: true,
}
errors = validation.ValidatePodCreate(t, opts)
errors = validation.ValidatePodCreate(t, podValidationOptions)
case *api.PodList:
for i := range t.Items {
errors = append(errors, validateObject(&t.Items[i])...)