File tree Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Expand file tree Collapse file tree 3 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,14 @@ INFERENCESERVICE_NAME=<your-inferenceservice-name>
103103
104104# KServe creates a headless service by default (no stable ClusterIP)
105105# Create a stable ClusterIP service for consistent routing
106+
107+ # Option 1: Using the template file (recommended)
108+ # Substitute variables and apply
109+ sed -e " s/{{INFERENCESERVICE_NAME}}/$INFERENCESERVICE_NAME /g" \
110+ -e " s/{{NAMESPACE}}/$NAMESPACE /g" \
111+ service-predictor-stable.yaml | oc apply -f - -n $NAMESPACE
112+
113+ # Option 2: Using heredoc
106114cat << EOF | oc apply -f - -n $NAMESPACE
107115apiVersion: v1
108116kind: Service
Original file line number Diff line number Diff line change @@ -212,7 +212,14 @@ if [ "$SKIP_VALIDATION" = false ]; then
212212
213213 # Create stable ClusterIP service for predictor (KServe creates headless service by default)
214214 echo " Creating stable ClusterIP service for predictor..."
215- cat << EOF | oc apply -f - -n "$NAMESPACE " > /dev/null 2>&1
215+
216+ # Use template file for stable service
217+ if [ -f " $SCRIPT_DIR /service-predictor-stable.yaml" ]; then
218+ substitute_vars " $SCRIPT_DIR /service-predictor-stable.yaml" " $TEMP_DIR /service-predictor-stable.yaml.tmp"
219+ oc apply -f " $TEMP_DIR /service-predictor-stable.yaml.tmp" -n " $NAMESPACE " > /dev/null 2>&1
220+ else
221+ # Fallback to inline creation if template not found
222+ cat << EOF | oc apply -f - -n "$NAMESPACE " > /dev/null 2>&1
216223apiVersion: v1
217224kind: Service
218225metadata:
@@ -233,6 +240,7 @@ spec:
233240 targetPort: 8080
234241 protocol: TCP
235242EOF
243+ fi
236244
237245 # Get the stable ClusterIP
238246 PREDICTOR_SERVICE_IP=$( oc get svc " ${INFERENCESERVICE_NAME} -predictor-stable" -n " $NAMESPACE " -o jsonpath=' {.spec.clusterIP}' 2> /dev/null || echo " " )
Original file line number Diff line number Diff line change 33apiVersion : v1
44kind : Service
55metadata :
6- name : {{INFERENCESERVICE_NAME}}-predictor-stable
7- namespace : {{NAMESPACE}}
6+ name : " {{INFERENCESERVICE_NAME}}-predictor-stable"
7+ namespace : " {{NAMESPACE}}"
88 labels :
9- app : {{INFERENCESERVICE_NAME}}
9+ app : " {{INFERENCESERVICE_NAME}}"
1010 component : predictor-stable
1111 annotations :
1212 description : " Stable ClusterIP service for semantic router to use (headless service doesn't provide ClusterIP)"
1313spec :
1414 type : ClusterIP
1515 selector :
16- serving.kserve.io/inferenceservice : {{INFERENCESERVICE_NAME}}
16+ serving.kserve.io/inferenceservice : " {{INFERENCESERVICE_NAME}}"
1717 ports :
1818 - name : http
1919 port : 8080
You can’t perform that action at this time.
0 commit comments