diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index ebcb4530..59645573 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -61,6 +61,18 @@ var _ = Describe("etcd-operator", Ordered, func() { _, err = utils.Run(cmd) ExpectWithOffset(1, err).NotTo(HaveOccurred()) }) + + By("wait until etcd-operator webhook is ready", func() { + cmd := exec.Command("kubectl", "apply", "-f", "test/e2e/webhook-checker.yaml") + _, err = utils.Run(cmd) + ExpectWithOffset(1, err).NotTo(HaveOccurred()) + + cmd = exec.Command("kubectl", "wait", "--namespace", + "etcd-operator-system", "pod/webhook-checker", + "--for", "jsonpath={.status.conditions[?(@.type==\"Ready\")].status}=True", "--timeout=5m") + _, err = utils.Run(cmd) + ExpectWithOffset(1, err).NotTo(HaveOccurred()) + }) }) if os.Getenv("DO_CLEANUP_AFTER_E2E") == "true" { diff --git a/test/e2e/webhook-checker.yaml b/test/e2e/webhook-checker.yaml new file mode 100644 index 00000000..1ad11829 --- /dev/null +++ b/test/e2e/webhook-checker.yaml @@ -0,0 +1,20 @@ +apiVersion: v1 +kind: Pod +metadata: + name: webhook-checker + namespace: etcd-operator-system +spec: + containers: + - image: curlimages/curl:8.10.1 + name: webhook-checker + command: + - sh + - -c + - "sleep 360" + readinessProbe: + exec: + command: + - sh + - -c + - "curl -k https://etcd-operator-webhook-service/mutate-etcd-aenix-io-v1alpha1-etcdcluster" + periodSeconds: 5