Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add sanity check on regex match results while determining runtime image #245

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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