Skip to content

Commit 46edb15

Browse files
Improve scrit, removed dynamic AWS ELB address retrieving and added openshif route retrieving
1 parent b9f038a commit 46edb15

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

scripts/verify-models-and-limits.sh

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,31 @@ MAGENTA='\033[0;35m'
1010
NC='\033[0m' # No Color
1111

1212
if [ -z "${GATEWAY_URL:-}" ]; then
13-
HOST=$(kubectl get gateway openshift-ai-inference -n openshift-ingress -o jsonpath='{.status.addresses[0].value}')
14-
if [ -z "$HOST" ]; then
15-
echo "Failed to resolve gateway host; set GATEWAY_URL explicitly." >&2
16-
exit 1
13+
# For OpenShift, use the route instead of the AWS ELB
14+
if command -v oc &> /dev/null; then
15+
CLUSTER_DOMAIN=$(oc get ingresses.config.openshift.io cluster -o jsonpath='{.spec.domain}' 2>/dev/null)
16+
if [ -n "$CLUSTER_DOMAIN" ]; then
17+
GATEWAY_URL="https://gateway.${CLUSTER_DOMAIN}"
18+
fi
19+
fi
20+
21+
# Fallback to gateway status address if OpenShift route not available
22+
if [ -z "${GATEWAY_URL:-}" ]; then
23+
HOST=$(kubectl get gateway openshift-ai-inference -n openshift-ingress -o jsonpath='{.status.addresses[0].value}')
24+
if [ -z "$HOST" ]; then
25+
echo "Failed to resolve gateway host; set GATEWAY_URL explicitly." >&2
26+
exit 1
27+
fi
28+
GATEWAY_URL="https://${HOST}"
1729
fi
18-
GATEWAY_URL="https://${HOST}"
1930
fi
2031

2132
echo -e "${CYAN}======================================${NC}"
2233
echo -e "${CYAN} Model Inference & Rate Limit Test ${NC}"
2334
echo -e "${CYAN}======================================${NC}"
2435
echo ""
36+
echo -e "${BLUE}Gateway URL:${NC} $GATEWAY_URL"
37+
echo ""
2538

2639
# Step 1: Create a test service account and get token
2740
echo -e "${BLUE}Step 1: Creating test service account and obtaining token...${NC}"
@@ -33,6 +46,11 @@ if [ -z "$TOKEN" ]; then
3346
exit 1
3447
fi
3548
echo -e "${GREEN}✓ Token obtained successfully${NC}"
49+
50+
# Check the user's tier (for debugging rate limits)
51+
SA_NAME=$(echo "$TOKEN" | cut -d. -f2 | base64 -d 2>/dev/null | jq -r '.["kubernetes.io"].serviceaccount.name' 2>/dev/null || echo "unknown")
52+
echo -e "${CYAN}Service Account:${NC} $SA_NAME"
53+
echo -e "${CYAN}Note:${NC} Service accounts without group membership get minimal rate limits"
3654
echo ""
3755

3856
# Function to test a model
@@ -207,7 +225,13 @@ if [ "$http_status" = "200" ] || [ "$total_success" -gt 0 ]; then
207225
echo -e "${YELLOW}${NC} Token rate limiting not triggered (may need adjustment)"
208226
fi
209227
else
210-
echo -e "${RED}${NC} There were issues accessing the models"
228+
if [ "$rate_limited" = true ]; then
229+
echo -e "${YELLOW}${NC} Models are accessible but rate limits are very restrictive"
230+
echo -e "${GREEN}${NC} Token authentication is working"
231+
echo -e "${GREEN}${NC} Token rate limiting is enforced (very strict for service accounts)"
232+
else
233+
echo -e "${RED}${NC} There were issues accessing the models"
234+
fi
211235
fi
212236

213237
echo ""

0 commit comments

Comments
 (0)