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

refactor kfserving and upgrade api to latest #701

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ Library
sdk/arena-python-sdk/dist/
sdk/arena-python-sdk/build/
sdk/arena-python-sdk/arenasdk.egg-info/
__pycache__
__pycache__
vendor
57 changes: 6 additions & 51 deletions charts/kfserving/templates/inferenceservice.yaml
Original file line number Diff line number Diff line change
@@ -1,54 +1,9 @@
{{- $gpuCount := .Values.gpuCount -}}
apiVersion: serving.kubeflow.org/v1alpha2
kind: InferenceService
apiVersion: "serving.kserve.io/v1beta1"
kind: "InferenceService"
metadata:
annotations:
{{- range $key, $value := .Values.annotations }}
{{ $key }}: {{ $value | quote }}
{{- end }}
labels:
controller-tools.k8s.io: "1.0"
serviceName: "{{ .Values.servingName }}"
servingType: "kf-serving"
servingName: "{{ .Values.servingName }}"
servingVersion: "{{ .Values.servingVersion }}"
{{- range $key, $value := .Values.labels }}
{{ $key }}: {{ $value | quote }}
{{- end }}
name: {{ .Release.Name }}
spec:
default:
predictor:
{{ .Values.modelType }}:
storageUri: {{ .Values.storageUri }}
container:
name: {{ .Release.Name }}
image: "{{ .Values.image }}"
imagePullPolicy: "{{ .Values.imagePullPolicy }}"
{{- if .Values.command }}
command: { .Values.command }}
{{- end }}
ports:
- containerPort: {{ .Values.port }}
protocol: "TCP"
resources:
limits:
{{- if .Values.cpu }}
cpu: {{ .Values.cpu }}
{{- end }}
{{- if .Values.memory }}
memory: {{ .Values.memory }}
{{- end }}
{{- if gt (int $gpuCount) 0}}
nvidia.com/gpu: {{ .Values.gpuCount }}
{{- end }}
requests:
{{- if .Values.cpu }}
cpu: {{ .Values.cpu }}
{{- end }}
{{- if .Values.memory }}
memory: {{ .Values.memory }}
{{- end }}
{{- if gt (int $gpuCount) 0}}
nvidia.com/gpu: {{ .Values.gpuCount }}
{{- end }}
predictor:
minReplicas: {{ .Values.minReplicas }}
{{ .Values.modelType }}:
storageUri: {{ .Values.storageUri }}
3 changes: 2 additions & 1 deletion charts/kfserving/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ image: codait/max-object-detector
cpu: 100m
memory: 1Gi
gpuCount: 0
storageUri: "hdfs://kfserving-samples/models/tensorflow/flowers-2"
storageUri: "gs://kfserving-samples/models/sklearn/iris"
canaryTrafficPercent: 0
command:
modelType: custom
minReplicas: 0

imagePullSecrets: []

Expand Down
2 changes: 1 addition & 1 deletion docs/serving/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If you want to use arena to manage serving jobs, this guide is for you. we have

## KFServing Job Guide

* I want to [submit a kfserving job whose type is custom](kfserving/custom.md).
* I want to [submit a kfserving job](kfserving/kserve.md).

## Seldon Core Serving Job Guide

Expand Down
70 changes: 0 additions & 70 deletions docs/serving/kfserving/custom.md

This file was deleted.

61 changes: 61 additions & 0 deletions docs/serving/kfserving/kserve.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# KFServing job

This guide walks through the steps to deploy and serve a model with kfserving

1\. Setup

Follow the [KFserving Guide](https://github.com/kubeflow/kfserving#install-kfserving) to install kFserving.For the prerequisites,you should ensure 8g memery and 4 core cpu avaliable in your environment.

2\. summit your serving job into kfserving

$ arena serve kfserving \
> --name=sklearn-demo \
> --storage-uri="https://github.com/tduffy000/kfserving-uri-examples/blob/master/sklearn/frozen/model.joblib?raw=true" \
> --model-type=sklearn
INFO[0000] The Job sklearn-demo has been submitted successfully
inferenceservice.serving.kserve.io/sklearn-demo-202110301430 created
INFO[0009] The Job sklearn-demo has been submitted successfully



3\. list the job you just serving

$ arena serve ls
NAME TYPE VERSION DESIRED AVAILABLE ADDRESS PORTS
sklearn-demo-202110301430 KFServing 1428228 0 0 N/A


4\. test the model service

step1: Determine the ingress IP and ports

The first step is to [determine the ingress IP](https://github.com/kubeflow/kfserving/blob/master/README.md#determine-the-ingress-ip-and-ports) and ports and set INGRESS_HOST and INGRESS_PORT.

This example uses the [codait/max-object-detector](https://github.com/IBM/MAX-Object-Detector) image. The Max Object Detector api server expects a POST request to the /model/predict endpoint that includes an image multipart/form-data and an optional threshold query string.

MODEL_NAME=sklearn-demo-202110301430
SERVICE_HOSTNAME=$(kubectl get inferenceservice ${MODEL_NAME} -o jsonpath='{.status.url}' | cut -d "/" -f 3)
INGRESS_HOST=localhost
INGRESS_PORT=80
curl -v -H "Host: ${SERVICE_HOSTNAME}" http://${INGRESS_HOST}:${INGRESS_PORT}/v1/models/$MODEL_NAME:predict -d '{"instances": [[6.8, 2.8, 4.8, 1.4],[6.0, 3.4, 4.5, 1.6]]}'

* Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 80 (#0)
> POST /v1/models/sklearn-demo-202110301430:predict HTTP/1.1
> Host: sklearn-demo-202110301430.default.example.com
> User-Agent: curl/7.64.1
> Accept: */*
> Content-Length: 64
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 64 out of 64 bytes
< HTTP/1.1 200 OK
< content-length: 23
< content-type: application/json; charset=UTF-8
< date: Sat, 30 Oct 2021 06:49:17 GMT
< server: istio-envoy
< x-envoy-upstream-service-time: 10
<
* Connection #0 to host localhost left intact
{"predictions": [1, 1]}* Closing connection 0
45 changes: 26 additions & 19 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,39 @@ module github.com/kubeflow/arena
go 1.12

require (
github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0
github.com/go-openapi/spec v0.19.3
github.com/docker/docker v20.10.7+incompatible
github.com/go-openapi/spec v0.20.2
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/protobuf v1.4.2
github.com/golang/protobuf v1.5.2
github.com/google/uuid v1.3.0
github.com/mitchellh/go-homedir v1.1.0
github.com/prometheus/client_golang v1.0.0
github.com/prometheus/common v0.4.1
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cobra v0.0.5
github.com/spf13/viper v1.7.1
github.com/stretchr/testify v1.4.0
github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 // indirect
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/common v0.26.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.2.1
github.com/spf13/viper v1.8.1
github.com/stretchr/testify v1.7.0
//github.com/stretchr/testify v1.4.0
gopkg.in/yaml.v2 v2.3.0
istio.io/api v0.0.0-20180824201241-76349c53b87f
k8s.io/api v0.18.6
k8s.io/apiextensions-apiserver v0.18.6
k8s.io/apimachinery v0.18.6
gopkg.in/yaml.v2 v2.4.0
istio.io/api v0.0.0-20200715212100-dbf5277541ef
k8s.io/api v0.21.4
k8s.io/apiextensions-apiserver v0.21.4
k8s.io/apimachinery v0.21.4
k8s.io/cli-runtime v0.18.5
k8s.io/client-go v0.18.6
k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6
k8s.io/kubectl v0.0.0
sigs.k8s.io/controller-runtime v0.6.5
k8s.io/client-go v11.0.1-0.20190805182717-6502b5e7b1b5+incompatible
k8s.io/code-generator v0.18.8
k8s.io/kube-openapi v0.0.0-20210305001622-591a79e4bda7
k8s.io/kubectl v0.17.2
knative.dev/pkg v0.0.0-20200922164940-4bf40ad82aab
knative.dev/serving v0.18.0
sigs.k8s.io/controller-runtime v0.7.0
)

replace (
golang.org/x/sys => golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6
github.com/go-openapi/spec => github.com/go-openapi/spec v0.19.4
github.com/swaggo/swag => github.com/swaggo/swag v1.6.7
golang.org/x/sys => golang.org/x/sys v0.0.0-20211013075003-97ac67df715c
k8s.io/api => k8s.io/api v0.18.5
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.18.5
k8s.io/apimachinery => k8s.io/apimachinery v0.18.5
Expand All @@ -44,6 +50,7 @@ replace (
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.18.5
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.18.5
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.18.5
k8s.io/kube-openapi => k8s.io/kube-openapi v0.0.0-20200410145947-bcb3869e6f29
k8s.io/kube-proxy => k8s.io/kube-proxy v0.18.5
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.18.5
k8s.io/kubectl => k8s.io/kubectl v0.18.5
Expand Down
Loading