Fix route creation to work across different OpenShift clusters
This commit is contained in:
@@ -10,13 +10,14 @@ metadata:
|
||||
haproxy.router.openshift.io/timeout: "300s"
|
||||
haproxy.router.openshift.io/rate-limit: "100"
|
||||
spec:
|
||||
host: oru.apps.shrocp4upi419ovn.lab.upshift.rdu2.redhat.com
|
||||
# Let OpenShift generate the host automatically for different clusters
|
||||
to:
|
||||
kind: Service
|
||||
name: resource-governance-service
|
||||
weight: 100
|
||||
port:
|
||||
targetPort: http
|
||||
path: /
|
||||
tls:
|
||||
termination: edge
|
||||
insecureEdgeTerminationPolicy: Redirect
|
||||
|
||||
@@ -66,9 +66,9 @@ oc apply -f k8s/deployment.yaml
|
||||
echo -e "${YELLOW}Applying Service...${NC}"
|
||||
oc apply -f k8s/service.yaml
|
||||
|
||||
# Apply Route
|
||||
echo -e "${YELLOW}Applying Route...${NC}"
|
||||
oc apply -f k8s/route.yaml
|
||||
# Create Route (let OpenShift generate host automatically)
|
||||
echo -e "${YELLOW}Creating Route...${NC}"
|
||||
oc expose service resource-governance-service -n $NAMESPACE --name=resource-governance-route --path=/
|
||||
|
||||
# Wait for deployment to be ready
|
||||
echo -e "${YELLOW}Waiting for deployment to be ready...${NC}"
|
||||
@@ -92,9 +92,10 @@ echo -e "${YELLOW}Getting application URL...${NC}"
|
||||
# Wait a bit to ensure route is ready
|
||||
sleep 5
|
||||
|
||||
# Check if route exists
|
||||
# Check if route exists and get URL
|
||||
if oc get route resource-governance-route -n $NAMESPACE > /dev/null 2>&1; then
|
||||
ROUTE_URL=$(oc get route resource-governance-route -n $NAMESPACE -o jsonpath='{.spec.host}')
|
||||
echo -e "${GREEN}SUCCESS: Route created with host: $ROUTE_URL${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}WARNING: Route not found, checking available routes...${NC}"
|
||||
oc get routes -n $NAMESPACE
|
||||
|
||||
@@ -208,10 +208,10 @@ print_status "Step 9: Applying Service..."
|
||||
oc apply -f "$K8S_DIR/service.yaml"
|
||||
print_success "Service applied successfully"
|
||||
|
||||
# Step 10: Apply Route (use the correct route from manifests)
|
||||
print_status "Step 10: Applying Route..."
|
||||
oc apply -f "$K8S_DIR/route.yaml"
|
||||
print_success "Route 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"
|
||||
|
||||
# Step 11: Get application URL
|
||||
print_status "Step 11: Getting application URL..."
|
||||
|
||||
Reference in New Issue
Block a user