@@ -149,18 +149,17 @@ func getCodecForObject(obj runtime.Object) (runtime.Codec, error) {
149
149
150
150
func validateObject (obj runtime.Object ) (errors field.ErrorList ) {
151
151
podValidationOptions := validation.PodValidationOptions {
152
- AllowMultipleHugePageResources : true ,
153
- AllowDownwardAPIHugePages : true ,
152
+ AllowDownwardAPIHugePages : true ,
153
+ AllowInvalidPodDeletionCost : false ,
154
+ AllowIndivisibleHugePagesValues : true ,
155
+ AllowWindowsHostProcessField : true ,
156
+ AllowExpandedDNSConfig : true ,
154
157
}
155
158
156
159
quotaValidationOptions := validation.ResourceQuotaValidationOptions {
157
160
AllowPodAffinityNamespaceSelector : true ,
158
161
}
159
162
160
- pspValidationOptions := policy_validation.PodSecurityPolicyValidationOptions {
161
- AllowEphemeralVolumeType : true ,
162
- }
163
-
164
163
// Enable CustomPodDNS for testing
165
164
// feature.DefaultFeatureGate.Set("CustomPodDNS=true")
166
165
switch t := obj .(type ) {
@@ -182,20 +181,23 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
182
181
case * api.Namespace :
183
182
errors = validation .ValidateNamespace (t )
184
183
case * api.PersistentVolume :
185
- errors = validation .ValidatePersistentVolume (t )
184
+ opts := validation.PersistentVolumeSpecValidationOptions {
185
+ AllowReadWriteOncePod : true ,
186
+ }
187
+ errors = validation .ValidatePersistentVolume (t , opts )
186
188
case * api.PersistentVolumeClaim :
187
189
if t .Namespace == "" {
188
190
t .Namespace = api .NamespaceDefault
189
191
}
190
- errors = validation .ValidatePersistentVolumeClaim (t )
192
+ opts := validation.PersistentVolumeClaimSpecValidationOptions {
193
+ AllowReadWriteOncePod : true ,
194
+ }
195
+ errors = validation .ValidatePersistentVolumeClaim (t , opts )
191
196
case * api.Pod :
192
197
if t .Namespace == "" {
193
198
t .Namespace = api .NamespaceDefault
194
199
}
195
- opts := validation.PodValidationOptions {
196
- AllowMultipleHugePageResources : true ,
197
- }
198
- errors = validation .ValidatePodCreate (t , opts )
200
+ errors = validation .ValidatePodCreate (t , podValidationOptions )
199
201
case * api.PodList :
200
202
for i := range t .Items {
201
203
errors = append (errors , validateObject (& t .Items [i ])... )
@@ -277,11 +279,7 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
277
279
if t .Namespace == "" {
278
280
t .Namespace = api .NamespaceDefault
279
281
}
280
- gv := schema.GroupVersion {
281
- Group : networking .GroupName ,
282
- Version : legacyscheme .Scheme .PrioritizedVersionsForGroup (networking .GroupName )[0 ].Version ,
283
- }
284
- errors = networking_validation .ValidateIngressCreate (t , gv )
282
+ errors = networking_validation .ValidateIngressCreate (t )
285
283
case * networking.IngressClass :
286
284
/*
287
285
if t.Namespace == "" {
@@ -295,7 +293,7 @@ func validateObject(obj runtime.Object) (errors field.ErrorList) {
295
293
errors = networking_validation .ValidateIngressClass (t )
296
294
297
295
case * policy.PodSecurityPolicy :
298
- errors = policy_validation .ValidatePodSecurityPolicy (t , pspValidationOptions )
296
+ errors = policy_validation .ValidatePodSecurityPolicy (t )
299
297
case * apps.ReplicaSet :
300
298
if t .Namespace == "" {
301
299
t .Namespace = api .NamespaceDefault
@@ -399,7 +397,7 @@ func TestExampleObjectSchemas(t *testing.T) {
399
397
},
400
398
"admin/dns" : {
401
399
"busybox" : {& api.Pod {}},
402
- "dns-horizontal-autoscaler" : {& apps.Deployment {}},
400
+ "dns-horizontal-autoscaler" : {& api. ServiceAccount {}, & rbac. ClusterRole {}, & rbac. ClusterRoleBinding {}, & apps.Deployment {}},
403
401
"dnsutils" : {& api.Pod {}},
404
402
},
405
403
"admin/logging" : {
@@ -447,7 +445,7 @@ func TestExampleObjectSchemas(t *testing.T) {
447
445
},
448
446
"admin/sched" : {
449
447
"clusterrole" : {& rbac.ClusterRole {}},
450
- "my-scheduler" : {& api.ServiceAccount {}, & rbac.ClusterRoleBinding {}, & rbac.ClusterRoleBinding {}, & apps.Deployment {}},
448
+ "my-scheduler" : {& api.ServiceAccount {}, & rbac.ClusterRoleBinding {}, & rbac.ClusterRoleBinding {}, & api. ConfigMap {}, & apps.Deployment {}},
451
449
"pod1" : {& api.Pod {}},
452
450
"pod2" : {& api.Pod {}},
453
451
"pod3" : {& api.Pod {}},
@@ -558,6 +556,7 @@ func TestExampleObjectSchemas(t *testing.T) {
558
556
"pod-projected-svc-token" : {& api.Pod {}},
559
557
"pod-rs" : {& api.Pod {}, & api.Pod {}},
560
558
"pod-single-configmap-env-variable" : {& api.Pod {}},
559
+ "pod-with-affinity-anti-affinity" : {& api.Pod {}},
561
560
"pod-with-node-affinity" : {& api.Pod {}},
562
561
"pod-with-pod-affinity" : {& api.Pod {}},
563
562
"pod-with-toleration" : {& api.Pod {}},
@@ -586,6 +585,7 @@ func TestExampleObjectSchemas(t *testing.T) {
586
585
},
587
586
"pods/probe" : {
588
587
"exec-liveness" : {& api.Pod {}},
588
+ "grpc-liveness" : {& api.Pod {}},
589
589
"http-liveness" : {& api.Pod {}},
590
590
"pod-with-http-healthcheck" : {& api.Pod {}},
591
591
"pod-with-tcp-socket-healthcheck" : {& api.Pod {}},
@@ -614,11 +614,15 @@ func TestExampleObjectSchemas(t *testing.T) {
614
614
"security-context-4" : {& api.Pod {}},
615
615
},
616
616
"pods/storage" : {
617
- "projected" : {& api.Pod {}},
618
- "pv-claim" : {& api.PersistentVolumeClaim {}},
619
- "pv-pod" : {& api.Pod {}},
620
- "pv-volume" : {& api.PersistentVolume {}},
621
- "redis" : {& api.Pod {}},
617
+ "projected" : {& api.Pod {}},
618
+ "projected-secret-downwardapi-configmap" : {& api.Pod {}},
619
+ "projected-secrets-nondefault-permission-mode" : {& api.Pod {}},
620
+ "projected-service-account-token" : {& api.Pod {}},
621
+ "pv-claim" : {& api.PersistentVolumeClaim {}},
622
+ "pv-duplicate" : {& api.Pod {}},
623
+ "pv-pod" : {& api.Pod {}},
624
+ "pv-volume" : {& api.PersistentVolume {}},
625
+ "redis" : {& api.Pod {}},
622
626
},
623
627
"policy" : {
624
628
"baseline-psp" : {& policy.PodSecurityPolicy {}},
@@ -643,6 +647,7 @@ func TestExampleObjectSchemas(t *testing.T) {
643
647
"service/networking" : {
644
648
"curlpod" : {& apps.Deployment {}},
645
649
"custom-dns" : {& api.Pod {}},
650
+ "default-ingressclass" : {& networking.IngressClass {}},
646
651
"dual-stack-default-svc" : {& api.Service {}},
647
652
"dual-stack-ipfamilies-ipv6" : {& api.Service {}},
648
653
"dual-stack-ipv6-svc" : {& api.Service {}},
@@ -658,6 +663,7 @@ func TestExampleObjectSchemas(t *testing.T) {
658
663
"name-virtual-host-ingress" : {& networking.Ingress {}},
659
664
"name-virtual-host-ingress-no-third-host" : {& networking.Ingress {}},
660
665
"namespaced-params" : {& networking.IngressClass {}},
666
+ "networkpolicy" : {& networking.NetworkPolicy {}},
661
667
"network-policy-allow-all-egress" : {& networking.NetworkPolicy {}},
662
668
"network-policy-allow-all-ingress" : {& networking.NetworkPolicy {}},
663
669
"network-policy-default-deny-egress" : {& networking.NetworkPolicy {}},
0 commit comments