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

[pull] master from kserve:master #276

Merged
merged 13 commits into from
Mar 22, 2024
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
2 changes: 1 addition & 1 deletion .github/actions/minikube-setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ runs:
- name: Setup Minikube
uses: medyagh/setup-minikube@latest
with:
minikube-version: '1.31.1'
minikube-version: '1.32.0'
kubernetes-version: 'v1.27.4'
driver: 'none'
network-plugin: 'cni'
Expand Down
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@
[![LICENSE](https://img.shields.io/github/license/kserve/kserve.svg)](https://github.com/kserve/kserve/blob/master/LICENSE)
[![Slack Status](https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack&style=social)](https://github.com/kserve/community/blob/main/README.md#questions-and-issues)

KServe provides a Kubernetes [Custom Resource Definition](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) for serving machine learning (ML) models on arbitrary frameworks. It aims to solve production model serving use cases by providing performant, high abstraction interfaces for common ML frameworks like Tensorflow, XGBoost, ScikitLearn, PyTorch, and ONNX.
KServe provides a Kubernetes [Custom Resource Definition](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) for serving predictive and generative machine learning (ML) models. It aims to solve production model serving use cases by providing high abstraction interfaces for Tensorflow, XGBoost, ScikitLearn, PyTorch, Huggingface Transformer/LLM models using standardized data plane protocols.

It encapsulates the complexity of autoscaling, networking, health checking, and server configuration to bring cutting edge serving features like GPU Autoscaling, Scale to Zero, and Canary Rollouts to your ML deployments. It enables a simple, pluggable, and complete story for Production ML Serving including prediction, pre-processing, post-processing and explainability. KServe is being [used across various organizations.](https://kserve.github.io/website/master/community/adopters/)

For more details, visit the [KServe website](https://kserve.github.io/website/).

![KServe](/docs/diagrams/kserve.png)
![KServe](/docs/diagrams/kserve_new.png)

_Since 0.7 [KFServing is rebranded to KServe](https://blog.kubeflow.org/release/official/2021/09/27/kfserving-transition.html), we still support the RTS release
[0.6.x](https://github.com/kserve/kserve/tree/release-0.6), please refer to corresponding release branch for docs_.
_Since 0.7 [KFServing is rebranded to KServe](https://blog.kubeflow.org/release/official/2021/09/27/kfserving-transition.html).

### Why KServe?
- KServe is a standard, cloud agnostic **Model Inference Platform** on Kubernetes, built for highly scalable use cases.
- Provides performant, **standardized inference protocol** across ML frameworks.
- KServe is a standard, cloud agnostic **Model Inference Platform** for serving predictive and generative AI models on Kubernetes, built for highly scalable use cases.
- Provides performant, **standardized inference protocol** across ML frameworks including OpenAI specification for generative models.
- Support modern **serverless inference workload** with **request based autoscaling including scale-to-zero** on **CPU and GPU**.
- Provides **high scalability, density packing and intelligent routing** using **ModelMesh**.
- **Simple and pluggable production serving** for **inference**, **pre/post processing**, **monitoring** and **explainability**.
Expand Down
6 changes: 0 additions & 6 deletions charts/kserve-resources/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ rules:
verbs:
- create
- get
- list
- update
- watch
- apiGroups:
- ""
resources:
Expand Down Expand Up @@ -102,18 +100,14 @@ rules:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- serviceaccounts
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand Down
61 changes: 30 additions & 31 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@ import (

"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"github.com/kserve/kserve/pkg/apis/serving/v1alpha1"
"github.com/kserve/kserve/pkg/apis/serving/v1beta1"
"github.com/kserve/kserve/pkg/constants"
graphcontroller "github.com/kserve/kserve/pkg/controller/v1alpha1/inferencegraph"
trainedmodelcontroller "github.com/kserve/kserve/pkg/controller/v1alpha1/trainedmodel"
"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/v1beta1"
istioclientv1beta1 "istio.io/client-go/pkg/apis/networking/v1beta1"
v1 "k8s.io/api/core/v1"
Expand All @@ -42,13 +33,22 @@ import (
"k8s.io/client-go/tools/record"
knservingv1 "knative.dev/serving/pkg/apis/serving/v1"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/manager/signals"
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

"github.com/kserve/kserve/pkg/apis/serving/v1alpha1"
"github.com/kserve/kserve/pkg/apis/serving/v1beta1"
"github.com/kserve/kserve/pkg/constants"
graphcontroller "github.com/kserve/kserve/pkg/controller/v1alpha1/inferencegraph"
trainedmodelcontroller "github.com/kserve/kserve/pkg/controller/v1alpha1/trainedmodel"
"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"
)

var (
Expand Down Expand Up @@ -112,6 +112,13 @@ func main() {
os.Exit(1)
}

// Setup clientset to directly talk to the api server
clientSet, err := kubernetes.NewForConfig(cfg)
if err != nil {
setupLog.Error(err, "unable to create clientSet")
os.Exit(1)
}

// Create a new Cmd to provide shared dependencies and start components
setupLog.Info("Setting up manager")
mgr, err := manager.New(cfg, manager.Options{
Expand Down Expand Up @@ -142,17 +149,12 @@ func main() {
os.Exit(1)
}

kubeClient, err := client.New(mgr.GetConfig(), client.Options{Scheme: mgr.GetScheme()})
if err != nil {
setupLog.Error(err, "unable to create new client.")
}

deployConfig, err := v1beta1.NewDeployConfig(kubeClient)
deployConfig, err := v1beta1.NewDeployConfig(clientSet)
if err != nil {
setupLog.Error(err, "unable to get deploy config.")
os.Exit(1)
}
ingressConfig, err := v1beta1.NewIngressConfig(kubeClient)
ingressConfig, err := v1beta1.NewIngressConfig(clientSet)
if err != nil {
setupLog.Error(err, "unable to get ingress config.")
os.Exit(1)
Expand Down Expand Up @@ -181,16 +183,12 @@ func main() {
// Setup all Controllers
setupLog.Info("Setting up v1beta1 controller")
eventBroadcaster := record.NewBroadcaster()
clientSet, err := kubernetes.NewForConfig(mgr.GetConfig())
if err != nil {
setupLog.Error(err, "unable to create clientSet")
os.Exit(1)
}
eventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: clientSet.CoreV1().Events("")})
if err = (&v1beta1controller.InferenceServiceReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("v1beta1Controllers").WithName("InferenceService"),
Scheme: mgr.GetScheme(),
Client: mgr.GetClient(),
Clientset: clientSet,
Log: ctrl.Log.WithName("v1beta1Controllers").WithName("InferenceService"),
Scheme: mgr.GetScheme(),
Recorder: eventBroadcaster.NewRecorder(
mgr.GetScheme(), v1.EventSource{Component: "v1beta1Controllers"}),
}).SetupWithManager(mgr, deployConfig, ingressConfig); err != nil {
Expand All @@ -207,7 +205,7 @@ func main() {
Log: ctrl.Log.WithName("v1beta1Controllers").WithName("TrainedModel"),
Scheme: mgr.GetScheme(),
Recorder: eventBroadcaster.NewRecorder(mgr.GetScheme(), v1.EventSource{Component: "v1beta1Controllers"}),
ModelConfigReconciler: modelconfig.NewModelConfigReconciler(mgr.GetClient(), mgr.GetScheme()),
ModelConfigReconciler: modelconfig.NewModelConfigReconciler(mgr.GetClient(), clientSet, mgr.GetScheme()),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "v1beta1Controllers", "TrainedModel")
os.Exit(1)
Expand All @@ -218,10 +216,11 @@ func main() {
setupLog.Info("Setting up InferenceGraph controller")
inferenceGraphEventBroadcaster.StartRecordingToSink(&typedcorev1.EventSinkImpl{Interface: clientSet.CoreV1().Events("")})
if err = (&graphcontroller.InferenceGraphReconciler{
Client: mgr.GetClient(),
Log: ctrl.Log.WithName("v1alpha1Controllers").WithName("InferenceGraph"),
Scheme: mgr.GetScheme(),
Recorder: eventBroadcaster.NewRecorder(mgr.GetScheme(), v1.EventSource{Component: "InferenceGraphController"}),
Client: mgr.GetClient(),
Clientset: clientSet,
Log: ctrl.Log.WithName("v1alpha1Controllers").WithName("InferenceGraph"),
Scheme: mgr.GetScheme(),
Recorder: eventBroadcaster.NewRecorder(mgr.GetScheme(), v1.EventSource{Component: "InferenceGraphController"}),
}).SetupWithManager(mgr, deployConfig); err != nil {
setupLog.Error(err, "unable to create controller", "v1alpha1Controllers", "InferenceGraph")
os.Exit(1)
Expand All @@ -232,7 +231,7 @@ func main() {

setupLog.Info("registering webhooks to the webhook server")
hookServer.Register("/mutate-pods", &webhook.Admission{
Handler: &pod.Mutator{Client: mgr.GetClient(), Decoder: admission.NewDecoder(mgr.GetScheme())},
Handler: &pod.Mutator{Client: mgr.GetClient(), Clientset: clientSet, Decoder: admission.NewDecoder(mgr.GetScheme())},
})

setupLog.Info("registering cluster serving runtime validator webhook to the webhook server")
Expand Down
20 changes: 0 additions & 20 deletions config/default/inferenceservice_conversion_webhook.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions config/default/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ replacements:
name: kserve-webhook-server-service
version: v1
targets:
- fieldPaths:
- spec.conversion.webhook.clientConfig.service.name
select:
kind: CustomResourceDefinition
name: inferenceservices.serving.kserve.io
- fieldPaths:
- webhooks.*.clientConfig.service.name
select:
Expand Down Expand Up @@ -78,11 +73,6 @@ replacements:
name: kserve-controller-manager
version: v1
targets:
- fieldPaths:
- spec.conversion.webhook.clientConfig.service.namespace
select:
kind: CustomResourceDefinition
name: inferenceservices.serving.kserve.io
- fieldPaths:
- webhooks.*.clientConfig.service.namespace
select:
Expand Down Expand Up @@ -199,5 +189,4 @@ patches:
- path: clusterservingruntime_validatingwebhook_cainjection_patch.yaml
- path: servingruntime_validationwebhook_cainjection_patch.yaml
- path: manager_resources_patch.yaml
- path: inferenceservice_conversion_webhook.yaml
- path: cainjection_conversion_webhook.yaml
6 changes: 0 additions & 6 deletions config/rbac/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ rules:
verbs:
- create
- get
- list
- update
- watch
- apiGroups:
- ""
resources:
Expand Down Expand Up @@ -87,18 +85,14 @@ rules:
- create
- delete
- get
- list
- patch
- update
- watch
- apiGroups:
- ""
resources:
- serviceaccounts
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
Expand Down
Binary file added docs/diagrams/kserve_new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ go 1.21
require (
cloud.google.com/go/storage v1.35.1
github.com/aws/aws-sdk-go v1.48.0
github.com/cloudevents/sdk-go/v2 v2.14.0
github.com/cloudevents/sdk-go/v2 v2.15.2
github.com/fsnotify/fsnotify v1.7.0
github.com/getkin/kin-openapi v0.120.0
github.com/go-logr/logr v1.3.0
github.com/gofrs/uuid/v5 v5.0.0
github.com/google/go-cmp v0.6.0
github.com/google/uuid v1.4.0
github.com/google/uuid v1.6.0
github.com/googleapis/google-cloud-go-testing v0.0.0-20210719221736-1c9a4c676720
github.com/json-iterator/go v1.1.12
github.com/kelseyhightower/envconfig v1.4.0
Expand All @@ -22,7 +22,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.4
github.com/tidwall/gjson v1.17.0
go.uber.org/zap v1.26.0
go.uber.org/zap v1.27.0
gomodules.xyz/jsonpatch/v2 v2.4.0
google.golang.org/api v0.151.0
google.golang.org/protobuf v1.32.0
Expand Down
6 changes: 6 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMn
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloudevents/sdk-go/v2 v2.14.0 h1:Nrob4FwVgi5L4tV9lhjzZcjYqFVyJzsA56CwPaPfv6s=
github.com/cloudevents/sdk-go/v2 v2.14.0/go.mod h1:xDmKfzNjM8gBvjaF8ijFjM1VYOVUEeUfapHMUX1T5To=
github.com/cloudevents/sdk-go/v2 v2.15.2 h1:54+I5xQEnI73RBhWHxbI1XJcqOFOVJN85vb41+8mHUc=
github.com/cloudevents/sdk-go/v2 v2.15.2/go.mod h1:lL7kSWAE/V8VI4Wh0jbL2v/jvqsm6tjmaQBSvxcv4uE=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
Expand Down Expand Up @@ -211,6 +213,8 @@ github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4=
github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfFxPRy3Bf7vr3h0cechB90XaQs=
github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
Expand Down Expand Up @@ -397,6 +401,8 @@ go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN8
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.26.0 h1:sI7k6L95XOKS281NhVKOFCUNIvv9e0w4BF8N3u+tCRo=
go.uber.org/zap v1.26.0/go.mod h1:dtElttAiwGvoJ/vj4IwHBS/gXsEu/pZ50mUIRWuG0so=
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down
6 changes: 3 additions & 3 deletions hack/quick_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ while getopts ":hsr" option; do
esac
done

export ISTIO_VERSION=1.19.4
export ISTIO_VERSION=1.20.4
export ISTIO_DIR=istio-${ISTIO_VERSION}
export KNATIVE_SERVING_VERSION=knative-v1.10.1
export KNATIVE_ISTIO_VERSION=knative-v1.10.0
export KNATIVE_SERVING_VERSION=knative-v1.13.1
export KNATIVE_ISTIO_VERSION=knative-v1.13.1
export KSERVE_VERSION=v0.12.0
export CERT_MANAGER_VERSION=v1.9.0
export SCRIPT_DIR="$( dirname -- "${BASH_SOURCE[0]}" )"
Expand Down
Loading