Skip to content

Commit

Permalink
Merge pull request #245 from VedantMahabaleshwarkar/eng-10286
Browse files Browse the repository at this point in the history
add sanity check on regex match results while determining runtime image
  • Loading branch information
openshift-merge-bot[bot] authored Jul 25, 2024
2 parents 21747c9 + 00e21c4 commit 7a14b20
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions controllers/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ const (
TgisImageName = "text-generation-inference"
VllmImageName = "vllm"
CaikitImageName = "caikit-nlp"
ServingRuntimeFallBackImageName = "unsupported"
)

// openshift
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func (r *KserveMetricsDashboardReconciler) Reconcile(ctx context.Context, log lo
func (r *KserveMetricsDashboardReconciler) createDesiredResource(ctx context.Context, log logr.Logger, isvc *kservev1beta1.InferenceService) (*corev1.ConfigMap, error) {

var err error
var servingRuntime string
runtime := &kservev1alpha1.ServingRuntime{}
supported := false
// resolve SR
Expand Down Expand Up @@ -125,7 +126,12 @@ func (r *KserveMetricsDashboardReconciler) createDesiredResource(ctx context.Con
servingRuntimeImage := runtime.Spec.Containers[0].Image
re := regexp.MustCompile(`/([^/@]+)[@:]`)
findImageName := re.FindStringSubmatch(servingRuntimeImage)
servingRuntime := findImageName[1]
// sanity check for regex match, will fall back to a known string that will lead to a configmap for unsupported metrics
if len(findImageName) < 2 {
servingRuntime = constants.ServingRuntimeFallBackImageName
} else {
servingRuntime = findImageName[1]
}

runtimeMetricsData := map[string]string{
constants.OvmsImageName: constants.OvmsMetricsData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
- '--model_name={{.Name}}'
- '--model_dir=/mnt/models'
- '--http_port=8080'
image: 'kserve/unsupportedimage:v0.12.1'
image: 'kserve/dummy-sklearn-server' #This image does not exist.
name: kserve-container
resources:
limits:
Expand Down

0 comments on commit 7a14b20

Please sign in to comment.