From decb126617b6f0ba7da75c1732b38e401a6b8356 Mon Sep 17 00:00:00 2001
From: Maarten de Waard <maarten@greenhost.nl>
Date: Mon, 29 Nov 2021 12:31:45 +0100
Subject: [PATCH] wait until *cert manager* is ready

---
 .gitlab/ci_scripts/install_zerossl_issuer.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/.gitlab/ci_scripts/install_zerossl_issuer.sh b/.gitlab/ci_scripts/install_zerossl_issuer.sh
index 0aaefbb45..855cc440a 100755
--- a/.gitlab/ci_scripts/install_zerossl_issuer.sh
+++ b/.gitlab/ci_scripts/install_zerossl_issuer.sh
@@ -1,6 +1,6 @@
 #!/usr/bin/env bash
 #
-# Waits until ClusterIssuer crd exists, and then installs a ZeroSSL
+# Waits until cert-manager HelmRelease is ready, and then installs a ZeroSSL
 # ClusterIssuer with our credentials into the cert-manager namespace
 #
 # Usage:
@@ -11,8 +11,8 @@ set -euo pipefail
 # Create secret with HMAC key
 kubectl -n cert-manager create secret generic zerossl-eabsecret --from-literal "secret=${ZEROSSL_EAB_HMAC_KEY}"
 
-# Wait until ClusterIssuer CRD exists
-"$(dirname "$0")/retry_cmd_until_success.sh" 30 10 kubectl get crd clusterissuers.cert-manager.io
+# Wait until cert-manager is ready
+"$(dirname "$0")/retry_cmd_until_success.sh" 30 10 "flux get helmrelease -n cert-manager --status-selector ready=true --no-header | grep cert-manager"
 
 # Add ZeroSSL ClusterIssuer
 kubectl apply -n cert-manager -f - <<EOF
-- 
GitLab