@@ -419,13 +419,16 @@ var _ = SIGDescribe("AdmissionWebhook [Privileged:ClusterAdmin]", func() {
419
419
},
420
420
Webhooks : []admissionregistrationv1.ValidatingWebhook {
421
421
newDenyConfigMapWebhookFixture (f , context , servicePort ),
422
+ newValidatingIsReadyWebhookFixture (f , context , servicePort ),
422
423
},
423
424
})
424
425
framework .ExpectNoError (err , "Creating validating webhook configuration" )
425
426
defer func () {
426
427
err := client .AdmissionregistrationV1 ().ValidatingWebhookConfigurations ().Delete (hook .Name , nil )
427
428
framework .ExpectNoError (err , "Deleting validating webhook configuration" )
428
429
}()
430
+ // ensure backend is ready before proceeding
431
+ waitWebhookConfigurationReady (f )
429
432
ginkgo .By ("Creating a configMap that does not comply to the validation webhook rules" )
430
433
err = wait .PollImmediate (100 * time .Millisecond , 30 * time .Second , func () (bool , error ) {
431
434
cm := namedNonCompliantConfigMap (string (uuid .NewUUID ()), f )
@@ -509,14 +512,16 @@ var _ = SIGDescribe("AdmissionWebhook [Privileged:ClusterAdmin]", func() {
509
512
},
510
513
Webhooks : []admissionregistrationv1.MutatingWebhook {
511
514
newMutateConfigMapWebhookFixture (f , context , 1 , servicePort ),
515
+ newMutatingIsReadyWebhookFixture (f , context , servicePort ),
512
516
},
513
517
})
514
518
framework .ExpectNoError (err , "Creating mutating webhook configuration" )
515
519
defer func () {
516
520
err := client .AdmissionregistrationV1 ().MutatingWebhookConfigurations ().Delete (hook .Name , nil )
517
521
framework .ExpectNoError (err , "Deleting mutating webhook configuration" )
518
522
}()
519
-
523
+ // ensure backend is ready before proceeding
524
+ waitWebhookConfigurationReady (f )
520
525
hook , err = admissionClient .MutatingWebhookConfigurations ().Get (f .UniqueName , metav1.GetOptions {})
521
526
framework .ExpectNoError (err , "Getting mutating webhook configuration" )
522
527
ginkgo .By ("Updating a mutating webhook configuration's rules to not include the create operation" )
@@ -2449,6 +2454,7 @@ func waitWebhookConfigurationReady(f *framework.Framework) error {
2449
2454
// with "marker" requests via waitWebhookConfigurationReady to wait for a webhook configuration to be ready.
2450
2455
func newValidatingIsReadyWebhookFixture (f * framework.Framework , context * certContext , servicePort int32 ) admissionregistrationv1.ValidatingWebhook {
2451
2456
sideEffectsNone := admissionregistrationv1 .SideEffectClassNone
2457
+ failOpen := admissionregistrationv1 .Ignore
2452
2458
return admissionregistrationv1.ValidatingWebhook {
2453
2459
Name : "validating-is-webhook-configuration-ready.k8s.io" ,
2454
2460
Rules : []admissionregistrationv1.RuleWithOperations {{
@@ -2468,6 +2474,8 @@ func newValidatingIsReadyWebhookFixture(f *framework.Framework, context *certCon
2468
2474
},
2469
2475
CABundle : context .signingCert ,
2470
2476
},
2477
+ // network failures while the service network routing is being set up should be ignored by the marker
2478
+ FailurePolicy : & failOpen ,
2471
2479
SideEffects : & sideEffectsNone ,
2472
2480
AdmissionReviewVersions : []string {"v1" , "v1beta1" },
2473
2481
// Scope the webhook to just the markers namespace
@@ -2485,6 +2493,7 @@ func newValidatingIsReadyWebhookFixture(f *framework.Framework, context *certCon
2485
2493
// with "marker" requests via waitWebhookConfigurationReady to wait for a webhook configuration to be ready.
2486
2494
func newMutatingIsReadyWebhookFixture (f * framework.Framework , context * certContext , servicePort int32 ) admissionregistrationv1.MutatingWebhook {
2487
2495
sideEffectsNone := admissionregistrationv1 .SideEffectClassNone
2496
+ failOpen := admissionregistrationv1 .Ignore
2488
2497
return admissionregistrationv1.MutatingWebhook {
2489
2498
Name : "mutating-is-webhook-configuration-ready.k8s.io" ,
2490
2499
Rules : []admissionregistrationv1.RuleWithOperations {{
@@ -2504,6 +2513,8 @@ func newMutatingIsReadyWebhookFixture(f *framework.Framework, context *certConte
2504
2513
},
2505
2514
CABundle : context .signingCert ,
2506
2515
},
2516
+ // network failures while the service network routing is being set up should be ignored by the marker
2517
+ FailurePolicy : & failOpen ,
2507
2518
SideEffects : & sideEffectsNone ,
2508
2519
AdmissionReviewVersions : []string {"v1" , "v1beta1" },
2509
2520
// Scope the webhook to just the markers namespace
0 commit comments