Skip to content

Commit 632b493

Browse files
committed
scripts: skip cert-manager install if already present on cluster
Also check cert-manager deployments, not just CRD Fixes #1501 Signed-off-by: Todd Short <tshort@redhat.com>
1 parent 747fba3 commit 632b493

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

scripts/install.tpl.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,16 @@ kubectl_wait_for_query() {
9494
done
9595
}
9696

97-
kubectl apply -f "https://github.com/cert-manager/cert-manager/releases/download/${cert_mgr_version}/cert-manager.yaml"
97+
# Install cert-manager only if it is not already present on the cluster.
98+
# Check both the CRD and the controller deployments to avoid false positives
99+
# from stale CRDs left behind by a partial or incomplete installation.
100+
if kubectl get crd certificates.cert-manager.io &>/dev/null && \
101+
kubectl get deployment -n cert-manager cert-manager-webhook &>/dev/null && \
102+
kubectl get deployment -n cert-manager cert-manager-cainjector &>/dev/null; then
103+
echo "cert-manager is already installed, skipping installation"
104+
else
105+
kubectl apply -f "https://github.com/cert-manager/cert-manager/releases/download/${cert_mgr_version}/cert-manager.yaml"
106+
fi
98107
# Wait for cert-manager to be fully ready
99108
kubectl_wait "cert-manager" "deployment/cert-manager-webhook" "60s"
100109
kubectl_wait "cert-manager" "deployment/cert-manager-cainjector" "60s"

0 commit comments

Comments
 (0)