File tree Expand file tree Collapse file tree 3 files changed +47
-4
lines changed
Expand file tree Collapse file tree 3 files changed +47
-4
lines changed Original file line number Diff line number Diff line change @@ -543,6 +543,36 @@ function not_valid_ip {
543543}
544544export -f not_valid_ip
545545
546+ function validate_dns_name {
547+ local dns_name=" $1 "
548+ # Regex for a valid DNS name (FQDN)
549+ # - Must be between 1 and 253 characters long (inclusive)
550+ # - Labels separated by dots
551+ # - Each label must start and end with an alphanumeric character
552+ # - Labels can contain hyphens, but not at the beginning or end
553+ # - TLD must be at least 2 characters long
554+ local regex=" ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$"
555+
556+ if [[ " $dns_name " =~ $regex ]]; then
557+ # Check overall length
558+ if (( ${# dns_name} >= 1 && ${# dns_name} <= 253 )) ; then
559+ # Check label length (each label max 63 chars)
560+ IFS=' .' read -ra labels <<< " $dns_name"
561+ for label in " ${labels[@]} " ; do
562+ if (( ${# label} == 0 || ${# label} > 63 )) ; then
563+ return 1
564+ fi
565+ done
566+ return 0
567+ else
568+ return 1
569+ fi
570+ else
571+ return 1
572+ fi
573+ }
574+ export -f validate_dns_name
575+
546576function get_rand_string {
547577 if [[ -x $( command -v openssl) ]]; then
548578 openssl rand -base64 4 | tr -dc ' a-zA-Z0-9' | tr ' [:upper:]' ' [:lower:]' | head -c 16
Original file line number Diff line number Diff line change 296296 if [[ -z $is_route ]]
297297 then
298298 announce " 📜 Exposing pods serving model ${model} as service..."
299- llmdbench_execute_cmd " ${LLMDBENCH_CONTROL_KCMD} --namespace ${LLMDBENCH_VLLM_COMMON_NAMESPACE} expose service/infra-${LLMDBENCH_VLLM_MODELSERVICE_RELEASE} -inference-gateway --target-port=${LLMDBENCH_VLLM_COMMON_INFERENCE_PORT} --name=${LLMDBENCH_VLLM_MODELSERVICE_RELEASE} -inference-gateway-route" ${LLMDBENCH_CONTROL_DRY_RUN} ${LLMDBENCH_CONTROL_VERBOSE}
299+ if [[ $LLMDBENCH_VLLM_MODELSERVICE_GATEWAY_CLASS_NAME == " istio" ]]; then
300+ llmdbench_execute_cmd " ${LLMDBENCH_CONTROL_KCMD} --namespace ${LLMDBENCH_VLLM_COMMON_NAMESPACE} expose service/infra-${LLMDBENCH_VLLM_MODELSERVICE_RELEASE} -inference-gateway-istio --target-port=${LLMDBENCH_VLLM_COMMON_INFERENCE_PORT} --name=${LLMDBENCH_VLLM_MODELSERVICE_RELEASE} -inference-gateway-route" ${LLMDBENCH_CONTROL_DRY_RUN} ${LLMDBENCH_CONTROL_VERBOSE}
301+ else
302+ llmdbench_execute_cmd " ${LLMDBENCH_CONTROL_KCMD} --namespace ${LLMDBENCH_VLLM_COMMON_NAMESPACE} expose service/infra-${LLMDBENCH_VLLM_MODELSERVICE_RELEASE} -inference-gateway --target-port=${LLMDBENCH_VLLM_COMMON_INFERENCE_PORT} --name=${LLMDBENCH_VLLM_MODELSERVICE_RELEASE} -inference-gateway-route" ${LLMDBENCH_CONTROL_DRY_RUN} ${LLMDBENCH_CONTROL_VERBOSE}
303+ fi
300304 announce " ✅ Service for pods service model ${model} created"
301305 fi
302306 announce " ✅ Model \" ${model} \" and associated service deployed."
Original file line number Diff line number Diff line change @@ -62,9 +62,18 @@ for model in ${LLMDBENCH_DEPLOY_MODEL_LIST//,/ }; do
6262 exit 1
6363 fi
6464
65- if [[ -z $( not_valid_ip ${service_ip} ) ]]; then
66- announce " ❌ Invalid IP (\" ${service_ip} \" ) for service/gateway \" ${service_name} \" !"
67- exit 1
65+ if [[ $LLMDBENCH_VLLM_MODELSERVICE_GATEWAY_CLASS_NAME == " istio" ]]; then
66+ $( validate_dns_name ${service_ip} )
67+ stat=$?
68+ if [[ $stat -ne 0 ]]; then
69+ announce " ❌ Invalid DNS name (\" ${service_ip} \" ) for service/gateway \" ${service_name} \" !"
70+ exit 1
71+ fi
72+ else
73+ if [[ -z $( not_valid_ip ${service_ip} ) ]]; then
74+ announce " ❌ Invalid IP (\" ${service_ip} \" ) for service/gateway \" ${service_name} \" !"
75+ exit 1
76+ fi
6877 fi
6978
7079 announce " 🚀 Testing service/gateway \" ${service_name} \" (\" ${service_ip} \" ) (port 80)..."
You can’t perform that action at this time.
0 commit comments