Skip to content

Commit 4e29435

Browse files
Copilotphrocker
andcommitted
Fix cert-manager detection to check deployments and use Helm installation
Co-authored-by: phrocker <1781585+phrocker@users.noreply.github.com>
1 parent aa0c71e commit 4e29435

1 file changed

Lines changed: 14 additions & 24 deletions

File tree

ops-scripts/local/deploy-helm.sh

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,20 @@ fi
4444
check_cert_manager() {
4545
echo "Checking if cert-manager is installed..."
4646

47-
# Check if cert-manager CRDs are available
48-
kubectl api-resources --api-group=cert-manager.io >/dev/null 2>&1
49-
if [[ $? -ne 0 ]]; then
47+
# Check if cert-manager deployments are present
48+
if ! kubectl get deployment cert-manager -n cert-manager >/dev/null 2>&1 || \
49+
! kubectl get deployment cert-manager-webhook -n cert-manager >/dev/null 2>&1 || \
50+
! kubectl get deployment cert-manager-cainjector -n cert-manager >/dev/null 2>&1; then
5051
if [[ "$INSTALL_CERT_MANAGER" == "true" ]]; then
51-
echo "cert-manager not found. Installing cert-manager..."
52-
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.0/cert-manager.yaml
52+
echo "cert-manager components not found. Installing via Helm..."
53+
helm repo add jetstack https://charts.jetstack.io
54+
helm repo update
55+
helm upgrade --install cert-manager jetstack/cert-manager \
56+
--namespace cert-manager \
57+
--create-namespace \
58+
--set installCRDs=true
5359
if [[ $? -ne 0 ]]; then
54-
echo "ERROR: Failed to install cert-manager"
60+
echo "ERROR: Failed to install cert-manager with Helm"
5561
exit 1
5662
fi
5763

@@ -67,27 +73,11 @@ check_cert_manager() {
6773
wait_for_cert_manager_crds
6874
echo "cert-manager installed successfully ✓"
6975
else
70-
echo "ERROR: cert-manager is not installed in your cluster."
71-
echo ""
72-
echo "TLS deployment requires cert-manager to be installed first."
73-
echo "To install cert-manager, run:"
74-
echo " kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.0/cert-manager.yaml"
75-
echo ""
76-
echo "Then wait for cert-manager to be ready:"
77-
echo " kubectl wait --for=condition=ready pod -l app.kubernetes.io/instance=cert-manager -n cert-manager --timeout=120s"
78-
echo ""
79-
echo "Alternatively, re-run this script with --install-cert-manager --tls to auto-install cert-manager"
76+
echo "ERROR: cert-manager is not fully installed in your cluster."
77+
echo "You can install it manually or rerun this script with --install-cert-manager --tls"
8078
exit 1
8179
fi
8280
else
83-
# Check if cert-manager pods are running
84-
kubectl get pods -n cert-manager >/dev/null 2>&1
85-
if [[ $? -ne 0 ]]; then
86-
echo "ERROR: cert-manager namespace not found. cert-manager may not be properly installed."
87-
echo "Please install cert-manager first using the command above."
88-
exit 1
89-
fi
90-
9181
echo "cert-manager is installed ✓"
9282

9383
# Even if cert-manager is installed, make sure CRDs and webhook are ready

0 commit comments

Comments
 (0)