Skip to content

Commit

Permalink
added protocolversion in servingruntime spec (kubeflow#2118)
Browse files Browse the repository at this point in the history
* added protocolversion in servingruntime spec

Signed-off-by: Suresh Nakkeran <suresh.n@ideas2it.com>

* allow a list of protocol versions in servingruntime

Signed-off-by: Suresh Nakkeran <suresh.n@ideas2it.com>

* 1. added logic to list runtimes order by protocol v1, created timestamp and name
2. removed predictor protocolversion default to v1

Signed-off-by: Suresh Nakkeran <suresh.n@ideas2it.com>

* added protocolversion grpc-v1, grpc-v2 and updated protocol version sorting logic

Signed-off-by: Suresh Nakkeran <suresh.n@ideas2it.com>

* updated openapi, swagger

Signed-off-by: Suresh Nakkeran <suresh.n@ideas2it.com>
  • Loading branch information
Suresh-Nakkeran authored Apr 14, 2022
1 parent 7b67a38 commit aa2bf63
Show file tree
Hide file tree
Showing 24 changed files with 393 additions and 190 deletions.
4 changes: 4 additions & 0 deletions config/crd/serving.kserve.io_clusterservingruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,10 @@ spec:
additionalProperties:
type: string
type: object
protocolVersions:
items:
type: string
type: array
replicas:
type: integer
storageHelper:
Expand Down
4 changes: 4 additions & 0 deletions config/crd/serving.kserve.io_servingruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1038,6 +1038,10 @@ spec:
additionalProperties:
type: string
type: object
protocolVersions:
items:
type: string
type: array
replicas:
type: integer
storageHelper:
Expand Down
2 changes: 2 additions & 0 deletions config/runtimes/kserve-lgbserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ spec:
- name: lightgbm
version: "2"
autoSelect: true
protocolVersions:
- v1
containers:
- name: kserve-container
image: kserve-lgbserver:replace
Expand Down
5 changes: 5 additions & 0 deletions config/runtimes/kserve-mlserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,18 @@ spec:
supportedModelFormats:
- name: sklearn
version: "0"
autoSelect: true
- name: xgboost
version: "1"
autoSelect: true
- name: lightgbm
version: "3"
autoSelect: true
- name: mlflow
version: "1"
autoSelect: true
protocolVersions:
- v2
containers:
- name: kserve-container
image: mlserver:replace
Expand Down
2 changes: 2 additions & 0 deletions config/runtimes/kserve-paddleserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ spec:
- name: paddle
version: "2"
autoSelect: true
protocolVersions:
- v1
containers:
- name: kserve-container
image: kserve-paddleserver:replace
Expand Down
2 changes: 2 additions & 0 deletions config/runtimes/kserve-pmmlserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ spec:
- name: pmml
version: "4"
autoSelect: true
protocolVersions:
- v1
containers:
- name: kserve-container
image: kserve-pmmlserver:replace
Expand Down
2 changes: 2 additions & 0 deletions config/runtimes/kserve-sklearnserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ spec:
- name: sklearn
version: "1"
autoSelect: true
protocolVersions:
- v1
containers:
- name: kserve-container
image: kserve-sklearnserver:replace
Expand Down
3 changes: 3 additions & 0 deletions config/runtimes/kserve-tensorflow-serving.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ spec:
- name: tensorflow
version: "2"
autoSelect: true
protocolVersions:
- v1
- grpc-v1
containers:
- name: kserve-container
image: tensorflow-serving:replace
Expand Down
4 changes: 4 additions & 0 deletions config/runtimes/kserve-torchserve.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ spec:
- name: pytorch
version: "1"
autoSelect: true
protocolVersions:
- v1
- v2
- grpc-v1
containers:
- name: kserve-container
image: kserve-torchserve:replace
Expand Down
6 changes: 6 additions & 0 deletions config/runtimes/kserve-tritonserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ spec:
supportedModelFormats:
- name: tensorrt
version: "8"
autoSelect: true
- name: tensorflow
version: "1"
autoSelect: true
- name: tensorflow
version: "2"
autoSelect: true
- name: onnx
version: "1"
autoSelect: true
Expand All @@ -18,6 +21,9 @@ spec:
- name: triton
version: "2"
autoSelect: true
protocolVersions:
- v2
- grpc-v2
containers:
- name: kserve-container
image: kserve-tritonserver:replace
Expand Down
2 changes: 2 additions & 0 deletions config/runtimes/kserve-xgbserver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ spec:
- name: xgboost
version: "1"
autoSelect: true
protocolVersions:
- v1
containers:
- name: kserve-container
image: kserve-xgbserver:replace
Expand Down
1 change: 1 addition & 0 deletions hack/violation_exceptions.list
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
API rule violation: list_type_missing,./pkg/apis/serving/v1alpha1,BuiltInAdapter,Env
API rule violation: list_type_missing,./pkg/apis/serving/v1alpha1,ServingRuntimePodSpec,Containers
API rule violation: list_type_missing,./pkg/apis/serving/v1alpha1,ServingRuntimePodSpec,Tolerations
API rule violation: list_type_missing,./pkg/apis/serving/v1alpha1,ServingRuntimeSpec,ProtocolVersions
API rule violation: list_type_missing,./pkg/apis/serving/v1alpha1,ServingRuntimeSpec,SupportedModelFormats
API rule violation: list_type_missing,./pkg/apis/serving/v1alpha1,TrainedModelList,Items
API rule violation: list_type_missing,./pkg/apis/serving/v1beta1,ComponentStatusSpec,Traffic
Expand Down
23 changes: 23 additions & 0 deletions pkg/apis/serving/v1alpha1/servingruntime_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1alpha1

import (
"github.com/kserve/kserve/pkg/constants"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
Expand Down Expand Up @@ -86,6 +87,10 @@ type ServingRuntimeSpec struct {
// +optional
Disabled *bool `json:"disabled,omitempty"`

// Supported protocol versions (i.e. v1 or v2 or grpc-v1 or grpc-v2)
// +optional
ProtocolVersions []constants.InferenceServiceProtocol `json:"protocolVersions,omitempty"`

ServingRuntimePodSpec `json:",inline"`

// The following fields apply to ModelMesh deployments.
Expand Down Expand Up @@ -200,6 +205,12 @@ type ClusterServingRuntimeList struct {
Items []ClusterServingRuntime `json:"items"`
}

// SupportedRuntime is the schema for supported runtime result of automatic selection
type SupportedRuntime struct {
Name string
Spec ServingRuntimeSpec
}

func init() {
SchemeBuilder.Register(&ServingRuntime{}, &ServingRuntimeList{})
SchemeBuilder.Register(&ClusterServingRuntime{}, &ClusterServingRuntimeList{})
Expand All @@ -212,3 +223,15 @@ func (srSpec *ServingRuntimeSpec) IsDisabled() bool {
func (srSpec *ServingRuntimeSpec) IsMultiModelRuntime() bool {
return srSpec.MultiModel != nil && *srSpec.MultiModel
}

func (srSpec *ServingRuntimeSpec) IsProtocolVersionSupported(modelProtocolVersion constants.InferenceServiceProtocol) bool {
if len(modelProtocolVersion) == 0 || srSpec.ProtocolVersions == nil || len(srSpec.ProtocolVersions) == 0 {
return true
}
for _, srProtocolVersion := range srSpec.ProtocolVersions {
if srProtocolVersion == modelProtocolVersion {
return true
}
}
return false
}
22 changes: 22 additions & 0 deletions pkg/apis/serving/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit aa2bf63

Please sign in to comment.