From 4301023a66c0f7fd42b4f85dd87baa6387fe0c80 Mon Sep 17 00:00:00 2001 From: andersonid Date: Sat, 4 Oct 2025 11:35:39 -0300 Subject: [PATCH] Add automatic TLS configuration to routes - Fix oc expose service not configuring TLS by default - Add oc patch command to configure TLS after route creation - Ensures routes work properly with HTTPS in all clusters - Applied to both deploy-complete.sh and deploy-s2i.sh --- scripts/deploy-complete.sh | 4 ++++ scripts/deploy-s2i.sh | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/deploy-complete.sh b/scripts/deploy-complete.sh index 2fe1f2e..49521a0 100755 --- a/scripts/deploy-complete.sh +++ b/scripts/deploy-complete.sh @@ -70,6 +70,10 @@ oc apply -f k8s/service.yaml echo -e "${YELLOW}Creating Route...${NC}" oc expose service resource-governance-service -n $NAMESPACE --name=resource-governance-route --path=/ +# Configure TLS for the route +echo -e "${YELLOW}Configuring TLS for Route...${NC}" +oc patch route resource-governance-route -n $NAMESPACE -p '{"spec":{"tls":{"termination":"edge","insecureEdgeTerminationPolicy":"Redirect"}}}' + # Wait for deployment to be ready echo -e "${YELLOW}Waiting for deployment to be ready...${NC}" oc rollout status deployment/resource-governance -n $NAMESPACE --timeout=300s diff --git a/scripts/deploy-s2i.sh b/scripts/deploy-s2i.sh index 6499c2c..0d42713 100755 --- a/scripts/deploy-s2i.sh +++ b/scripts/deploy-s2i.sh @@ -211,7 +211,11 @@ print_success "Service applied successfully" # Step 10: Create Route (let OpenShift generate host automatically) print_status "Step 10: Creating Route..." oc expose service resource-governance-service -n "$NAMESPACE" --name=resource-governance-route --path=/ -print_success "Route created successfully" + +# Configure TLS for the route +print_status "Step 10a: Configuring TLS for Route..." +oc patch route resource-governance-route -n "$NAMESPACE" -p '{"spec":{"tls":{"termination":"edge","insecureEdgeTerminationPolicy":"Redirect"}}}' +print_success "Route created and configured successfully" # Step 11: Get application URL print_status "Step 11: Getting application URL..."