Skip to content

Commit

Permalink
Update Serving Runtime Config (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
VaishnaviHire authored and lucferbux committed Jan 20, 2023
1 parent 2144eda commit 519809e
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
23 changes: 23 additions & 0 deletions deploy.sh
Expand Up @@ -101,6 +101,25 @@ function oc::object::safe::to::apply() {
return 0
}

function add_servingruntime_config() {
# Get OpenVino image from latest CSV
openvino_img=$(oc get csv -l operators.coreos.com/rhods-operator.redhat-ods-operator -n $ODH_OPERATOR_PROJECT -o=jsonpath='{.items[-1].spec.install.spec.deployments[?(@.name == "rhods-operator")].spec.template.spec.containers[?(@.name == "rhods-operator")].env[?(@.name == "RELATED_IMAGE_ODH_OPENVINO_IMAGE")].value}')
# Replace image
sed -i "s|<openvino_image>|${openvino_img}|g" model-mesh/serving_runtime_config.yaml

exists=$(oc get -n $ODH_PROJECT configmap/servingruntimes-config -o name | grep configmap/servingruntimes-config || echo "false")
if [ "$exists" == "false" ]; then
return 0
else
openvino_exists=$(oc get -n $ODH_PROJECT configmap/servingruntimes-config -o jsonpath='{.data}' | grep "default-config" || echo "false")
if [ "$openvino_exists" != "false" ]; then
return 0
fi
fi
return 1

}

ODH_PROJECT=${ODH_CR_NAMESPACE:-"redhat-ods-applications"}
ODH_MONITORING_PROJECT=${ODH_MONITORING_NAMESPACE:-"redhat-ods-monitoring"}
ODH_NOTEBOOK_PROJECT=${ODH_NOTEBOOK_NAMESPACE:-"rhods-notebooks"}
Expand Down Expand Up @@ -308,6 +327,10 @@ sed -i "s/<etcd_password>/${ETC_ROOT_PSW}/g" model-mesh/etcd-users.yaml
oc create -n ${ODH_PROJECT} -f model-mesh/etcd-secrets.yaml || echo "WARN: Model Mesh serving etcd connection secret was not created successfully."
oc create -n ${ODH_PROJECT} -f model-mesh/etcd-users.yaml || echo "WARN: Etcd user secret was not created successfully."

# Configure Serving Runtime resources
if add_servingruntime_config; then
oc apply -f model-mesh/serving_runtime_config.yaml -n $ODH_PROJECT
fi

# Add segment.io secret key & configmap
oc apply -n ${ODH_PROJECT} -f monitoring/segment-key-secret.yaml
Expand Down
54 changes: 54 additions & 0 deletions model-mesh/serving_runtime_config.yaml
@@ -0,0 +1,54 @@
kind: ConfigMap
apiVersion: v1
metadata:
name: servingruntimes-config
data:
default-config: |
apiVersion: serving.kserve.io/v1alpha1
kind: ServingRuntime
metadata:
# metadata will be overwritten by the model's metadata
name: ''
namespace: ''
labels:
name: ''
opendatahub.io/dashboard: 'true'
annotations: {}
spec:
supportedModelFormats:
- name: openvino_ir
version: opset1
autoSelect: true
- name: onnx
version: '1'
autoSelect: true
# replicas will be overwritten by the model's replica
replicas: 1
protocolVersions:
- grpc-v1
multiModel: true
grpcEndpoint: 'port:8085'
grpcDataEndpoint: 'port:8001'
containers:
- name: ovms
image: <openvino_image>
args:
- '--port=8001'
- '--rest_port=8888'
- '--config_path=/models/model_config_list.json'
- '--file_system_poll_wait_seconds=0'
- '--grpc_bind_address=127.0.0.1'
- '--rest_bind_address=127.0.0.1'
resources:
# resources will be overwritten by the model's resource
requests:
cpu: 1
memory: 2
limits:
cpu: 1
memory: 2
builtInAdapter:
serverType: ovms
runtimeManagementPort: 8888
memBufferBytes: 134217728
modelLoadingTimeoutMillis: 90000

0 comments on commit 519809e

Please sign in to comment.