Skip to content

Commit 11678fb

Browse files
authored
Merge pull request kubernetes#82207 from liggitt/webhook-backend-setup
Ensure backend is ready in listing webhook e2es
2 parents 3d17fd5 + e577fee commit 11678fb

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

test/e2e/apimachinery/webhook.go

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,11 @@ var _ = SIGDescribe("AdmissionWebhook [Privileged:ClusterAdmin]", func() {
427427
err := client.AdmissionregistrationV1().ValidatingWebhookConfigurations().Delete(hook.Name, nil)
428428
framework.ExpectNoError(err, "Deleting validating webhook configuration")
429429
}()
430+
430431
// ensure backend is ready before proceeding
431-
waitWebhookConfigurationReady(f)
432+
err = waitWebhookConfigurationReady(f)
433+
framework.ExpectNoError(err, "waiting for webhook configuration to be ready")
434+
432435
ginkgo.By("Creating a configMap that does not comply to the validation webhook rules")
433436
err = wait.PollImmediate(100*time.Millisecond, 30*time.Second, func() (bool, error) {
434437
cm := namedNonCompliantConfigMap(string(uuid.NewUUID()), f)
@@ -520,8 +523,11 @@ var _ = SIGDescribe("AdmissionWebhook [Privileged:ClusterAdmin]", func() {
520523
err := client.AdmissionregistrationV1().MutatingWebhookConfigurations().Delete(hook.Name, nil)
521524
framework.ExpectNoError(err, "Deleting mutating webhook configuration")
522525
}()
526+
523527
// ensure backend is ready before proceeding
524-
waitWebhookConfigurationReady(f)
528+
err = waitWebhookConfigurationReady(f)
529+
framework.ExpectNoError(err, "waiting for webhook configuration to be ready")
530+
525531
hook, err = admissionClient.MutatingWebhookConfigurations().Get(f.UniqueName, metav1.GetOptions{})
526532
framework.ExpectNoError(err, "Getting mutating webhook configuration")
527533
ginkgo.By("Updating a mutating webhook configuration's rules to not include the create operation")
@@ -586,6 +592,7 @@ var _ = SIGDescribe("AdmissionWebhook [Privileged:ClusterAdmin]", func() {
586592
},
587593
Webhooks: []admissionregistrationv1.ValidatingWebhook{
588594
newDenyConfigMapWebhookFixture(f, context, servicePort),
595+
newValidatingIsReadyWebhookFixture(f, context, servicePort),
589596
},
590597
})
591598
framework.ExpectNoError(err, "Creating validating webhook configuration")
@@ -597,6 +604,10 @@ var _ = SIGDescribe("AdmissionWebhook [Privileged:ClusterAdmin]", func() {
597604
framework.ExpectNoError(err, "Listing validating webhook configurations")
598605
framework.ExpectEqual(len(list.Items), testListSize)
599606

607+
// ensure backend is ready before proceeding
608+
err = waitWebhookConfigurationReady(f)
609+
framework.ExpectNoError(err, "waiting for webhook configuration to be ready")
610+
600611
ginkgo.By("Creating a configMap that does not comply to the validation webhook rules")
601612
err = wait.PollImmediate(100*time.Millisecond, 30*time.Second, func() (bool, error) {
602613
cm := namedNonCompliantConfigMap(string(uuid.NewUUID()), f)
@@ -655,6 +666,7 @@ var _ = SIGDescribe("AdmissionWebhook [Privileged:ClusterAdmin]", func() {
655666
},
656667
Webhooks: []admissionregistrationv1.MutatingWebhook{
657668
newMutateConfigMapWebhookFixture(f, context, 1, servicePort),
669+
newMutatingIsReadyWebhookFixture(f, context, servicePort),
658670
},
659671
})
660672
framework.ExpectNoError(err, "Creating mutating webhook configuration")
@@ -666,6 +678,10 @@ var _ = SIGDescribe("AdmissionWebhook [Privileged:ClusterAdmin]", func() {
666678
framework.ExpectNoError(err, "Listing mutating webhook configurations")
667679
framework.ExpectEqual(len(list.Items), testListSize)
668680

681+
// ensure backend is ready before proceeding
682+
err = waitWebhookConfigurationReady(f)
683+
framework.ExpectNoError(err, "waiting for webhook configuration to be ready")
684+
669685
ginkgo.By("Creating a configMap that should be mutated")
670686
err = wait.PollImmediate(100*time.Millisecond, 30*time.Second, func() (bool, error) {
671687
cm := namedToBeMutatedConfigMap(string(uuid.NewUUID()), f)

0 commit comments

Comments
 (0)