Skip to content

Commit

Permalink
Introduce Priority field in ServingRuntime (kubeflow#3031)
Browse files Browse the repository at this point in the history
* Introduce priority field

Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>

* Implement validator webhook

Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>

* Add v2 support and priority to servingruntime yaml

Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>

* Fix protocol version in serving runtime sorting and reverse sort the serving runtime

Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>

* Add v2 protocol support in servingruntime charts

Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>

* Add webhooks to helm chart

Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>

* Add tests

Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>

* make generate

Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>

* fix supported modelformat sort

Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>

* fix helm chart

Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>

* rebase master

Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>

* Make model name comparision case insensitive

Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>

* Resolve comments

Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>

---------

Signed-off-by: Sivanantham Chinnaiyan <sivanantham.chinnaiyan@ideas2it.com>
  • Loading branch information
sivanantha321 authored Sep 2, 2023
1 parent a994544 commit f7de5e6
Show file tree
Hide file tree
Showing 101 changed files with 3,574 additions and 1,063 deletions.
12 changes: 4 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ deploy: manifests
${KUSTOMIZE} edit remove resource certmanager/certificate.yaml; \
else ${KUSTOMIZE} edit add resource certmanager/certificate.yaml; fi;
${KUSTOMIZE} build config/default | kubectl apply -f -
kubectl wait --for=condition=ready pod -l control-plane=kserve-controller-manager -n kserve --timeout=300s
sleep 2
${KUSTOMIZE} build config/runtimes | kubectl apply -f -
if [ ${KSERVE_ENABLE_SELF_SIGNED_CA} != false ]; then ./hack/self-signed-ca.sh; fi;

deploy-dev: manifests
Expand All @@ -87,6 +90,7 @@ deploy-dev: manifests
${KUSTOMIZE} build config/overlays/development | kubectl apply -f -
# TODO: Add runtimes as part of default deployment
kubectl wait --for=condition=ready pod -l control-plane=kserve-controller-manager -n kserve --timeout=300s
sleep 2
${KUSTOMIZE} build config/runtimes | kubectl apply -f -
if [ ${KSERVE_ENABLE_SELF_SIGNED_CA} != false ]; then ./hack/self-signed-ca.sh; fi;

Expand Down Expand Up @@ -125,17 +129,9 @@ deploy-helm: manifests

undeploy: kustomize
${KUSTOMIZE} build config/default | kubectl delete -f -
kubectl delete validatingwebhookconfigurations.admissionregistration.k8s.io inferenceservice.serving.kserve.io
kubectl delete validatingwebhookconfigurations.admissionregistration.k8s.io trainedmodel.serving.kserve.io
kubectl delete validatingwebhookconfigurations.admissionregistration.k8s.io inferencegraph.serving.kserve.io
kubectl delete mutatingwebhookconfigurations.admissionregistration.k8s.io inferenceservice.serving.kserve.io

undeploy-dev: kustomize
${KUSTOMIZE} build config/overlays/development | kubectl delete -f -
kubectl delete validatingwebhookconfigurations.admissionregistration.k8s.io inferenceservice.serving.kserve.io
kubectl delete validatingwebhookconfigurations.admissionregistration.k8s.io trainedmodel.serving.kserve.io
kubectl delete validatingwebhookconfigurations.admissionregistration.k8s.io inferencegraph.serving.kserve.io
kubectl delete mutatingwebhookconfigurations.admissionregistration.k8s.io inferenceservice.serving.kserve.io

# Generate manifests e.g. CRD, RBAC etc.
manifests: controller-gen kustomize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,10 @@ spec:
type: boolean
name:
type: string
priority:
format: int32
minimum: 1
type: integer
version:
type: string
required:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,10 @@ spec:
type: boolean
name:
type: string
priority:
format: int32
minimum: 1
type: integer
version:
type: string
required:
Expand Down
29 changes: 28 additions & 1 deletion charts/kserve-resources/templates/clusterservingruntimes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ spec:
prometheus.kserve.io/path: "/metrics"
supportedModelFormats:
- name: lightgbm
version: "2"
version: "3"
autoSelect: true
priority: 1
protocolVersions:
- v1
- v2
containers:
- name: kserve-container
image: "{{ .Values.kserve.servingruntime.lgbserver.image }}:{{ .Values.kserve.servingruntime.lgbserver.tag }}"
Expand Down Expand Up @@ -42,15 +44,23 @@ spec:
- name: sklearn
version: "0"
autoSelect: true
priority: 1
- name: sklearn
version: "1"
autoSelect: true
priority: 2
- name: xgboost
version: "1"
autoSelect: true
priority: 2
- name: lightgbm
version: "3"
autoSelect: true
priority: 2
- name: mlflow
version: "1"
autoSelect: true
priority: 1
protocolVersions:
- v2
containers:
Expand Down Expand Up @@ -86,8 +96,10 @@ spec:
- name: paddle
version: "2"
autoSelect: true
priority: 1
protocolVersions:
- v1
- v2
containers:
- name: kserve-container
image: "{{ .Values.kserve.servingruntime.paddleserver.image }}:{{ .Values.kserve.servingruntime.paddleserver.tag }}"
Expand Down Expand Up @@ -116,11 +128,14 @@ spec:
- name: pmml
version: "3"
autoSelect: true
priority: 1
- name: pmml
version: "4"
autoSelect: true
priority: 1
protocolVersions:
- v1
- v2
containers:
- name: kserve-container
image: "{{ .Values.kserve.servingruntime.pmmlserver.image }}:{{ .Values.kserve.servingruntime.pmmlserver.tag }}"
Expand Down Expand Up @@ -149,8 +164,10 @@ spec:
- name: sklearn
version: "1"
autoSelect: true
priority: 1
protocolVersions:
- v1
- v2
containers:
- name: kserve-container
image: "{{ .Values.kserve.servingruntime.sklearnserver.image }}:{{ .Values.kserve.servingruntime.sklearnserver.tag }}"
Expand Down Expand Up @@ -179,9 +196,11 @@ spec:
- name: tensorflow
version: "1"
autoSelect: true
priority: 2
- name: tensorflow
version: "2"
autoSelect: true
priority: 2
protocolVersions:
- v1
- grpc-v1
Expand Down Expand Up @@ -216,6 +235,7 @@ spec:
- name: pytorch
version: "1"
autoSelect: true
priority: 2
protocolVersions:
- v1
- v2
Expand Down Expand Up @@ -252,20 +272,25 @@ spec:
- name: tensorrt
version: "8"
autoSelect: true
priority: 1
- name: tensorflow
version: "1"
autoSelect: true
priority: 1
- name: tensorflow
version: "2"
autoSelect: true
priority: 1
- name: onnx
version: "1"
autoSelect: true
priority: 1
- name: pytorch
version: "1"
- name: triton
version: "2"
autoSelect: true
priority: 1
protocolVersions:
- v2
- grpc-v2
Expand Down Expand Up @@ -300,8 +325,10 @@ spec:
- name: xgboost
version: "1"
autoSelect: true
priority: 1
protocolVersions:
- v1
- v2
containers:
- name: kserve-container
image: "{{ .Values.kserve.servingruntime.xgbserver.image }}:{{ .Values.kserve.servingruntime.xgbserver.tag }}"
Expand Down
58 changes: 58 additions & 0 deletions charts/kserve-resources/templates/webhookconfiguration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,3 +138,61 @@ webhooks:
- UPDATE
resources:
- inferencegraphs
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
creationTimestamp: null
name: clusterservingruntime.serving.kserve.io
annotations:
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/serving-cert
webhooks:
- clientConfig:
caBundle: Cg==
service:
name: kserve-webhook-server-service
namespace: {{ .Release.Namespace }}
path: /validate-serving-kserve-io-v1alpha1-clusterservingruntime
failurePolicy: Fail
name: clusterservingruntime.kserve-webhook-server.validator
sideEffects: None
admissionReviewVersions: ["v1beta1"]
rules:
- apiGroups:
- serving.kserve.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- clusterservingruntimes
---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
creationTimestamp: null
name: servingruntime.serving.kserve.io
annotations:
cert-manager.io/inject-ca-from: {{ .Release.Namespace }}/serving-cert
webhooks:
- clientConfig:
caBundle: Cg==
service:
name: kserve-webhook-server-service
namespace: {{ .Release.Namespace }}
path: /validate-serving-kserve-io-v1alpha1-servingruntime
failurePolicy: Fail
name: servingruntime.kserve-webhook-server.validator
sideEffects: None
admissionReviewVersions: ["v1beta1"]
rules:
- apiGroups:
- serving.kserve.io
apiVersions:
- v1alpha1
operations:
- CREATE
- UPDATE
resources:
- servingruntimes
16 changes: 16 additions & 0 deletions cmd/agent/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2023 The KServe Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package main

import (
Expand Down
8 changes: 8 additions & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
Copyright 2023 The KServe Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -27,6 +28,7 @@ import (
"github.com/kserve/kserve/pkg/controller/v1alpha1/trainedmodel/reconcilers/modelconfig"
v1beta1controller "github.com/kserve/kserve/pkg/controller/v1beta1/inferenceservice"
"github.com/kserve/kserve/pkg/webhook/admission/pod"
"github.com/kserve/kserve/pkg/webhook/admission/servingruntime"
istio_networking "istio.io/api/networking/v1alpha3"
"istio.io/client-go/pkg/apis/networking/v1alpha3"
v1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -220,6 +222,12 @@ func main() {
log.Info("registering webhooks to the webhook server")
hookServer.Register("/mutate-pods", &webhook.Admission{Handler: &pod.Mutator{}})

log.Info("registering cluster serving runtime validator webhook to the webhook server")
hookServer.Register("/validate-serving-kserve-io-v1alpha1-clusterservingruntime", &webhook.Admission{Handler: &servingruntime.ClusterServingRuntimeValidator{}})

log.Info("registering serving runtime validator webhook to the webhook server")
hookServer.Register("/validate-serving-kserve-io-v1alpha1-servingruntime", &webhook.Admission{Handler: &servingruntime.ServingRuntimeValidator{}})

if err = ctrl.NewWebhookManagedBy(mgr).
For(&v1alpha1.TrainedModel{}).
Complete(); err != nil {
Expand Down
16 changes: 16 additions & 0 deletions cmd/manager/main_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2023 The KServe Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package main

import (
Expand Down
16 changes: 16 additions & 0 deletions cmd/router/main_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2023 The KServe Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package main

import (
Expand Down
1 change: 1 addition & 0 deletions cmd/spec-gen/main.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/*
Copyright 2023 The KServe Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
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 @@ -1132,6 +1132,10 @@ spec:
type: boolean
name:
type: string
priority:
format: int32
minimum: 1
type: integer
version:
type: string
required:
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 @@ -1132,6 +1132,10 @@ spec:
type: boolean
name:
type: string
priority:
format: int32
minimum: 1
type: integer
version:
type: string
required:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
name: clusterservingruntime.serving.kserve.io
annotations:
cert-manager.io/inject-ca-from: $(kserveNamespace)/serving-cert
webhooks:
- name: clusterservingruntime.kserve-webhook-server.validator
Loading

0 comments on commit f7de5e6

Please sign in to comment.