Skip to content

Commit 245c235

Browse files
Copilotphrocker
andcommitted
Fix OAuth2 TLS consistency and simplify ingress template
Co-authored-by: phrocker <[email protected]>
1 parent 9da2b08 commit 245c235

File tree

3 files changed

+18
-55
lines changed

3 files changed

+18
-55
lines changed

ops-scripts/local/deploy-helm.sh

Lines changed: 4 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -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"
@@ -69,47 +72,6 @@ fi
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
11476
if [[ "$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"

sentrius-chart/templates/ingress.yaml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,15 @@ metadata:
55
name: managed-cert-ingress-{{ .Values.tenant }}
66
namespace: {{ .Values.tenant }}
77
annotations:
8-
{{- if eq .Values.environment "gke" }}
9-
{{- range $key, $value := .Values.ingress.annotations.gke }}
10-
{{ $key }}: "{{ $value }}"
11-
{{- end }}
12-
{{- else if eq .Values.environment "aws" }}
13-
{{- range $key, $value := .Values.ingress.annotations.aws }}
14-
{{ $key }}: "{{ $value }}"
15-
{{- end }}
16-
{{- else if eq .Values.environment "local" }}
17-
{{- range $key, $value := .Values.ingress.annotations.local }}
18-
{{ $key }}: "{{ $value }}"
8+
{{- with .Values.ingress.annotations }}
9+
{{- toYaml . | nindent 4 }}
1910
{{- end }}
11+
{{- if .Values.certificates.enabled }}
12+
nginx.ingress.kubernetes.io/ssl-redirect: "true"
13+
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
14+
{{- else }}
15+
nginx.ingress.kubernetes.io/ssl-redirect: "false"
16+
nginx.ingress.kubernetes.io/force-ssl-redirect: "false"
2017
{{- end }}
2118
spec:
2219
{{- if .Values.ingress.tlsEnabled }}

sentrius-chart/values.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,10 @@ ingress:
208208
class: "nginx" # Default for local; override for GKE/AWS
209209
tlsEnabled: true # Enable TLS when supported
210210
annotations:
211+
kubernetes.io/ingress.class: nginx
212+
nginx.ingress.kubernetes.io/backend-protocol: HTTP
213+
# Environment-specific annotation sets (use via --set-file or values override)
214+
annotationSets:
211215
gke: # GKE-specific annotations
212216
kubernetes.io/ingress.class: gce
213217
networking.gke.io/managed-certificates: wildcard-cert
@@ -219,8 +223,8 @@ ingress:
219223
alb.ingress.kubernetes.io/ssl-redirect: "443"
220224
local: # Local environment annotations (e.g., Minikube)
221225
kubernetes.io/ingress.class: nginx
222-
nginx.ingress.kubernetes.io/ssl-redirect: "{{ .Values.certificates.enabled | quote }}"
223-
nginx.ingress.kubernetes.io/force-ssl-redirect: "{{ .Values.certificates.enabled | quote }}"
226+
nginx.ingress.kubernetes.io/ssl-redirect: "{{ .Values.certificates.enabled }}"
227+
nginx.ingress.kubernetes.io/force-ssl-redirect: "{{ .Values.certificates.enabled }}"
224228
nginx.ingress.kubernetes.io/backend-protocol: "HTTP"
225229

226230

0 commit comments

Comments
 (0)