@@ -60,6 +60,9 @@ if ! kubectl get deployment cert-manager -n cert-manager >/dev/null 2>&1 || \
6060 echo " ERROR: Failed to install cert-manager with Helm"
6161 exit 1
6262 fi
63+ echo " Waiting for cert-manager to be ready..."
64+ kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=cert-manager -n cert-manager --timeout=300s
65+ kubectl wait --for=condition=ready pod -l app.kubernetes.io/name=webhook -n cert-manager --timeout=300s
6366 else
6467 echo " ERROR: cert-manager is not fully installed in your cluster."
6568 echo " You can install it manually or rerun this script with --install-cert-manager --tls"
6972
7073}
7174
72- # Function to wait for cert-manager CRDs and webhook to be ready
73- wait_for_cert_manager_crds () {
74- local max_attempts=30
75- local attempt=1
76-
77- while [[ $attempt -le $max_attempts ]]; do
78- # Check if Certificate CRD is available and webhook is ready
79- if kubectl get crd certificates.cert-manager.io > /dev/null 2>&1 && \
80- kubectl get crd clusterissuers.cert-manager.io > /dev/null 2>&1 ; then
81-
82- # Test if we can actually create cert-manager resources by doing a dry-run
83- echo " Testing cert-manager webhook readiness..."
84- kubectl create --dry-run=server -o yaml - << EOF >/dev/null 2>&1
85- apiVersion: cert-manager.io/v1
86- kind: ClusterIssuer
87- metadata:
88- name: test-issuer
89- spec:
90- selfSigned: {}
91- EOF
92- if [[ $? -eq 0 ]]; then
93- echo " cert-manager CRDs and webhook are ready ✓"
94- return 0
95- fi
96- fi
97-
98- echo " Waiting for cert-manager CRDs and webhook to be ready (attempt $attempt /$max_attempts )..."
99- sleep 10
100- (( attempt++ ))
101- done
102-
103- echo " ERROR: cert-manager CRDs or webhook are not ready after $(( max_attempts * 10 )) seconds"
104- echo " This may indicate an issue with cert-manager installation."
105- echo " "
106- echo " Try running these commands to check cert-manager status:"
107- echo " kubectl get pods -n cert-manager"
108- echo " kubectl logs -n cert-manager -l app.kubernetes.io/name=cert-manager"
109- echo " kubectl get crd | grep cert-manager"
110- exit 1
111- }
112-
11375# Configure TLS settings
11476if [[ " $ENABLE_TLS " == " true" ]]; then
11577 echo " Deploying with TLS enabled..."
@@ -118,7 +80,7 @@ if [[ "$ENABLE_TLS" == "true" ]]; then
11880 KEYCLOAK_SUBDOMAIN=" keycloak-${TENANT} .local"
11981 KEYCLOAK_HOSTNAME=" ${KEYCLOAK_SUBDOMAIN} "
12082 KEYCLOAK_DOMAIN=" https://${KEYCLOAK_SUBDOMAIN} "
121- KEYCLOAK_INTERNAL_DOMAIN=" https ://${KEYCLOAK_SUBDOMAIN} " # Internal cluster communication
83+ KEYCLOAK_INTERNAL_DOMAIN=" http ://sentrius-keycloak:8081 " # Internal cluster communication uses HTTP
12284 SENTRIUS_DOMAIN=" https://${SUBDOMAIN} "
12385 CERTIFICATES_ENABLED=" true"
12486 INGRESS_TLS_ENABLED=" true"
0 commit comments