diff --git a/Makefile b/Makefile index d5a9c9cb40..28d330a5af 100644 --- a/Makefile +++ b/Makefile @@ -33,18 +33,18 @@ deploy-dev: manifests undeploy: kustomize build config/default | kubectl delete -f - - kubectl delete validatingwebhookconfigurations.admissionregistration.k8s.io kfservice.serving.kubeflow.org - kubectl delete mutatingwebhookconfigurations.admissionregistration.k8s.io kfservice.serving.kubeflow.org + kubectl delete validatingwebhookconfigurations.admissionregistration.k8s.io inferenceservice.serving.kubeflow.org + kubectl delete mutatingwebhookconfigurations.admissionregistration.k8s.io inferenceservice.serving.kubeflow.org undeploy-dev: kustomize build config/overlays/development | kubectl delete -f - - kubectl delete validatingwebhookconfigurations.admissionregistration.k8s.io kfservice.serving.kubeflow.org - kubectl delete mutatingwebhookconfigurations.admissionregistration.k8s.io kfservice.serving.kubeflow.org + kubectl delete validatingwebhookconfigurations.admissionregistration.k8s.io inferenceservice.serving.kubeflow.org + kubectl delete mutatingwebhookconfigurations.admissionregistration.k8s.io inferenceservice.serving.kubeflow.org # Generate manifests e.g. CRD, RBAC etc. manifests: go run vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go crd --output-dir=config/default/crds - kustomize build config/default/crds -o config/default/crds/serving_v1alpha2_kfservice.yaml + kustomize build config/default/crds -o config/default/crds/serving_v1alpha2_inferenceservice.yaml go run vendor/sigs.k8s.io/controller-tools/cmd/controller-gen/main.go rbac --output-dir=config/default/rbac # Run go fmt against code diff --git a/README.md b/README.md index c852c578cb..3e2f41eeb9 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ kubectl apply -f ./install/$TAG/kfserving.yaml ``` pip install kfserving ``` -* Follow the [example here](docs/samples/client/kfserving_sdk_sample.ipynb) to use the KFServing SDK to create, patch, and delete a KFService instance. +* Follow the [example here](docs/samples/client/kfserving_sdk_sample.ipynb) to use the KFServing SDK to create, patch, and delete a InferenceService instance. ### Contribute * [Developer Guide](/docs/DEVELOPER_GUIDE.md). diff --git a/ROADMAP.md b/ROADMAP.md index 2a04b9ac04..2521162f50 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -49,7 +49,7 @@ Objective: "Simplify user experience with handling credentials for storage backe # Future ## Unscheduled Work * Multi-Model Serving. - * Multiple KFServices share resources in the backend. + * Multiple InferenceServices share resources in the backend. * GPU Sharing. * Flexible Inference Graphs [MLGraph CRD](https://github.com/SeldonIO/mlgraph). * Model Experimentation. @@ -67,7 +67,7 @@ Objective: "Simplify user experience with handling credentials for storage backe # Historical ## Q2 2019 -### v0.1: KFService Minimum Viable Product (ETA: June 30, 2019) +### v0.1: InferenceService Minimum Viable Product (ETA: June 30, 2019) Objective: "Simplify the user experience and provide a low barrier to entry by minimizing the amount of YAML necessary to deploy a trained model." * High Level Interfaces * Deploy a Tensorflow model without specifying a Tensorflow Serving Technology. diff --git a/cmd/spec-gen/main.go b/cmd/spec-gen/main.go index 9d6891c2f2..130d309bc6 100644 --- a/cmd/spec-gen/main.go +++ b/cmd/spec-gen/main.go @@ -28,7 +28,7 @@ import ( "k8s.io/kube-openapi/pkg/common" ) -// Generate OpenAPI spec definitions for KFService Resource +// Generate OpenAPI spec definitions for InferenceService Resource func main() { if len(os.Args) <= 1 { klog.Fatal("Supply a version") diff --git a/config/default/configmap/kfservice.yaml b/config/default/configmap/inferenceservice.yaml similarity index 97% rename from config/default/configmap/kfservice.yaml rename to config/default/configmap/inferenceservice.yaml index 534c053f0f..ce9b0c3e4b 100644 --- a/config/default/configmap/kfservice.yaml +++ b/config/default/configmap/inferenceservice.yaml @@ -1,7 +1,7 @@ apiVersion: v1 kind: ConfigMap metadata: - name: kfservice-config + name: inferenceservice-config namespace: kfserving-system data: predictors: |- diff --git a/config/default/crds/crd_status_condition_patch.yaml b/config/default/crds/crd_status_condition_patch.yaml index b60f214c6d..9a18fba9ca 100644 --- a/config/default/crds/crd_status_condition_patch.yaml +++ b/config/default/crds/crd_status_condition_patch.yaml @@ -1,7 +1,7 @@ apiVersion: apiextensions.k8s.io/v1beta1 kind: CustomResourceDefinition metadata: - name: kfservices.serving.kubeflow.org + name: inferenceservices.serving.kubeflow.org spec: validation: openAPIV3Schema: diff --git a/config/default/crds/kustomization.yaml b/config/default/crds/kustomization.yaml index e4525fddbb..9f2cb2704a 100644 --- a/config/default/crds/kustomization.yaml +++ b/config/default/crds/kustomization.yaml @@ -8,7 +8,7 @@ # YAML string, with resources separated by document # markers ("---"). resources: -- serving_v1alpha2_kfservice.yaml +- serving_v1alpha2_inferenceservice.yaml patches: # Knative uses VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic difference, diff --git a/config/default/crds/serving_v1alpha2_kfservice.yaml b/config/default/crds/serving_v1alpha2_inferenceservice.yaml similarity index 98% rename from config/default/crds/serving_v1alpha2_kfservice.yaml rename to config/default/crds/serving_v1alpha2_inferenceservice.yaml index 8b5af6558b..c1d151aeaf 100644 --- a/config/default/crds/serving_v1alpha2_kfservice.yaml +++ b/config/default/crds/serving_v1alpha2_inferenceservice.yaml @@ -4,7 +4,7 @@ metadata: creationTimestamp: null labels: controller-tools.k8s.io: "1.0" - name: kfservices.serving.kubeflow.org + name: inferenceservices.serving.kubeflow.org spec: additionalPrinterColumns: - JSONPath: .status.url @@ -24,10 +24,10 @@ spec: type: date group: serving.kubeflow.org names: - kind: KFService - plural: kfservices + kind: InferenceService + plural: inferenceservices shortNames: - - kfservice + - inferenceservice scope: Namespaced validation: openAPIV3Schema: @@ -247,11 +247,11 @@ spec: type: object canaryTrafficPercent: description: CanaryTrafficPercent defines the percentage of traffic - going to canary KFService endpoints + going to canary InferenceService endpoints format: int64 type: integer default: - description: Default defines default KFService endpoints +required + description: Default defines default InferenceService endpoints +required properties: explainer: description: Explainer defines the model explanation service spec diff --git a/config/default/kustomization.yaml b/config/default/kustomization.yaml index 7b5251b30e..6419524617 100644 --- a/config/default/kustomization.yaml +++ b/config/default/kustomization.yaml @@ -11,8 +11,8 @@ namespace: kfserving-system # YAML string, with resources separated by document # markers ("---"). resources: -- crds/serving_v1alpha2_kfservice.yaml -- configmap/kfservice.yaml +- crds/serving_v1alpha2_inferenceservice.yaml +- configmap/inferenceservice.yaml - rbac/rbac_role.yaml - rbac/rbac_role_binding.yaml - manager/manager.yaml diff --git a/config/default/rbac/rbac_role.yaml b/config/default/rbac/rbac_role.yaml index e7bcd8a0d2..fe5b373d74 100644 --- a/config/default/rbac/rbac_role.yaml +++ b/config/default/rbac/rbac_role.yaml @@ -47,7 +47,7 @@ rules: - apiGroups: - serving.kubeflow.org resources: - - kfservices + - inferenceservices verbs: - get - list @@ -59,7 +59,7 @@ rules: - apiGroups: - serving.kubeflow.org resources: - - kfservices/status + - inferenceservices/status verbs: - get - update diff --git a/docs/DEVELOPER_GUIDE.md b/docs/DEVELOPER_GUIDE.md index 84b94ea85b..41271c0141 100644 --- a/docs/DEVELOPER_GUIDE.md +++ b/docs/DEVELOPER_GUIDE.md @@ -164,11 +164,11 @@ kubectl apply -f docs/samples/tensorflow/tensorflow.yaml You should see model serving deployment running under default or your specified namespace. ```console -$ kubectl get kfservices -n default +$ kubectl get inferenceservices -n default NAME READY URL DEFAULT TRAFFIC CANARY TRAFFIC AGE flowers-sample True flowers-sample.default.example.com 100 1h -$ kubectl get pods -n default -l serving.kubeflow.org/kfservice=flowers-sample +$ kubectl get pods -n default -l serving.kubeflow.org/inferenceservice=flowers-sample NAME READY STATUS RESTARTS AGE flowers-sample-default-htz8r-deployment-8fd979f9b-w2qbv 3/3 Running 0 10s ``` @@ -283,4 +283,4 @@ It`s a red herring. To resolve it, please ensure you have logged into dockerhub 2019-09-28 01:52:23.345692: E tensorflow_serving/sources/storage_path/file_system_storage_path_source.cc:362] FileSystemStoragePathSource encountered a filesystem access error: Could not find base path /mnt/models for servable flowers-sample ``` -Please make sure not to deploy the kfservice in the `kfserving-system` or other namespaces where namespace has `control-plane` as a label. The `storage-initializer` init container does not get injected for deployments in those namespaces since they do not go through the mutating webhook. \ No newline at end of file +Please make sure not to deploy the inferenceservice in the `kfserving-system` or other namespaces where namespace has `control-plane` as a label. The `storage-initializer` init container does not get injected for deployments in those namespaces since they do not go through the mutating webhook. \ No newline at end of file diff --git a/docs/README.md b/docs/README.md index 5e08cd8ca7..0ac9fe831c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -6,13 +6,13 @@ KFServing architecture consists of two main specifications, around control plane * Defines the specification of the `kfserving` resource. # Architecture Overview -The KFService Data Plane architecture consists of a static graph of components which implement a limited set of features. Advanced features such as Ensembling, A/B testing, and Multi-Arm-Bandits should be built at a layer above KFServices. The diagram reflects the overall architecture for a viable offering, but at this point in time may not accurately reflect the current set of features available in the graph, but the overall mechanism holds: +The InferenceService Data Plane architecture consists of a static graph of components which implement a limited set of features. Advanced features such as Ensembling, A/B testing, and Multi-Arm-Bandits should be built at a layer above InferenceServices. The diagram reflects the overall architecture for a viable offering, but at this point in time may not accurately reflect the current set of features available in the graph, but the overall mechanism holds: -- The User defines the components they wish to use in a KFService. +- The User defines the components they wish to use in a InferenceService. - The only required component is a Predictor. - Additional components may be specified to attach addtional behavior. - Each component is specified at the ModelSpec layer, allowing for canarying. -- The KFService will support one of several Data Plane interfaces. +- The InferenceService will support one of several Data Plane interfaces. - For example: tensorflow/HTTP, tensorflow/GRPC, seldon/HTTP, seldon/GRPC - Data Plane interfaces may be specified with annotations and defaults to tensorflow/HTTP - Not all components will be compatible with every data plane interface. diff --git a/docs/apis/README.md b/docs/apis/README.md index 3c0ea6ec74..72a5e69311 100644 --- a/docs/apis/README.md +++ b/docs/apis/README.md @@ -10,12 +10,12 @@

Resource Types: -

KFService +

InferenceService

-

KFService is the Schema for the services API

+

InferenceService is the Schema for the services API

@@ -40,7 +40,7 @@ serving.kubeflow.org/v1alpha2 kind
string - + @@ -79,7 +79,7 @@ EndpointSpec @@ -105,7 +105,7 @@ int
KFServiceInferenceService
@@ -60,8 +60,8 @@ Refer to the Kubernetes API documentation for the fields of the spec
- -KFServiceSpec + +InferenceServiceSpec
-

Default defines default KFService endpoints

+

Default defines default InferenceService endpoints

(Optional) -

CanaryTrafficPercent defines the percentage of traffic going to canary KFService endpoints

+

CanaryTrafficPercent defines the percentage of traffic going to canary InferenceService endpoints

@@ -115,8 +115,8 @@ int status
- -KFServiceStatus + +InferenceServiceStatus @@ -253,7 +253,7 @@ Kubernetes core/v1.Container TransformerSpec)

-

DeploymentSpec defines the configuration for a given KFService service component

+

DeploymentSpec defines the configuration for a given InferenceService service component

@@ -305,7 +305,7 @@ int

(Appears on: -KFServiceSpec) +InferenceServiceSpec)

@@ -597,14 +597,14 @@ PredictorConfig
-

KFServiceSpec +

InferenceServiceSpec

(Appears on: -KFService) +InferenceService)

-

KFServiceSpec defines the desired state of KFService

+

InferenceServiceSpec defines the desired state of InferenceService

@@ -624,7 +624,7 @@ EndpointSpec @@ -650,19 +650,19 @@ int
-

Default defines default KFService endpoints

+

Default defines default InferenceService endpoints

(Optional) -

CanaryTrafficPercent defines the percentage of traffic going to canary KFService endpoints

+

CanaryTrafficPercent defines the percentage of traffic going to canary InferenceService endpoints

-

KFServiceStatus +

InferenceServiceStatus

(Appears on: -KFService) +InferenceService)

-

KFServiceStatus defines the observed state of KFService

+

InferenceServiceStatus defines the observed state of InferenceService

@@ -1017,7 +1017,7 @@ Kubernetes core/v1.ResourceRequirements

(Appears on: -KFServiceStatus) +InferenceServiceStatus)

StatusConfigurationSpec describes the state of the configuration receiving traffic.

diff --git a/docs/control-plane.md b/docs/control-plane.md index 05a1e5da74..2472d10529 100644 --- a/docs/control-plane.md +++ b/docs/control-plane.md @@ -1,6 +1,6 @@ # Control Plane Specification -## KFService -A KFService is a unit of model serving. Users may have many KFServices, including different definitions across dev, test, and prod environments, as well as across different model use cases. KFServices are defined using the [Kubernetes Custom Resources](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) standard. +## InferenceService +A InferenceService is a unit of model serving. Users may have many InferenceServices, including different definitions across dev, test, and prod environments, as well as across different model use cases. InferenceServices are defined using the [Kubernetes Custom Resources](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) standard. ## Specifying a Service ### Resource Definition @@ -8,7 +8,7 @@ This top level resource definition is shared by all Kubernetes Custom Resources. | Field | Value | Description | | ----------- | ----------- | ----------- | -| kind | KFService | [Read the Docs](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#types-kinds) | +| kind | InferenceService | [Read the Docs](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#types-kinds) | | apiVersion | serving.kubeflow.org/v1alpha2 | [Read the Docs](https://kubernetes.io/docs/reference/using-api/api-overview/#api-versioning) | | metadata | [Metadata](#Metadata) | [Read the Docs](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#metadata) | | spec | [Spec](#Spec) | [Read the Docs](https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#spec-and-status) | @@ -19,7 +19,7 @@ The Metadata section of the resource definition contains resource identification | Field | Value | Description | | ----------- | ----------- | ----------- | -| metadata.name | String | A name for your KFService. This will ultimately derive the internal and external URIs. | +| metadata.name | String | A name for your InferenceService. This will ultimately derive the internal and external URIs. | | metadata.namespace | String | A namespace for your Service. This will ultimately derive the internal and external URIs. If missing, defaults to the namespace "default". | | metadata.labels | Map | A set of key value pairs denoting arbitrary information (e.g integrate with MLOps Lifecycle systems or organize many Models). | | metadata.annotations | Map | A set of key value pairs used to enable specific features available in different kubernetes environments (e.g., Google Cloud ML Engine vs AzureML). | @@ -44,7 +44,7 @@ The Status section of the resource definition provides critical feedback to the | status.conditions | List\<[Condition](#Conditions)> | The name for your Service. This will ultimately derive DNS name. | ## Understanding The Data Model -KFService offers a few high level specifications for common ML technologies. These come out of the box with a performant model server and a low flexibility, low barrier to entry experience. For more complex use cases, users are encouraged to take advantage of the custom spec, which allows a user's container to take advantage of the KFService architecture while providing the flexibility needed for their use case. +InferenceService offers a few high level specifications for common ML technologies. These come out of the box with a performant model server and a low flexibility, low barrier to entry experience. For more complex use cases, users are encouraged to take advantage of the custom spec, which allows a user's container to take advantage of the InferenceService architecture while providing the flexibility needed for their use case. ### ModelSpec | Field | Value | Description | @@ -59,18 +59,18 @@ KFService offers a few high level specifications for common ML technologies. The | maxReplicas | Integer | An optional integer specifying the maximum scale of the default/canary model definition. | ### Rollouts -The traffic management rules are specifically targetting Rollout use cases. A/B Testing, Multi-Armed-Bandit, and Ensemble Inferencing should not be implemented using KFService's default/canary mechanism. More complex controllers for these features should be purpose built and operate at a higher level than a KFService, perhaps even implemented using multiple KFServices or a KFGraph. This decoupling is critical to enable features like canarying a change to a Multi-Armed-Bandit inferencing graph. +The traffic management rules are specifically targetting Rollout use cases. A/B Testing, Multi-Armed-Bandit, and Ensemble Inferencing should not be implemented using InferenceService's default/canary mechanism. More complex controllers for these features should be purpose built and operate at a higher level than a InferenceService, perhaps even implemented using multiple InferenceServices or a KFGraph. This decoupling is critical to enable features like canarying a change to a Multi-Armed-Bandit inferencing graph. #### Blue Green Rollout -The simpliest deployment strategy relies on KFService's default spec. The rollout workflow is identical to a Kubernetes Deployment. Changes to the CRD will create a new set of serving pods. Once the resources are available for serving, traffic will be flipped to the new resources. Users may observe the status of the KFService to gain insight into the current state of the Blue Green rollout. +The simpliest deployment strategy relies on InferenceService's default spec. The rollout workflow is identical to a Kubernetes Deployment. Changes to the CRD will create a new set of serving pods. Once the resources are available for serving, traffic will be flipped to the new resources. Users may observe the status of the InferenceService to gain insight into the current state of the Blue Green rollout. #### Pinned Rollout For more cautious and manual workflows, users may follow the Pinned Release pattern. It is executed using the following: -* Start with a KFService that has a "stable" or "golden" default definition. -* Modify the KFService to set the new ModelSpec under the `canary`. +* Start with a InferenceService that has a "stable" or "golden" default definition. +* Modify the InferenceService to set the new ModelSpec under the `canary`. * Set canaryTrafficPercent to 0 -* Observe the KFService until the new revision progresses +* Observe the InferenceService until the new revision progresses * Note: traffic is still sent to "default" * Execute any inspection or testing against `canary` * Note: The canary will be available under a specialized URI (e.g. canary.name.namespace.cluster.internal) @@ -80,10 +80,10 @@ For more cautious and manual workflows, users may follow the Pinned Release patt #### Canary Rollout For the most advanced deployments, users may follow the Canary Rollout Pattern. It is executed using the following: -* Start with a KFService that has a "stable" or "golden" default definition. -* Modify the KFService to set the new ModelSpec under the `canary`. +* Start with a InferenceService that has a "stable" or "golden" default definition. +* Modify the InferenceService to set the new ModelSpec under the `canary`. * Set canaryTrafficPercent to some integer value (e.g. 10) -* Observe the KFService until the new revision progresses +* Observe the InferenceService until the new revision progresses * `canaryTrafficPercent` is sent to `canary` * `100 - canaryTrafficPercent` is sent to `default` * Continue incrementing canaryTrafficPercent in accordance with your desired canarying strategy @@ -94,9 +94,9 @@ For the most advanced deployments, users may follow the Canary Rollout Pattern. One of the most compelling characteristics of "infrastructure-as-code" interfaces like the Kubernetes Resource Model is the ability to revert a configuration to a last known golden state. The default/canary pattern defines the entire current state, enabling GitOps rollback. * revert to previously safe commit -* kubectl apply KFService.yaml +* kubectl apply InferenceService.yaml -It's possible to revert to a commit that contains `canary` in the spec. The state will be reconciled to rollback to a configuration that runs both `default` and `canary`. For a traditional rollback workflow, we recommend reverting to KFService specs that contains only `default`. +It's possible to revert to a commit that contains `canary` in the spec. The state will be reconciled to rollback to a configuration that runs both `default` and `canary`. For a traditional rollback workflow, we recommend reverting to InferenceService specs that contains only `default`. ### Resources The default implementation will attempt to provide sane defaults for CPU and MEMORY. If more control is needed, we defer to [Specifying Resources in Kubernetes](https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container). @@ -108,7 +108,7 @@ By default, a Service will be configured with requests and limits of: In addition to specifying nvidia/gpu count, users may target specific GPUs on specific platforms by using annotations (e.g. "cloud.google.com/gke-accelerator": "nvidia-tesla-t4"): ### Replicas -KFService is a serverless platform. By default, replicas will scale to zero, and replicas will be dynamically generated based on request volume. For those familiar with Knative Services, KFService uses a concurrency of 1 as it's scale metric. +InferenceService is a serverless platform. By default, replicas will scale to zero, and replicas will be dynamically generated based on request volume. For those familiar with Knative Services, InferenceService uses a concurrency of 1 as it's scale metric. Some use cases are not tolerant to the limitations of auto-scaling. To accommodate these use cases, it is possible to specify `spec.[default,canary].minReplicas` and `spec.[default,canary].maxReplicas`. It is important to note that this may result in large resource usage during rollout if `minReplicas` is set to a large value on both default and canary. @@ -128,7 +128,7 @@ status: ``` ### Conditions -Conditions provide realtime feedback to users on the underlying state of their deployment. As the feature set of KFService grows, additional conditions will be added to the set. We will use the convention of positive-true conditions; the resource is healthy if there are no conditions whose status is False. If no conditions are present on the resource (e.g. Ready is not present), the resource is not healthy. Only one condition for each type can be available. +Conditions provide realtime feedback to users on the underlying state of their deployment. As the feature set of InferenceService grows, additional conditions will be added to the set. We will use the convention of positive-true conditions; the resource is healthy if there are no conditions whose status is False. If no conditions are present on the resource (e.g. Ready is not present), the resource is not healthy. Only one condition for each type can be available. | Type | Description | | ----------- | ----------- | diff --git a/docs/samples/accelerators/README.md b/docs/samples/accelerators/README.md index e3fbd4f67e..4c2fb9eb9e 100644 --- a/docs/samples/accelerators/README.md +++ b/docs/samples/accelerators/README.md @@ -23,7 +23,7 @@ GKE will automatically apply corresponding tolerations to Pods requesting GPUs b These details will be determined by your individual kubernetes installation. ## Specifying GPU type -Some kubernetes providers allow users to run multiple GPU types on the same cluster. These GPUs may be selected by providing an annotation on your KFService resource. +Some kubernetes providers allow users to run multiple GPU types on the same cluster. These GPUs may be selected by providing an annotation on your InferenceService resource. ### GKE Apply the GKE Accelerator annotation as follows: diff --git a/docs/samples/accelerators/tensorflow-gpu.yaml b/docs/samples/accelerators/tensorflow-gpu.yaml index 7b317c6e2b..c814204608 100644 --- a/docs/samples/accelerators/tensorflow-gpu.yaml +++ b/docs/samples/accelerators/tensorflow-gpu.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "tensorflow-gpu" annotations: diff --git a/docs/samples/accelerators/xgboost-gpu.yaml b/docs/samples/accelerators/xgboost-gpu.yaml index e847525588..15f239940c 100644 --- a/docs/samples/accelerators/xgboost-gpu.yaml +++ b/docs/samples/accelerators/xgboost-gpu.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "xgboost-gpu" spec: diff --git a/docs/samples/autoscaling/README.md b/docs/samples/autoscaling/README.md index 73932ec184..1fa36dd430 100644 --- a/docs/samples/autoscaling/README.md +++ b/docs/samples/autoscaling/README.md @@ -2,25 +2,25 @@ **Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* -- [Autoscale KFService with your inference workload](#autoscale-kfservice-with-your-inference-workload) +- [Autoscale InferenceService with your inference workload](#autoscale-inferenceservice-with-your-inference-workload) - [Setup](#setup) - - [Load your KFService with target concurrency](#load-your-kfservice-with-target-concurrency) - - [Create the KFService](#create-the-kfservice) - - [Load KFService with concurrent requests](#load-kfservice-with-concurrent-requests) + - [Load your InferenceService with target concurrency](#load-your-inferenceservice-with-target-concurrency) + - [Create the InferenceService](#create-the-inferenceservice) + - [Load InferenceService with concurrent requests](#load-inferenceservice-with-concurrent-requests) - [Check Dashboard](#check-dashboard) - - [Load your KFService with target QPS](#load-your-kfservice-with-target-qps) - - [Create the KFService](#create-the-kfservice-1) - - [Load KFService with target QPS](#load-kfservice-with-target-qps) + - [Load your InferenceService with target QPS](#load-your-inferenceservice-with-target-qps) + - [Create the InferenceService](#create-the-inferenceservice-1) + - [Load InferenceService with target QPS](#load-inferenceservice-with-target-qps) - [Check Dashboard](#check-dashboard-1) - [Autoscaling on GPU!](#autoscaling-on-gpu) - - [Create the KFService with GPU resource](#create-the-kfservice-with-gpu-resource) - - [Load KFService with concurrent requests](#load-kfservice-with-concurrent-requests-1) + - [Create the InferenceService with GPU resource](#create-the-inferenceservice-with-gpu-resource) + - [Load InferenceService with concurrent requests](#load-inferenceservice-with-concurrent-requests-1) - [Autoscaling Customization](#autoscaling-customization) -# Autoscale KFService with your inference workload +# Autoscale InferenceService with your inference workload ## Setup 1. Your ~/.kube/config should point to a cluster with [KFServing installed](https://github.com/kubeflow/kfserving/blob/master/docs/DEVELOPER_GUIDE.md#deploy-kfserving). 2. Your cluster's Istio Ingress gateway must be network accessible. @@ -28,9 +28,9 @@ 4. [Metrics installation](https://knative.dev/docs/serving/installing-logging-metrics-traces) for viewing scaling graphs (optional). 5. The [hey](https://github.com/rakyll/hey) load generator installed (go get -u github.com/rakyll/hey). -## Load your KFService with target concurrency +## Load your InferenceService with target concurrency -### Create the KFService +### Create the InferenceService Apply the tensorflow example CR ``` kubectl apply -f autoscale.yaml @@ -38,16 +38,16 @@ kubectl apply -f autoscale.yaml Expected Output ``` -$ kfservice.serving.kubeflow.org/flowers-sample configured +$ inferenceservice.serving.kubeflow.org/flowers-sample configured ``` -### Load KFService with concurrent requests +### Load InferenceService with concurrent requests Send traffic in 30 seconds spurts maintaining 5 in-flight requests. ``` MODEL_NAME=flowers-sample INPUT_PATH=../tensorflow/input.json CLUSTER_IP=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}') -HOST=$(kubectl get kfservice $MODEL_NAME -o jsonpath='{.status.url}') +HOST=$(kubectl get inferenceservice $MODEL_NAME -o jsonpath='{.status.url}') hey -z 30s -c 5 -m POST -host ${HOST} -D $INPUT_PATH http://$CLUSTER_IP/v1/models/$MODEL_NAME:predict ``` Expected Output @@ -120,9 +120,9 @@ kubectl port-forward --namespace knative-monitoring $(kubectl get pods --namespa ![scaling dashboard](scaling_debug.png) -## Load your KFService with target QPS +## Load your InferenceService with target QPS -### Create the KFService +### Create the InferenceService Apply the tensorflow example CR ``` kubectl apply -f autoscale.yaml @@ -130,16 +130,16 @@ kubectl apply -f autoscale.yaml Expected Output ``` -$ kfservice.serving.kubeflow.org/flowers-sample configured +$ inferenceservice.serving.kubeflow.org/flowers-sample configured ``` -### Load KFService with target QPS +### Load InferenceService with target QPS Send 30 seconds of traffic maintaining 50 qps. ```bash MODEL_NAME=flowers-sample INPUT_PATH=../tensorflow/input.json CLUSTER_IP=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}') -HOST=$(kubectl get kfservice $MODEL_NAME -o jsonpath='{.status.url}') +HOST=$(kubectl get inferenceservice $MODEL_NAME -o jsonpath='{.status.url}') hey -z 30s -q 50 -m POST -host ${HOST} -D $INPUT_PATH http://$CLUSTER_IP/v1/models/$MODEL_NAME:predict ``` @@ -209,11 +209,11 @@ conditions are no longer met for 60 seconds, autoscaler will return back to 60 s Autoscaling on GPU is hard with GPU metrics, however thanks to Knative's concurrency based autoscaler scaling on GPU is pretty easy and effective! -### Create the KFService with GPU resource +### Create the InferenceService with GPU resource Apply the tensorflow gpu example CR ``` apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "flowers-sample-gpu" spec: @@ -231,13 +231,13 @@ spec: kubectl apply -f autoscale_gpu.yaml ``` -### Load KFService with concurrent requests +### Load InferenceService with concurrent requests Send 30 seconds of traffic maintaining 5 in-flight requests. ``` MODEL_NAME=flowers-sample-gpu INPUT_PATH=../tensorflow/input.json CLUSTER_IP=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}') -HOST=$(kubectl get kfservice $MODEL_NAME -o jsonpath='{.status.url}') +HOST=$(kubectl get inferenceservice $MODEL_NAME -o jsonpath='{.status.url}') hey -z 30s -c 5 -m POST -host ${HOST} -D $INPUT_PATH http://$CLUSTER_IP/v1/models/$MODEL_NAME:predict ``` Expected output @@ -287,11 +287,11 @@ Status code distribution: ``` ## Autoscaling Customization -You can also customize the target concurrency by adding annotation `autoscaling.knative.dev/target: "10"` on `KFService` CR. +You can also customize the target concurrency by adding annotation `autoscaling.knative.dev/target: "10"` on `InferenceService` CR. ```yaml apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "flowers-sample" annotations: diff --git a/docs/samples/autoscaling/autoscale.yaml b/docs/samples/autoscaling/autoscale.yaml index 166e3518c5..02fc01438a 100644 --- a/docs/samples/autoscaling/autoscale.yaml +++ b/docs/samples/autoscaling/autoscale.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "flowers-sample" spec: diff --git a/docs/samples/autoscaling/autoscale_custom.yaml b/docs/samples/autoscaling/autoscale_custom.yaml index e9cd822aa8..87b9923152 100644 --- a/docs/samples/autoscaling/autoscale_custom.yaml +++ b/docs/samples/autoscaling/autoscale_custom.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "flowers-sample" annotations: diff --git a/docs/samples/autoscaling/autoscale_gpu.yaml b/docs/samples/autoscaling/autoscale_gpu.yaml index be80289d42..5401ecb952 100644 --- a/docs/samples/autoscaling/autoscale_gpu.yaml +++ b/docs/samples/autoscaling/autoscale_gpu.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "flowers-sample-gpu" spec: diff --git a/docs/samples/azure/README.md b/docs/samples/azure/README.md index 63fbb70f91..a4907c3dea 100644 --- a/docs/samples/azure/README.md +++ b/docs/samples/azure/README.md @@ -1,5 +1,5 @@ -# Predict on a KFService with saved model on Azure +# Predict on a InferenceService with saved model on Azure ## Using Public Azure Blobs By default, KFServing uses anonymous client to download artifacts. To point to an Azure Blob, specify StorageUri to point to an Azure Blob Storage with the format: ```https://{$STORAGE_ACCOUNT_NAME}.blob.core.windows.net/{$CONTAINER}/{$PATH}``` @@ -28,11 +28,11 @@ data: AZ_SUBSCRIPTION_ID: xxxxx AZ_TENANT_ID: xxxxx ``` -Note: The azure secret KFServing looks for can be configured by running `kubectl edit -n kfserving-system kfservice-config` +Note: The azure secret KFServing looks for can be configured by running `kubectl edit -n kfserving-system inferenceservice-config` ### Attach to Service Account `KFServing` gets the secrets from your service account, you need to add the above created or existing secret to your service account's secret list. -By default `KFServing` uses `default` service account, user can use own service account and overwrite on `KFService` CRD. +By default `KFServing` uses `default` service account, user can use own service account and overwrite on `InferenceService` CRD. ```yaml apiVersion: v1 diff --git a/docs/samples/client/kfserving_sdk_sample.ipynb b/docs/samples/client/kfserving_sdk_sample.ipynb index cfc4a78787..9481e77496 100644 --- a/docs/samples/client/kfserving_sdk_sample.ipynb +++ b/docs/samples/client/kfserving_sdk_sample.ipynb @@ -13,7 +13,7 @@ "source": [ "This is a sample for KFServing SDK. \n", "\n", - "The notebook shows how to use KFServing SDK to create, get, rollout_canary, promote and delete KFService." + "The notebook shows how to use KFServing SDK to create, get, rollout_canary, promote and delete InferenceService." ] }, { @@ -29,8 +29,8 @@ "from kfserving import V1alpha2EndpointSpec\n", "from kfserving import V1alpha2PredictorSpec\n", "from kfserving import V1alpha2TensorflowSpec\n", - "from kfserving import V1alpha2KFServiceSpec\n", - "from kfserving import V1alpha2KFService\n", + "from kfserving import V1alpha2InferenceServiceSpec\n", + "from kfserving import V1alpha2InferenceService\n", "from kubernetes.client import V1ResourceRequirements" ] }, @@ -38,14 +38,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Define KFService" + "## Define InferenceService" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Firstly define default endpoint spec, and then define the kfservice basic on the endpoint spec." + "Firstly define default endpoint spec, and then define the inferenceservice basic on the endpoint spec." ] }, { @@ -63,25 +63,25 @@ " requests={'cpu':'100m','memory':'1Gi'},\n", " limits={'cpu':'100m', 'memory':'1Gi'}))))\n", " \n", - "kfsvc = V1alpha2KFService(api_version=api_version,\n", + "isvc = V1alpha2InferenceService(api_version=api_version,\n", " kind=constants.KFSERVING_KIND,\n", " metadata=client.V1ObjectMeta(\n", " name='flower-sample', namespace='kubeflow'),\n", - " spec=V1alpha2KFServiceSpec(default=default_endpoint_spec))" + " spec=V1alpha2InferenceServiceSpec(default=default_endpoint_spec))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Create KFService" + "## Create InferenceService" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Call KFServingClient to create KFService." + "Call KFServingClient to create InferenceService." ] }, { @@ -91,14 +91,14 @@ "outputs": [], "source": [ "KFServing = KFServingClient()\n", - "KFServing.create(kfsvc)" + "KFServing.create(isvc)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Check the KFService" + "## Check the InferenceService" ] }, { @@ -114,7 +114,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Add Canary to KFService" + "## Add Canary to InferenceService" ] }, { @@ -146,7 +146,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Rollout more traffic to canary of the KFService" + "## Rollout more traffic to canary of the InferenceService" ] }, { @@ -186,7 +186,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Delete the KFService" + "## Delete the InferenceService" ] }, { diff --git a/docs/samples/custom/custom.yaml b/docs/samples/custom/custom.yaml index e6d3ea09b8..0fd5a613aa 100644 --- a/docs/samples/custom/custom.yaml +++ b/docs/samples/custom/custom.yaml @@ -1,5 +1,5 @@ apiVersion: serving.kubeflow.org/v1alpha2 -kind: KFService +kind: InferenceService metadata: labels: controller-tools.k8s.io: "1.0" diff --git a/docs/samples/explanation/alibi/imagenet/README.md b/docs/samples/explanation/alibi/imagenet/README.md index ded30a623f..04eab2e41a 100644 --- a/docs/samples/explanation/alibi/imagenet/README.md +++ b/docs/samples/explanation/alibi/imagenet/README.md @@ -1,12 +1,12 @@ # Example Anchors Image Explaination for Imagenet -We can create a KFService with a trained Tensorflow Imagenet predictor for this dataset and an associated explainer. The black box explainer algorithm we will use is the Images version of Anchors from the [Alibi open source library](https://github.com/SeldonIO/alibi). More details on this algorithm and configuration settings that can be set can be found in the [Seldon Alibi documentation](https://docs.seldon.io/projects/alibi/en/stable/). +We can create a InferenceService with a trained Tensorflow Imagenet predictor for this dataset and an associated explainer. The black box explainer algorithm we will use is the Images version of Anchors from the [Alibi open source library](https://github.com/SeldonIO/alibi). More details on this algorithm and configuration settings that can be set can be found in the [Seldon Alibi documentation](https://docs.seldon.io/projects/alibi/en/stable/). -The KFService is shown below: +The InferenceService is shown below: ``` apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "imagenet" spec: @@ -36,7 +36,7 @@ spec: We set a custom config for batch_size as presently image requests are slow and may cause gateway timeouts if the batch size is too large. -Create this KfService: +Create this InferenceService: ``` kubectl create -f imagenet.yaml diff --git a/docs/samples/explanation/alibi/imagenet/imagenet.yaml b/docs/samples/explanation/alibi/imagenet/imagenet.yaml index ad97e41a66..c5d38841f9 100644 --- a/docs/samples/explanation/alibi/imagenet/imagenet.yaml +++ b/docs/samples/explanation/alibi/imagenet/imagenet.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "imagenet" spec: diff --git a/docs/samples/explanation/alibi/income/README.md b/docs/samples/explanation/alibi/income/README.md index 9c416d8729..d6fd243ac1 100644 --- a/docs/samples/explanation/alibi/income/README.md +++ b/docs/samples/explanation/alibi/income/README.md @@ -2,13 +2,13 @@ This example uses a [US income dataset](https://archive.ics.uci.edu/ml/datasets/adult) -We can create a KFService with a trained sklearn predictor for this dataset and an associated model explainer. The black box explainer algorithm we will use is the Tabular version of Anchors from the [Alibi open source library](https://github.com/SeldonIO/alibi). More details on this algorithm and configuration settings that can be set can be found in the [Seldon Alibi documentation](https://docs.seldon.io/projects/alibi/en/stable/). +We can create a InferenceService with a trained sklearn predictor for this dataset and an associated model explainer. The black box explainer algorithm we will use is the Tabular version of Anchors from the [Alibi open source library](https://github.com/SeldonIO/alibi). More details on this algorithm and configuration settings that can be set can be found in the [Seldon Alibi documentation](https://docs.seldon.io/projects/alibi/en/stable/). -The KFService is shown below: +The InferenceService is shown below: ``` apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "income" spec: @@ -29,7 +29,7 @@ spec: ``` -Create this KfService: +Create this InferenceService: ``` kubectl create -f income.yaml diff --git a/docs/samples/explanation/alibi/income/income.yaml b/docs/samples/explanation/alibi/income/income.yaml index f388edb620..d7433908ee 100644 --- a/docs/samples/explanation/alibi/income/income.yaml +++ b/docs/samples/explanation/alibi/income/income.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "income" spec: diff --git a/docs/samples/explanation/alibi/moviesentiment/README.md b/docs/samples/explanation/alibi/moviesentiment/README.md index c553dac828..255fd20e3a 100644 --- a/docs/samples/explanation/alibi/moviesentiment/README.md +++ b/docs/samples/explanation/alibi/moviesentiment/README.md @@ -2,13 +2,13 @@ This example uses a [movie sentiment dataset](http://www.cs.cornell.edu/people/pabo/movie-review-data/). -We can create a KFService with a trained sklearn predictor for this dataset and an associated explainer. The black box explainer algorithm we will use is the Text version of Anchors from the [Alibi open source library](https://github.com/SeldonIO/alibi). More details on this algorithm and configuration settings that can be set can be found in the [Seldon Alibi documentation](https://docs.seldon.io/projects/alibi/en/stable/). +We can create a InferenceService with a trained sklearn predictor for this dataset and an associated explainer. The black box explainer algorithm we will use is the Text version of Anchors from the [Alibi open source library](https://github.com/SeldonIO/alibi). More details on this algorithm and configuration settings that can be set can be found in the [Seldon Alibi documentation](https://docs.seldon.io/projects/alibi/en/stable/). -The KFService is shown below: +The InferenceService is shown below: ``` apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "moviesentiment" spec: @@ -28,7 +28,7 @@ spec: ``` -Create this KfService: +Create this InferenceService: ``` kubectl create -f moviesentiment.yaml @@ -189,7 +189,7 @@ You can add custom configuration for the Anchor Text explainer in the 'config' s ``` apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "moviesentiment" spec: diff --git a/docs/samples/explanation/alibi/moviesentiment/kfserving_text_explainer.ipynb b/docs/samples/explanation/alibi/moviesentiment/kfserving_text_explainer.ipynb index 0c766104e2..d44f45ac8d 100644 --- a/docs/samples/explanation/alibi/moviesentiment/kfserving_text_explainer.ipynb +++ b/docs/samples/explanation/alibi/moviesentiment/kfserving_text_explainer.ipynb @@ -4,14 +4,14 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Sample for KFService Explainer" + "# Sample for InferenceService Explainer" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "The notebook shows how to use KFServing SDK to create KFService with explainer, predictor." + "The notebook shows how to use KFServing SDK to create InferenceService with explainer, predictor." ] }, { @@ -29,8 +29,8 @@ "from kfserving import V1alpha2ExplainerSpec\n", "from kfserving import V1alpha2AlibiExplainerSpec\n", "from kfserving import V1alpha2SKLearnSpec\n", - "from kfserving import V1alpha2KFServiceSpec\n", - "from kfserving import V1alpha2KFService\n", + "from kfserving import V1alpha2InferenceServiceSpec\n", + "from kfserving import V1alpha2InferenceService\n", "from kubernetes.client import V1ResourceRequirements\n", "from kubernetes import client, config\n", "import kubernetes.client\n", @@ -42,7 +42,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Define KFService with Explainer" + "## Define InferenceService with Explainer" ] }, { @@ -75,25 +75,25 @@ " requests={'cpu': '100m', 'memory': '2Gi'},\n", " limits={'cpu': '100m', 'memory': '2Gi'}))))\n", " \n", - "kfsvc = V1alpha2KFService(api_version=api_version,\n", + "isvc = V1alpha2InferenceService(api_version=api_version,\n", " kind=constants.KFSERVING_KIND,\n", " metadata=client.V1ObjectMeta(\n", " name='moviesentiment', namespace='kubeflow'),\n", - " spec=V1alpha2KFServiceSpec(default=default_endpoint_spec))\n" + " spec=V1alpha2InferenceServiceSpec(default=default_endpoint_spec))\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Create KFService" + "## Create InferenceService" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Call KFServingClient to create KFService." + "Call KFServingClient to create InferenceService." ] }, { @@ -103,14 +103,14 @@ "outputs": [], "source": [ "KFServing = KFServingClient()\n", - "KFServing.create(kfsvc)\n" + "KFServing.create(isvc)\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Check the KFService" + "## Check the InferenceService" ] }, { @@ -215,7 +215,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Delete the KFService" + "## Delete the InferenceService" ] }, { diff --git a/docs/samples/explanation/alibi/moviesentiment/moviesentiment.yaml b/docs/samples/explanation/alibi/moviesentiment/moviesentiment.yaml index 543aec3d61..b8cf7d5185 100644 --- a/docs/samples/explanation/alibi/moviesentiment/moviesentiment.yaml +++ b/docs/samples/explanation/alibi/moviesentiment/moviesentiment.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "moviesentiment" spec: diff --git a/docs/samples/explanation/alibi/moviesentiment/moviesentiment2.yaml b/docs/samples/explanation/alibi/moviesentiment/moviesentiment2.yaml index 6ab07d63a5..07856786bc 100644 --- a/docs/samples/explanation/alibi/moviesentiment/moviesentiment2.yaml +++ b/docs/samples/explanation/alibi/moviesentiment/moviesentiment2.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "moviesentiment" spec: diff --git a/docs/samples/onnx/README.md b/docs/samples/onnx/README.md index 8b0f647649..4e8e211ef3 100644 --- a/docs/samples/onnx/README.md +++ b/docs/samples/onnx/README.md @@ -1,11 +1,11 @@ -# Predict on a KFService using ONNX +# Predict on a InferenceService using ONNX ## Setup 1. Your ~/.kube/config should point to a cluster with [KFServing installed](https://github.com/kubeflow/kfserving/blob/master/docs/DEVELOPER_GUIDE.md#deploy-kfserving). 2. Your cluster's Istio Ingress gateway must be network accessible. 3. Your cluster's Istio Egresss gateway must [allow Google Cloud Storage](https://knative.dev/docs/serving/outbound-network-access/) -## Create the KFService +## Create the InferenceService Apply the CRD ``` kubectl apply -f onnx.yaml @@ -13,13 +13,13 @@ kubectl apply -f onnx.yaml Expected Output ``` -$ kfservice.serving.kubeflow.org/style-sample configured +$ inferenceservice.serving.kubeflow.org/style-sample configured ``` ## Run a sample inference 1. Setup env vars ``` -export SERVICE_URL=$(kubectl get kfservice ${MODEL_NAME} -o jsonpath='{.status.url}') +export SERVICE_URL=$(kubectl get inferenceservice ${MODEL_NAME} -o jsonpath='{.status.url}') ``` 2. Verify the service is healthy ``` diff --git a/docs/samples/onnx/mosaic-onnx.ipynb b/docs/samples/onnx/mosaic-onnx.ipynb index f4bcc26eeb..e41323b5eb 100644 --- a/docs/samples/onnx/mosaic-onnx.ipynb +++ b/docs/samples/onnx/mosaic-onnx.ipynb @@ -105,7 +105,7 @@ } ], "source": [ - "# set SERVICE_URL using: export SERVICE_URL=$(kubectl get kfservice ${MODEL_NAME} -o jsonpath='{.status.url}')\n", + "# set SERVICE_URL using: export SERVICE_URL=$(kubectl get inferenceservice ${MODEL_NAME} -o jsonpath='{.status.url}')\n", "predictor_url = os.environ[\"SERVICE_URL\"]\n", "predictor_url" ] diff --git a/docs/samples/onnx/onnx.yaml b/docs/samples/onnx/onnx.yaml index cee7c603e4..2b0cda6979 100644 --- a/docs/samples/onnx/onnx.yaml +++ b/docs/samples/onnx/onnx.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "style-sample" spec: diff --git a/docs/samples/pytorch/README.md b/docs/samples/pytorch/README.md index d26f369526..ef20f6bc4e 100644 --- a/docs/samples/pytorch/README.md +++ b/docs/samples/pytorch/README.md @@ -56,14 +56,14 @@ print(res) print(res.text) ``` -# Predict on a KFService using PyTorch +# Predict on a InferenceService using PyTorch ## Setup 1. Your ~/.kube/config should point to a cluster with [KFServing installed](https://github.com/kubeflow/kfserving/blob/master/docs/DEVELOPER_GUIDE.md#deploy-kfserving). 2. Your cluster's Istio Ingress gateway must be network accessible. 3. Your cluster's Istio Egresss gateway must [allow Google Cloud Storage](https://knative.dev/docs/serving/outbound-network-access/) -## Create the KFService +## Create the InferenceService Apply the CRD ``` @@ -72,7 +72,7 @@ kubectl apply -f pytorch.yaml Expected Output ``` -$ kfservice.serving.kubeflow.org/pytorch-cifar10 created +$ inferenceservice.serving.kubeflow.org/pytorch-cifar10 created ``` ## Run a prediction @@ -82,7 +82,7 @@ MODEL_NAME=pytorch-cifar10 INPUT_PATH=@./input.json CLUSTER_IP=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}') -SERVICE_HOSTNAME=$(kubectl get kfservice pytorch-cifar10 -o jsonpath='{.status.url}' |sed 's/.*:\/\///g') +SERVICE_HOSTNAME=$(kubectl get inferenceservice pytorch-cifar10 -o jsonpath='{.status.url}' |sed 's/.*:\/\///g') curl -v -H "Host: ${SERVICE_HOSTNAME}" -d $INPUT_PATH http://$CLUSTER_IP/v1/models/$MODEL_NAME:predict ``` diff --git a/docs/samples/pytorch/pytorch.yaml b/docs/samples/pytorch/pytorch.yaml index 7ed2b51c3c..ce54db497e 100644 --- a/docs/samples/pytorch/pytorch.yaml +++ b/docs/samples/pytorch/pytorch.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "pytorch-cifar10" spec: diff --git a/docs/samples/rollouts/canary.yaml b/docs/samples/rollouts/canary.yaml index cc7a6066e4..31503a1205 100644 --- a/docs/samples/rollouts/canary.yaml +++ b/docs/samples/rollouts/canary.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "my-model" spec: diff --git a/docs/samples/rollouts/pinned.yaml b/docs/samples/rollouts/pinned.yaml index 9beda9296a..61bf383466 100644 --- a/docs/samples/rollouts/pinned.yaml +++ b/docs/samples/rollouts/pinned.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "my-model" spec: diff --git a/docs/samples/s3/README.md b/docs/samples/s3/README.md index 73457ef46b..ac23885a67 100644 --- a/docs/samples/s3/README.md +++ b/docs/samples/s3/README.md @@ -1,5 +1,5 @@ -# Predict on a KFService with saved model on S3 +# Predict on a InferenceService with saved model on S3 ## Setup 1. Your ~/.kube/config should point to a cluster with [KFServing installed](https://github.com/kubeflow/kfserving/blob/master/docs/DEVELOPER_GUIDE.md#deploy-kfserving). 2. Your cluster's Istio Ingress gateway must be network accessible. @@ -42,7 +42,7 @@ data: ``` `KFServing` gets the secrets from your service account, you need to add the above created or existing secret to your service account's secret list. -By default `KFServing` uses `default` service account, user can use own service account and overwrite on `KFService` CRD. +By default `KFServing` uses `default` service account, user can use own service account and overwrite on `InferenceService` CRD. ```yaml apiVersion: v1 @@ -58,7 +58,7 @@ Apply the secret and service account kubectl apply -f s3_secret.yaml ``` -## Create the KFService +## Create the InferenceService Apply the CRD ```bash kubectl apply -f tensorflow_s3.yaml @@ -66,7 +66,7 @@ kubectl apply -f tensorflow_s3.yaml Expected Output ``` -$ kfservice.serving.kubeflow.org/mnist-s3 created +$ inferenceservice.serving.kubeflow.org/mnist-s3 created ``` ## Run a prediction diff --git a/docs/samples/s3/tensorflow_s3.yaml b/docs/samples/s3/tensorflow_s3.yaml index 8a4c2c9e4d..3bf2e519b6 100644 --- a/docs/samples/s3/tensorflow_s3.yaml +++ b/docs/samples/s3/tensorflow_s3.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "mnist-s3" spec: diff --git a/docs/samples/sklearn/README.md b/docs/samples/sklearn/README.md index e03c8bd535..73ab047c3a 100644 --- a/docs/samples/sklearn/README.md +++ b/docs/samples/sklearn/README.md @@ -34,14 +34,14 @@ print(res) print(res.text) ``` -# Predict on a KFService using SKLearn +# Predict on a InferenceService using SKLearn ## Setup 1. Your ~/.kube/config should point to a cluster with [KFServing installed](https://github.com/kubeflow/kfserving/blob/master/docs/DEVELOPER_GUIDE.md#deploy-kfserving). 2. Your cluster's Istio Ingress gateway must be network accessible. 3. Your cluster's Istio Egresss gateway must [allow Google Cloud Storage](https://knative.dev/docs/serving/outbound-network-access/) -## Create the KFService +## Create the InferenceService Apply the CRD ``` @@ -50,7 +50,7 @@ kubectl apply -f sklearn.yaml Expected Output ``` -$ kfservice.serving.kubeflow.org/sklearn-iris created +$ inferenceservice.serving.kubeflow.org/sklearn-iris created ``` ## Run a prediction @@ -58,7 +58,7 @@ $ kfservice.serving.kubeflow.org/sklearn-iris created MODEL_NAME=sklearn-iris INPUT_PATH=@./iris-input.json CLUSTER_IP=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}') -SERVICE_HOSTNAME=$(kubectl get kfservice sklearn-iris -o jsonpath='{.status.url}' | sed 's/.*:\/\///g') +SERVICE_HOSTNAME=$(kubectl get inferenceservice sklearn-iris -o jsonpath='{.status.url}' | sed 's/.*:\/\///g') curl -v -H "Host: ${SERVICE_HOSTNAME}" http://$CLUSTER_IP/v1/models/$MODEL_NAME:predict -d $INPUT_PATH ``` diff --git a/docs/samples/sklearn/sklearn.yaml b/docs/samples/sklearn/sklearn.yaml index b5e3acb08b..b96480f146 100644 --- a/docs/samples/sklearn/sklearn.yaml +++ b/docs/samples/sklearn/sklearn.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "sklearn-iris" spec: diff --git a/docs/samples/tensorflow/README.md b/docs/samples/tensorflow/README.md index fbdd25c1be..6b0b944fec 100644 --- a/docs/samples/tensorflow/README.md +++ b/docs/samples/tensorflow/README.md @@ -1,11 +1,11 @@ -# Predict on a KFService using Tensorflow +# Predict on a InferenceService using Tensorflow ## Setup 1. Your ~/.kube/config should point to a cluster with [KFServing installed](https://github.com/kubeflow/kfserving/blob/master/docs/DEVELOPER_GUIDE.md#deploy-kfserving). 2. Your cluster's Istio Ingress gateway must be network accessible. 3. Your cluster's Istio Egresss gateway must [allow Google Cloud Storage](https://knative.dev/docs/serving/outbound-network-access/) -## Create the KFService +## Create the InferenceService Apply the CRD ``` kubectl apply -f tensorflow.yaml @@ -13,7 +13,7 @@ kubectl apply -f tensorflow.yaml Expected Output ``` -$ kfservice.serving.kubeflow.org/flowers-sample configured +$ inferenceservice.serving.kubeflow.org/flowers-sample configured ``` ## Run a prediction @@ -22,7 +22,7 @@ $ kfservice.serving.kubeflow.org/flowers-sample configured MODEL_NAME=flowers-sample INPUT_PATH=@./input.json CLUSTER_IP=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}') -SERVICE_HOSTNAME=$(kubectl get kfservice ${MODEL_NAME} -o jsonpath='{.status.url}' |sed 's/.*:\/\///g') +SERVICE_HOSTNAME=$(kubectl get inferenceservice ${MODEL_NAME} -o jsonpath='{.status.url}' |sed 's/.*:\/\///g') curl -v -H "Host: ${SERVICE_HOSTNAME}" http://$CLUSTER_IP/v1/models/$MODEL_NAME:predict -d $INPUT_PATH ``` @@ -80,7 +80,7 @@ kubectl apply -f tensorflow-canary.yaml To verify if your traffic split percenage is applied correctly, you can use the following command: ``` -kubectl get kfservices +kubectl get inferenceservices NAME READY URL DEFAULT TRAFFIC CANARY TRAFFIC AGE flowers-sample True http://flowers-sample.default.example.com 90 10 48s ``` diff --git a/docs/samples/tensorflow/tensorflow-canary.yaml b/docs/samples/tensorflow/tensorflow-canary.yaml index c6c901e166..b04eaab314 100644 --- a/docs/samples/tensorflow/tensorflow-canary.yaml +++ b/docs/samples/tensorflow/tensorflow-canary.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "flowers-sample" spec: diff --git a/docs/samples/tensorflow/tensorflow.yaml b/docs/samples/tensorflow/tensorflow.yaml index 166e3518c5..02fc01438a 100644 --- a/docs/samples/tensorflow/tensorflow.yaml +++ b/docs/samples/tensorflow/tensorflow.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "flowers-sample" spec: diff --git a/docs/samples/tensorrt/README.md b/docs/samples/tensorrt/README.md index 5e73f87460..491e18d1b3 100644 --- a/docs/samples/tensorrt/README.md +++ b/docs/samples/tensorrt/README.md @@ -1,11 +1,11 @@ -# Predict on a KFService using TensorRT Inference Server +# Predict on a InferenceService using TensorRT Inference Server ## Setup 1. Your ~/.kube/config should point to a cluster with [KFServing installed](https://github.com/kubeflow/kfserving/blob/master/docs/DEVELOPER_GUIDE.md#deploy-kfserving). 2. Your cluster's Istio Ingress gateway must be network accessible. 3. Your cluster's Istio Egresss gateway must [allow Google Cloud Storage](https://knative.dev/docs/serving/outbound-network-access/) -## Create the KFService +## Create the InferenceService Apply the CRD ``` kubectl apply -f tensorrt.yaml @@ -13,7 +13,7 @@ kubectl apply -f tensorrt.yaml Expected Output ``` -kfservice.serving.kubeflow.org/tensorrt-simple-string created +inferenceservice.serving.kubeflow.org/tensorrt-simple-string created ``` ## Run a prediction @@ -22,7 +22,7 @@ Uses the client at: https://docs.nvidia.com/deeplearning/sdk/tensorrt-inference- 1. setup vars ``` -SERVICE_HOSTNAME=$(kubectl get kfservice tensorrt-simple-string -o jsonpath='{.status.url}' |sed 's/.*:\/\///g') +SERVICE_HOSTNAME=$(kubectl get inferenceservice tensorrt-simple-string -o jsonpath='{.status.url}' |sed 's/.*:\/\///g') CLUSTER_IP=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}') echo $CLUSTER_IP diff --git a/docs/samples/tensorrt/tensorrt.yaml b/docs/samples/tensorrt/tensorrt.yaml index 807351355d..dacc18bf09 100644 --- a/docs/samples/tensorrt/tensorrt.yaml +++ b/docs/samples/tensorrt/tensorrt.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "tensorrt-simple-string" spec: diff --git a/docs/samples/transformer/image_transformer/README.md b/docs/samples/transformer/image_transformer/README.md index c29d7048c2..c29a103983 100644 --- a/docs/samples/transformer/image_transformer/README.md +++ b/docs/samples/transformer/image_transformer/README.md @@ -1,6 +1,6 @@ -# Predict on a KFService using PyTorch Server and Transformer +# Predict on a InferenceService using PyTorch Server and Transformer -Most of the model servers expect tensors as input data, so a pre-processing step is needed before making the prediction call if the user is sending in raw input format. Transformer is a service we orchestrated from KFService spec for user implemented pre/post processing code. In the [pytorch](../../pytorch/README.md) example we call the prediction endpoint with tensor inputs, and in this example we add additional pre-processing step to allow the user send raw image data. +Most of the model servers expect tensors as input data, so a pre-processing step is needed before making the prediction call if the user is sending in raw input format. Transformer is a service we orchestrated from InferenceService spec for user implemented pre/post processing code. In the [pytorch](../../pytorch/README.md) example we call the prediction endpoint with tensor inputs, and in this example we add additional pre-processing step to allow the user send raw image data. ## Setup 1. Your ~/.kube/config should point to a cluster with [KFServing installed](https://github.com/kubeflow/kfserving/blob/master/docs/DEVELOPER_GUIDE.md#deploy-kfserving). @@ -50,8 +50,8 @@ This step can be part of your CI/CD pipeline to continuously build the transform docker build -t yuzisun/image-transformer:latest -f transformer.Dockerfile . ``` -## Create the KFService -Please use the [YAML file](./image_transformer.yaml) to create the KFService, which includes a Transformer and a Predictor. +## Create the InferenceService +Please use the [YAML file](./image_transformer.yaml) to create the InferenceService, which includes a Transformer and a Predictor. Apply the CRD ``` @@ -60,7 +60,7 @@ kubectl apply -f image_transformer.yaml Expected Output ``` -$ kfservice.serving.kubeflow.org/transformer-cifar10 created +$ inferenceservice.serving.kubeflow.org/transformer-cifar10 created ``` ## Run a prediction @@ -70,7 +70,7 @@ MODEL_NAME=transformer-cifar10 INPUT_PATH=@./input.json CLUSTER_IP=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}') -SERVICE_HOSTNAME=$(kubectl get kfservice transformer-cifar10 -o jsonpath='{.status.url}' | sed 's/.*:\/\///g') +SERVICE_HOSTNAME=$(kubectl get inferenceservice transformer-cifar10 -o jsonpath='{.status.url}' | sed 's/.*:\/\///g') curl -v -H "Host: ${SERVICE_HOSTNAME}" -d $INPUT_PATH http://$CLUSTER_IP/v1/models/$MODEL_NAME:predict ``` diff --git a/docs/samples/transformer/image_transformer/image_transformer.yaml b/docs/samples/transformer/image_transformer/image_transformer.yaml index 9e4d7fe82d..d8766aca19 100644 --- a/docs/samples/transformer/image_transformer/image_transformer.yaml +++ b/docs/samples/transformer/image_transformer/image_transformer.yaml @@ -1,5 +1,5 @@ apiVersion: serving.kubeflow.org/v1alpha2 -kind: KFService +kind: InferenceService metadata: name: transformer-cifar10 spec: diff --git a/docs/samples/transformer/image_transformer/kfserving_sdk_transformer.ipynb b/docs/samples/transformer/image_transformer/kfserving_sdk_transformer.ipynb index 26066de006..96f499771e 100644 --- a/docs/samples/transformer/image_transformer/kfserving_sdk_transformer.ipynb +++ b/docs/samples/transformer/image_transformer/kfserving_sdk_transformer.ipynb @@ -11,7 +11,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "The notebook shows how to use KFServing SDK to create KFService with transformer, predictor." + "The notebook shows how to use KFServing SDK to create InferenceService with transformer, predictor." ] }, { @@ -29,8 +29,8 @@ "from kfserving import V1alpha2TransformerSpec\n", "from kfserving import V1alpha2PyTorchSpec\n", "from kfserving import V1alpha2CustomSpec\n", - "from kfserving import V1alpha2KFServiceSpec\n", - "from kfserving import V1alpha2KFService\n", + "from kfserving import V1alpha2InferenceServiceSpec\n", + "from kfserving import V1alpha2InferenceService\n", "from kubernetes.client import V1Container\n", "from kubernetes.client import V1ResourceRequirements\n", "import kubernetes.client\n", @@ -44,7 +44,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Define KFService with Transformer" + "## Define InferenceService with Transformer" ] }, { @@ -80,25 +80,25 @@ " requests={'cpu':'100m','memory':'1Gi'},\n", " limits={'cpu':'100m', 'memory':'1Gi'})))))\n", " \n", - "kfsvc = V1alpha2KFService(api_version=api_version,\n", + "isvc = V1alpha2InferenceService(api_version=api_version,\n", " kind=constants.KFSERVING_KIND,\n", " metadata=client.V1ObjectMeta(\n", " name='cifar10', namespace='kubeflow'),\n", - " spec=V1alpha2KFServiceSpec(default=default_endpoint_spec))" + " spec=V1alpha2InferenceServiceSpec(default=default_endpoint_spec))" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Create KFService with Transformer" + "## Create InferenceService with Transformer" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "Call KFServingClient to create KFService." + "Call KFServingClient to create InferenceService." ] }, { @@ -108,14 +108,14 @@ "outputs": [], "source": [ "KFServing = KFServingClient()\n", - "KFServing.create(kfsvc)" + "KFServing.create(isvc)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Check the KFService" + "## Check the InferenceService" ] }, { @@ -185,7 +185,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## Delete the KFService" + "## Delete the InferenceService" ] }, { @@ -202,7 +202,7 @@ " 'status': 'Success',\n", " 'details': {'name': 'cifar10',\n", " 'group': 'serving.kubeflow.org',\n", - " 'kind': 'kfservices',\n", + " 'kind': 'inferenceservices',\n", " 'uid': '7b72288f-de17-11e9-adc5-42010a80027c'}}" ] }, diff --git a/docs/samples/xgboost/README.md b/docs/samples/xgboost/README.md index 02de9a7124..e4fb1d02b6 100644 --- a/docs/samples/xgboost/README.md +++ b/docs/samples/xgboost/README.md @@ -56,14 +56,14 @@ print(res) print(res.text) ``` -## Predict on a KFService using XGBoost +## Predict on a InferenceService using XGBoost ## Setup 1. Your ~/.kube/config should point to a cluster with [KFServing installed](https://github.com/kubeflow/kfserving/blob/master/docs/DEVELOPER_GUIDE.md#deploy-kfserving). 2. Your cluster's Istio Ingress gateway must be network accessible. 3. Your cluster's Istio Egresss gateway must [allow Google Cloud Storage](https://knative.dev/docs/serving/outbound-network-access/) -## Create the KFService +## Create the InferenceService Apply the CRD ``` @@ -72,7 +72,7 @@ kubectl apply -f xgboost.yaml Expected Output ``` -$ kfservice.serving.kubeflow.org/xgboost-iris created +$ inferenceservice.serving.kubeflow.org/xgboost-iris created ``` ## Run a prediction @@ -81,7 +81,7 @@ $ kfservice.serving.kubeflow.org/xgboost-iris created MODEL_NAME=xgboost-iris INPUT_PATH=@./iris-input.json CLUSTER_IP=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}') -SERVICE_HOSTNAME=$(kubectl get kfservice xgboost-iris -o jsonpath='{.status.url}' | sed 's/.*:\/\///g') +SERVICE_HOSTNAME=$(kubectl get inferenceservice xgboost-iris -o jsonpath='{.status.url}' | sed 's/.*:\/\///g') curl -v -H "Host: ${SERVICE_HOSTNAME}" http://$CLUSTER_IP/v1/models/$MODEL_NAME:predict -d $INPUT_PATH ``` diff --git a/docs/samples/xgboost/xgboost.yaml b/docs/samples/xgboost/xgboost.yaml index 85ce0b3dc0..e9561deb95 100644 --- a/docs/samples/xgboost/xgboost.yaml +++ b/docs/samples/xgboost/xgboost.yaml @@ -1,5 +1,5 @@ apiVersion: "serving.kubeflow.org/v1alpha2" -kind: "KFService" +kind: "InferenceService" metadata: name: "xgboost-iris" spec: diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 0f2c951e48..8cdf26413e 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -23,5 +23,5 @@ CODEGEN_PKG=${KUBE_ROOT}/vendor/k8s.io/code-generator if [ -z "${GOPATH:-}" ]; then export GOPATH=$(go env GOPATH) fi -# Generating KFservice client files +# Generating INFERENCESERVICE client files ${CODEGEN_PKG}/generate-groups.sh all "github.com/kubeflow/kfserving/pkg/client" "github.com/kubeflow/kfserving/pkg/apis" serving:v1alpha2 diff --git a/install/v0.1.0/kfserving.yaml b/install/v0.1.0/kfserving.yaml index 4d8f7879d6..9dc9c1e818 100644 --- a/install/v0.1.0/kfserving.yaml +++ b/install/v0.1.0/kfserving.yaml @@ -13,7 +13,7 @@ metadata: creationTimestamp: null labels: controller-tools.k8s.io: "1.0" - name: kfservices.serving.kubeflow.org + name: inferenceservices.serving.kubeflow.org spec: additionalPrinterColumns: - JSONPath: .status.url @@ -30,10 +30,10 @@ spec: type: date group: serving.kubeflow.org names: - kind: KFService - plural: kfservices + kind: InferenceService + plural: inferenceservices shortNames: - - kfservice + - inferenceservice scope: Namespaced validation: openAPIV3Schema: @@ -385,7 +385,7 @@ rules: - apiGroups: - serving.kubeflow.org resources: - - kfservices + - inferenceservices verbs: - get - list @@ -397,7 +397,7 @@ rules: - apiGroups: - serving.kubeflow.org resources: - - kfservices/status + - inferenceservices/status verbs: - get - update @@ -523,7 +523,7 @@ data: } kind: ConfigMap metadata: - name: kfservice-config + name: inferenceservice-config namespace: kfserving-system --- apiVersion: v1 diff --git a/pkg/apis/serving/v1alpha2/kfservice_framework_pytorch.go b/pkg/apis/serving/v1alpha2/framework_pytorch.go similarity index 100% rename from pkg/apis/serving/v1alpha2/kfservice_framework_pytorch.go rename to pkg/apis/serving/v1alpha2/framework_pytorch.go diff --git a/pkg/apis/serving/v1alpha2/kfservice_framework_tensorrt.go b/pkg/apis/serving/v1alpha2/framework_tensorrt.go similarity index 100% rename from pkg/apis/serving/v1alpha2/kfservice_framework_tensorrt.go rename to pkg/apis/serving/v1alpha2/framework_tensorrt.go diff --git a/pkg/apis/serving/v1alpha2/kfservice_framework_tensorrt_test.go b/pkg/apis/serving/v1alpha2/framework_tensorrt_test.go similarity index 100% rename from pkg/apis/serving/v1alpha2/kfservice_framework_tensorrt_test.go rename to pkg/apis/serving/v1alpha2/framework_tensorrt_test.go diff --git a/pkg/apis/serving/v1alpha2/kfservice_defaults.go b/pkg/apis/serving/v1alpha2/inferenceservice_defaults.go similarity index 72% rename from pkg/apis/serving/v1alpha2/kfservice_defaults.go rename to pkg/apis/serving/v1alpha2/inferenceservice_defaults.go index 88ae972838..a7625eb0bb 100644 --- a/pkg/apis/serving/v1alpha2/kfservice_defaults.go +++ b/pkg/apis/serving/v1alpha2/inferenceservice_defaults.go @@ -17,13 +17,13 @@ limitations under the License. package v1alpha2 // Default implements https://godoc.org/sigs.k8s.io/controller-runtime/pkg/webhook/admission#Defaulter -func (kfsvc *KFService) Default() { - logger.Info("Defaulting KFService", "namespace", kfsvc.Namespace, "name", kfsvc.Name) - kfsvc.applyDefaultsEndpoint(&kfsvc.Spec.Default) - kfsvc.applyDefaultsEndpoint(kfsvc.Spec.Canary) +func (isvc *InferenceService) Default() { + logger.Info("Defaulting InferenceService", "namespace", isvc.Namespace, "name", isvc.Name) + isvc.applyDefaultsEndpoint(&isvc.Spec.Default) + isvc.applyDefaultsEndpoint(isvc.Spec.Canary) } -func (kfsvc *KFService) applyDefaultsEndpoint(endpoint *EndpointSpec) { +func (isvc *InferenceService) applyDefaultsEndpoint(endpoint *EndpointSpec) { if endpoint != nil { endpoint.Predictor.ApplyDefaults() if endpoint.Explainer != nil { diff --git a/pkg/apis/serving/v1alpha2/kfservice_defaults_test.go b/pkg/apis/serving/v1alpha2/inferenceservice_defaults_test.go similarity index 50% rename from pkg/apis/serving/v1alpha2/kfservice_defaults_test.go rename to pkg/apis/serving/v1alpha2/inferenceservice_defaults_test.go index f7fa84a2e8..6fbefb1813 100644 --- a/pkg/apis/serving/v1alpha2/kfservice_defaults_test.go +++ b/pkg/apis/serving/v1alpha2/inferenceservice_defaults_test.go @@ -27,12 +27,12 @@ import ( func TestTensorflowDefaults(t *testing.T) { g := gomega.NewGomegaWithT(t) - kfsvc := KFService{ + isvc := InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: "foo", Namespace: "default", }, - Spec: KFServiceSpec{ + Spec: InferenceServiceSpec{ Default: EndpointSpec{ Predictor: PredictorSpec{ Tensorflow: &TensorflowSpec{StorageURI: "gs://testbucket/testmodel"}, @@ -40,17 +40,17 @@ func TestTensorflowDefaults(t *testing.T) { }, }, } - kfsvc.Spec.Canary = kfsvc.Spec.Default.DeepCopy() - kfsvc.Spec.Canary.Predictor.Tensorflow.RuntimeVersion = "1.11" - kfsvc.Spec.Canary.Predictor.Tensorflow.Resources.Requests = v1.ResourceList{v1.ResourceMemory: resource.MustParse("3Gi")} - kfsvc.Default() - - g.Expect(kfsvc.Spec.Default.Predictor.Tensorflow.RuntimeVersion).To(gomega.Equal(DefaultTensorflowRuntimeVersion)) - g.Expect(kfsvc.Spec.Default.Predictor.Tensorflow.Resources.Requests[v1.ResourceCPU]).To(gomega.Equal(DefaultCPU)) - g.Expect(kfsvc.Spec.Default.Predictor.Tensorflow.Resources.Requests[v1.ResourceMemory]).To(gomega.Equal(DefaultMemory)) - g.Expect(kfsvc.Spec.Default.Predictor.Tensorflow.Resources.Limits[v1.ResourceCPU]).To(gomega.Equal(DefaultCPU)) - g.Expect(kfsvc.Spec.Default.Predictor.Tensorflow.Resources.Limits[v1.ResourceMemory]).To(gomega.Equal(DefaultMemory)) - g.Expect(kfsvc.Spec.Canary.Predictor.Tensorflow.RuntimeVersion).To(gomega.Equal("1.11")) - g.Expect(kfsvc.Spec.Canary.Predictor.Tensorflow.Resources.Requests[v1.ResourceCPU]).To(gomega.Equal(DefaultCPU)) - g.Expect(kfsvc.Spec.Canary.Predictor.Tensorflow.Resources.Requests[v1.ResourceMemory]).To(gomega.Equal(resource.MustParse("3Gi"))) + isvc.Spec.Canary = isvc.Spec.Default.DeepCopy() + isvc.Spec.Canary.Predictor.Tensorflow.RuntimeVersion = "1.11" + isvc.Spec.Canary.Predictor.Tensorflow.Resources.Requests = v1.ResourceList{v1.ResourceMemory: resource.MustParse("3Gi")} + isvc.Default() + + g.Expect(isvc.Spec.Default.Predictor.Tensorflow.RuntimeVersion).To(gomega.Equal(DefaultTensorflowRuntimeVersion)) + g.Expect(isvc.Spec.Default.Predictor.Tensorflow.Resources.Requests[v1.ResourceCPU]).To(gomega.Equal(DefaultCPU)) + g.Expect(isvc.Spec.Default.Predictor.Tensorflow.Resources.Requests[v1.ResourceMemory]).To(gomega.Equal(DefaultMemory)) + g.Expect(isvc.Spec.Default.Predictor.Tensorflow.Resources.Limits[v1.ResourceCPU]).To(gomega.Equal(DefaultCPU)) + g.Expect(isvc.Spec.Default.Predictor.Tensorflow.Resources.Limits[v1.ResourceMemory]).To(gomega.Equal(DefaultMemory)) + g.Expect(isvc.Spec.Canary.Predictor.Tensorflow.RuntimeVersion).To(gomega.Equal("1.11")) + g.Expect(isvc.Spec.Canary.Predictor.Tensorflow.Resources.Requests[v1.ResourceCPU]).To(gomega.Equal(DefaultCPU)) + g.Expect(isvc.Spec.Canary.Predictor.Tensorflow.Resources.Requests[v1.ResourceMemory]).To(gomega.Equal(resource.MustParse("3Gi"))) } diff --git a/pkg/apis/serving/v1alpha2/kfservice_status.go b/pkg/apis/serving/v1alpha2/inferenceservice_status.go similarity index 81% rename from pkg/apis/serving/v1alpha2/kfservice_status.go rename to pkg/apis/serving/v1alpha2/inferenceservice_status.go index 04216f25c1..98f3b5d4ac 100644 --- a/pkg/apis/serving/v1alpha2/kfservice_status.go +++ b/pkg/apis/serving/v1alpha2/inferenceservice_status.go @@ -39,44 +39,44 @@ const ( CanaryExplainerReady apis.ConditionType = "CanaryExplainerReady" ) -var defaultConditionsMap = map[constants.KFServiceEndpoint]apis.ConditionType{ +var defaultConditionsMap = map[constants.InferenceServiceEndpoint]apis.ConditionType{ constants.Predictor: DefaultPredictorReady, constants.Explainer: DefaultExplainerReady, constants.Transformer: DefaultTransformerReady, } -var canaryConditionsMap = map[constants.KFServiceEndpoint]apis.ConditionType{ +var canaryConditionsMap = map[constants.InferenceServiceEndpoint]apis.ConditionType{ constants.Predictor: CanaryPredictorReady, constants.Explainer: CanaryExplainerReady, constants.Transformer: CanaryTransformerReady, } -// KFService Ready condition is depending on default predictor and route readiness condition +// InferenceService Ready condition is depending on default predictor and route readiness condition // canary readiness condition only present when canary is used and currently does -// not affect KFService readiness condition. +// not affect InferenceService readiness condition. var conditionSet = apis.NewLivingConditionSet( DefaultPredictorReady, RoutesReady, ) -var _ apis.ConditionsAccessor = (*KFServiceStatus)(nil) +var _ apis.ConditionsAccessor = (*InferenceServiceStatus)(nil) -func (ss *KFServiceStatus) InitializeConditions() { +func (ss *InferenceServiceStatus) InitializeConditions() { conditionSet.Manage(ss).InitializeConditions() } // IsReady returns if the service is ready to serve the requested configuration. -func (ss *KFServiceStatus) IsReady() bool { +func (ss *InferenceServiceStatus) IsReady() bool { return conditionSet.Manage(ss).IsHappy() } // GetCondition returns the condition by name. -func (ss *KFServiceStatus) GetCondition(t apis.ConditionType) *apis.Condition { +func (ss *InferenceServiceStatus) GetCondition(t apis.ConditionType) *apis.Condition { return conditionSet.Manage(ss).GetCondition(t) } // PropagateDefaultStatus propagates the status for the default spec -func (ss *KFServiceStatus) PropagateDefaultStatus(endpoint constants.KFServiceEndpoint, defaultStatus *knservingv1alpha1.ServiceStatus) { +func (ss *InferenceServiceStatus) PropagateDefaultStatus(endpoint constants.InferenceServiceEndpoint, defaultStatus *knservingv1alpha1.ServiceStatus) { if ss.Default == nil { emptyStatusMap := make(EndpointStatusMap) ss.Default = &emptyStatusMap @@ -91,7 +91,7 @@ func (ss *KFServiceStatus) PropagateDefaultStatus(endpoint constants.KFServiceEn } // PropagateCanaryStatus propagates the status for the canary spec -func (ss *KFServiceStatus) PropagateCanaryStatus(endpoint constants.KFServiceEndpoint, canaryStatus *knservingv1alpha1.ServiceStatus) { +func (ss *InferenceServiceStatus) PropagateCanaryStatus(endpoint constants.InferenceServiceEndpoint, canaryStatus *knservingv1alpha1.ServiceStatus) { conditionType := canaryConditionsMap[endpoint] // reset status if canaryServiceStatus is nil @@ -116,7 +116,7 @@ func (ss *KFServiceStatus) PropagateCanaryStatus(endpoint constants.KFServiceEnd ss.propagateStatus(statusSpec, conditionType, canaryStatus) } -func (ss *KFServiceStatus) propagateStatus(statusSpec *StatusConfigurationSpec, conditionType apis.ConditionType, serviceStatus *knservingv1alpha1.ServiceStatus) { +func (ss *InferenceServiceStatus) propagateStatus(statusSpec *StatusConfigurationSpec, conditionType apis.ConditionType, serviceStatus *knservingv1alpha1.ServiceStatus) { statusSpec.Name = serviceStatus.LatestCreatedRevisionName serviceCondition := serviceStatus.GetCondition(knservingv1alpha1.ServiceConditionReady) @@ -137,7 +137,7 @@ func (ss *KFServiceStatus) propagateStatus(statusSpec *StatusConfigurationSpec, } // PropagateRouteStatus propagates route's status to the service's status. -func (ss *KFServiceStatus) PropagateRouteStatus(vs *VirtualServiceStatus) { +func (ss *InferenceServiceStatus) PropagateRouteStatus(vs *VirtualServiceStatus) { ss.URL = vs.URL ss.Traffic = vs.DefaultWeight ss.CanaryTraffic = vs.CanaryWeight diff --git a/pkg/apis/serving/v1alpha2/kfservice_status_test.go b/pkg/apis/serving/v1alpha2/inferenceservice_status_test.go similarity index 95% rename from pkg/apis/serving/v1alpha2/kfservice_status_test.go rename to pkg/apis/serving/v1alpha2/inferenceservice_status_test.go index 7e5b41e1ea..a9c8eb96bc 100644 --- a/pkg/apis/serving/v1alpha2/kfservice_status_test.go +++ b/pkg/apis/serving/v1alpha2/inferenceservice_status_test.go @@ -25,7 +25,7 @@ import ( "testing" ) -func TestKFServiceDuckType(t *testing.T) { +func TestInferenceServiceDuckType(t *testing.T) { cases := []struct { name string t duck.Implementable @@ -36,15 +36,15 @@ func TestKFServiceDuckType(t *testing.T) { for _, test := range cases { t.Run(test.name, func(t *testing.T) { - err := duck.VerifyType(&KFService{}, test.t) + err := duck.VerifyType(&InferenceService{}, test.t) if err != nil { - t.Errorf("VerifyType(KFService, %T) = %v", test.t, err) + t.Errorf("VerifyType(InferenceService, %T) = %v", test.t, err) } }) } } -func TestKFServiceIsReady(t *testing.T) { +func TestInferenceServiceIsReady(t *testing.T) { cases := []struct { name string defaultServiceStatus v1alpha1.ServiceStatus @@ -196,7 +196,7 @@ func TestKFServiceIsReady(t *testing.T) { for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - status := KFServiceStatus{} + status := InferenceServiceStatus{} status.PropagateDefaultStatus(constants.Predictor, &tc.defaultServiceStatus) status.PropagateCanaryStatus(constants.Predictor, &tc.canaryServiceStatus) status.PropagateRouteStatus(&tc.routeStatus) diff --git a/pkg/apis/serving/v1alpha2/kfservice_types.go b/pkg/apis/serving/v1alpha2/inferenceservice_types.go similarity index 88% rename from pkg/apis/serving/v1alpha2/kfservice_types.go rename to pkg/apis/serving/v1alpha2/inferenceservice_types.go index ae6858b4c6..4e179c1686 100644 --- a/pkg/apis/serving/v1alpha2/kfservice_types.go +++ b/pkg/apis/serving/v1alpha2/inferenceservice_types.go @@ -20,15 +20,15 @@ import ( duckv1beta1 "knative.dev/pkg/apis/duck/v1beta1" ) -// KFServiceSpec defines the desired state of KFService -type KFServiceSpec struct { - // Default defines default KFService endpoints +// InferenceServiceSpec defines the desired state of InferenceService +type InferenceServiceSpec struct { + // Default defines default InferenceService endpoints // +required Default EndpointSpec `json:"default"` // Canary defines an alternate endpoints to route a percentage of traffic. // +optional Canary *EndpointSpec `json:"canary,omitempty"` - // CanaryTrafficPercent defines the percentage of traffic going to canary KFService endpoints + // CanaryTrafficPercent defines the percentage of traffic going to canary InferenceService endpoints // +optional CanaryTrafficPercent int `json:"canaryTrafficPercent,omitempty"` } @@ -49,7 +49,7 @@ type EndpointSpec struct { Transformer *TransformerSpec `json:"transformer,omitempty"` } -// DeploymentSpec defines the configuration for a given KFService service component +// DeploymentSpec defines the configuration for a given InferenceService service component type DeploymentSpec struct { // ServiceAccountName is the name of the ServiceAccount to use to run the service // +optional @@ -183,11 +183,11 @@ type CustomSpec struct { Container v1.Container `json:"container"` } -// EndpointStatusMap defines the observed state of KFService endpoints -type EndpointStatusMap map[constants.KFServiceEndpoint]*StatusConfigurationSpec +// EndpointStatusMap defines the observed state of InferenceService endpoints +type EndpointStatusMap map[constants.InferenceServiceEndpoint]*StatusConfigurationSpec -// KFServiceStatus defines the observed state of KFService -type KFServiceStatus struct { +// InferenceServiceStatus defines the observed state of InferenceService +type InferenceServiceStatus struct { duckv1beta1.Status `json:",inline"` URL string `json:"url,omitempty"` Traffic int `json:"traffic,omitempty"` @@ -206,29 +206,29 @@ type StatusConfigurationSpec struct { // +genclient // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// KFService is the Schema for the services API +// InferenceService is the Schema for the services API // +k8s:openapi-gen=true // +kubebuilder:printcolumn:name="URL",type="string",JSONPath=".status.url" // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status" // +kubebuilder:printcolumn:name="Default Traffic",type="integer",JSONPath=".status.traffic" // +kubebuilder:printcolumn:name="Canary Traffic",type="integer",JSONPath=".status.canaryTraffic" // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" -// +kubebuilder:resource:path=kfservices,shortName=kfservice -type KFService struct { +// +kubebuilder:resource:path=inferenceservices,shortName=inferenceservice +type InferenceService struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` - Spec KFServiceSpec `json:"spec,omitempty"` - Status KFServiceStatus `json:"status,omitempty"` + Spec InferenceServiceSpec `json:"spec,omitempty"` + Status InferenceServiceStatus `json:"status,omitempty"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object -// KFServiceList contains a list of Service -type KFServiceList struct { +// InferenceServiceList contains a list of Service +type InferenceServiceList struct { metav1.TypeMeta `json:",inline"` metav1.ListMeta `json:"metadata,omitempty"` - Items []KFService `json:"items"` + Items []InferenceService `json:"items"` } // VirtualServiceStatus captures the status of the virtual service @@ -241,5 +241,5 @@ type VirtualServiceStatus struct { } func init() { - SchemeBuilder.Register(&KFService{}, &KFServiceList{}) + SchemeBuilder.Register(&InferenceService{}, &InferenceServiceList{}) } diff --git a/pkg/apis/serving/v1alpha2/kfservice_types_test.go b/pkg/apis/serving/v1alpha2/inferenceservice_types_test.go similarity index 94% rename from pkg/apis/serving/v1alpha2/kfservice_types_test.go rename to pkg/apis/serving/v1alpha2/inferenceservice_types_test.go index 64c1667726..a5ff072406 100644 --- a/pkg/apis/serving/v1alpha2/kfservice_types_test.go +++ b/pkg/apis/serving/v1alpha2/inferenceservice_types_test.go @@ -26,17 +26,17 @@ import ( "k8s.io/apimachinery/pkg/types" ) -func TestKFService(t *testing.T) { +func TestInferenceService(t *testing.T) { key := types.NamespacedName{ Name: "foo", Namespace: "default", } - created := &KFService{ + created := &InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: "foo", Namespace: "default", }, - Spec: KFServiceSpec{ + Spec: InferenceServiceSpec{ Default: EndpointSpec{ Predictor: PredictorSpec{ DeploymentSpec: DeploymentSpec{ @@ -67,7 +67,7 @@ func TestKFService(t *testing.T) { g := gomega.NewGomegaWithT(t) // Test Create - fetched := &KFService{} + fetched := &InferenceService{} g.Expect(c.Create(context.TODO(), created)).NotTo(gomega.HaveOccurred()) g.Expect(c.Get(context.TODO(), key, fetched)).NotTo(gomega.HaveOccurred()) @@ -83,7 +83,7 @@ func TestKFService(t *testing.T) { // Test status update statusUpdated := fetched.DeepCopy() - statusUpdated.Status = KFServiceStatus{ + statusUpdated.Status = InferenceServiceStatus{ URL: "example.dev.com", Traffic: 20, CanaryTraffic: 80, diff --git a/pkg/apis/serving/v1alpha2/kfservice_validation.go b/pkg/apis/serving/v1alpha2/inferenceservice_validation.go similarity index 74% rename from pkg/apis/serving/v1alpha2/kfservice_validation.go rename to pkg/apis/serving/v1alpha2/inferenceservice_validation.go index 89b7c3ef4b..40b770692c 100644 --- a/pkg/apis/serving/v1alpha2/kfservice_validation.go +++ b/pkg/apis/serving/v1alpha2/inferenceservice_validation.go @@ -38,33 +38,33 @@ var ( ) // ValidateCreate implements https://godoc.org/sigs.k8s.io/controller-runtime/pkg/webhook/admission#Validator -func (kfsvc *KFService) ValidateCreate() error { - return kfsvc.validate() +func (isvc *InferenceService) ValidateCreate() error { + return isvc.validate() } // ValidateUpdate implements https://godoc.org/sigs.k8s.io/controller-runtime/pkg/webhook/admission#Validator -func (kfsvc *KFService) ValidateUpdate(old runtime.Object) error { - return kfsvc.validate() +func (isvc *InferenceService) ValidateUpdate(old runtime.Object) error { + return isvc.validate() } -func (kfsvc *KFService) validate() error { - logger.Info("Validating KFService", "namespace", kfsvc.Namespace, "name", kfsvc.Name) - if err := validateKFService(kfsvc); err != nil { - logger.Info("Failed to validate KFService", "namespace", kfsvc.Namespace, "name", kfsvc.Name, +func (isvc *InferenceService) validate() error { + logger.Info("Validating InferenceService", "namespace", isvc.Namespace, "name", isvc.Name) + if err := validateInferenceService(isvc); err != nil { + logger.Info("Failed to validate InferenceService", "namespace", isvc.Namespace, "name", isvc.Name, "error", err.Error()) return err } - logger.Info("Successfully validated KFService", "namespace", kfsvc.Namespace, "name", kfsvc.Name) + logger.Info("Successfully validated InferenceService", "namespace", isvc.Namespace, "name", isvc.Name) return nil } -func validateKFService(kfsvc *KFService) error { - if kfsvc == nil { - return fmt.Errorf("Unable to validate, KFService is nil") +func validateInferenceService(isvc *InferenceService) error { + if isvc == nil { + return fmt.Errorf("Unable to validate, InferenceService is nil") } endpoints := []*EndpointSpec{ - &kfsvc.Spec.Default, - kfsvc.Spec.Canary, + &isvc.Spec.Default, + isvc.Spec.Canary, } for _, endpoint := range endpoints { @@ -73,7 +73,7 @@ func validateKFService(kfsvc *KFService) error { } } - if err := validateCanaryTrafficPercent(kfsvc.Spec); err != nil { + if err := validateCanaryTrafficPercent(isvc.Spec); err != nil { return err } return nil @@ -99,7 +99,7 @@ func validateEndpoint(endpoint *EndpointSpec) error { return nil } -func validateCanaryTrafficPercent(spec KFServiceSpec) error { +func validateCanaryTrafficPercent(spec InferenceServiceSpec) error { if spec.Canary == nil && spec.CanaryTrafficPercent != 0 { return fmt.Errorf(TrafficProvidedWithoutCanaryError) } diff --git a/pkg/apis/serving/v1alpha2/inferenceservice_validation_test.go b/pkg/apis/serving/v1alpha2/inferenceservice_validation_test.go new file mode 100644 index 0000000000..9fd827e3f5 --- /dev/null +++ b/pkg/apis/serving/v1alpha2/inferenceservice_validation_test.go @@ -0,0 +1,213 @@ +/* +Copyright 2019 kubeflow.org. + +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 v1alpha2 + +import ( + "fmt" + "testing" + + "github.com/onsi/gomega" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func makeTestInferenceService() InferenceService { + inferenceservice := InferenceService{ + ObjectMeta: metav1.ObjectMeta{ + Name: "foo", + Namespace: "default", + }, + Spec: InferenceServiceSpec{ + Default: EndpointSpec{ + Predictor: PredictorSpec{ + Tensorflow: &TensorflowSpec{StorageURI: "gs://testbucket/testmodel"}, + }, + }, + }, + } + inferenceservice.Default() + return inferenceservice +} + +func TestValidStorageURIPrefixOK(t *testing.T) { + g := gomega.NewGomegaWithT(t) + for _, prefix := range SupportedStorageURIPrefixList { + isvc := makeTestInferenceService() + isvc.Spec.Default.Predictor.Tensorflow.StorageURI = prefix + "foo/bar" + g.Expect(isvc.ValidateCreate()).Should(gomega.Succeed()) + } +} + +func TestEmptyStorageURIPrefixOK(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Default.Predictor.Tensorflow.StorageURI = "" + g.Expect(isvc.ValidateCreate()).Should(gomega.Succeed()) +} + +func TestLocalPathStorageURIPrefixOK(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Default.Predictor.Tensorflow.StorageURI = "some/relative/path" + g.Expect(isvc.ValidateCreate()).Should(gomega.Succeed()) + isvc.Spec.Default.Predictor.Tensorflow.StorageURI = "/some/absolute/path" + g.Expect(isvc.ValidateCreate()).Should(gomega.Succeed()) + isvc.Spec.Default.Predictor.Tensorflow.StorageURI = "/" + g.Expect(isvc.ValidateCreate()).Should(gomega.Succeed()) + isvc.Spec.Default.Predictor.Tensorflow.StorageURI = "foo" + g.Expect(isvc.ValidateCreate()).Should(gomega.Succeed()) +} + +func TestAzureBlobOK(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Default.Predictor.Tensorflow.StorageURI = "https://kfserving.blob.core.windows.net/tensorrt/simple_string/" + g.Expect(isvc.ValidateCreate()).Should(gomega.Succeed()) + isvc.Spec.Default.Predictor.Tensorflow.StorageURI = "https://kfserving.blob.core.windows.net/tensorrt/simple_string" + g.Expect(isvc.ValidateCreate()).Should(gomega.Succeed()) + isvc.Spec.Default.Predictor.Tensorflow.StorageURI = "https://kfserving.blob.core.windows.net/tensorrt/" + g.Expect(isvc.ValidateCreate()).Should(gomega.Succeed()) + isvc.Spec.Default.Predictor.Tensorflow.StorageURI = "https://kfserving.blob.core.windows.net/tensorrt" + g.Expect(isvc.ValidateCreate()).Should(gomega.Succeed()) +} + +func TestAzureBlobNoAccountFails(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Default.Predictor.Tensorflow.StorageURI = "https://blob.core.windows.net/tensorrt/simple_string/" + g.Expect(isvc.ValidateCreate()).ShouldNot(gomega.Succeed()) +} + +func TestAzureBlobNoContainerFails(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Default.Predictor.Tensorflow.StorageURI = "https://foo.blob.core.windows.net/" + g.Expect(isvc.ValidateCreate()).ShouldNot(gomega.Succeed()) +} + +func TestUnkownStorageURIPrefixFails(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Default.Predictor.Tensorflow.StorageURI = "blob://foo/bar" + g.Expect(isvc.ValidateCreate()).ShouldNot(gomega.Succeed()) +} + +func TestRejectMultipleModelSpecs(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Default.Predictor.Custom = &CustomSpec{Container: v1.Container{}} + g.Expect(isvc.ValidateCreate()).Should(gomega.MatchError(ExactlyOnePredictorViolatedError)) +} + +func TestRejectModelSpecMissing(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Default.Predictor.Tensorflow = nil + g.Expect(isvc.ValidateCreate()).Should(gomega.MatchError(ExactlyOnePredictorViolatedError)) +} +func TestRejectMultipleCanaryModelSpecs(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Canary = &EndpointSpec{ + Predictor: PredictorSpec{ + Custom: &CustomSpec{Container: v1.Container{}}, + Tensorflow: isvc.Spec.Default.Predictor.Tensorflow, + }, + } + g.Expect(isvc.ValidateCreate()).Should(gomega.MatchError(ExactlyOnePredictorViolatedError)) +} + +func TestRejectCanaryModelSpecMissing(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Canary = &EndpointSpec{ + Predictor: PredictorSpec{}, + } + g.Expect(isvc.ValidateCreate()).Should(gomega.MatchError(ExactlyOnePredictorViolatedError)) +} +func TestRejectBadCanaryTrafficValues(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Canary = &isvc.Spec.Default + isvc.Spec.CanaryTrafficPercent = -1 + g.Expect(isvc.ValidateCreate()).Should(gomega.MatchError(TrafficBoundsExceededError)) + isvc.Spec.CanaryTrafficPercent = 101 + g.Expect(isvc.ValidateCreate()).Should(gomega.MatchError(TrafficBoundsExceededError)) +} + +func TestRejectTrafficProvidedWithoutCanary(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.CanaryTrafficPercent = 1 + g.Expect(isvc.ValidateCreate()).Should(gomega.MatchError(TrafficProvidedWithoutCanaryError)) +} + +func TestBadReplicaValues(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Default.Predictor.MinReplicas = -1 + g.Expect(isvc.ValidateCreate()).Should(gomega.MatchError(MinReplicasLowerBoundExceededError)) + isvc.Spec.Default.Predictor.MinReplicas = 1 + isvc.Spec.Default.Predictor.MaxReplicas = -1 + g.Expect(isvc.ValidateCreate()).Should(gomega.MatchError(MaxReplicasLowerBoundExceededError)) + isvc.Spec.Default.Predictor.MinReplicas = 2 + isvc.Spec.Default.Predictor.MaxReplicas = 1 + g.Expect(isvc.ValidateCreate()).Should(gomega.MatchError(MinReplicasShouldBeLessThanMaxError)) +} + +func TestCustomBadFields(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Default.Predictor.Tensorflow = nil + isvc.Spec.Default.Predictor.Custom = &CustomSpec{ + v1.Container{ + Name: "foo", + Image: "custom:0.1", + Stdin: true, + StdinOnce: true, + }, + } + g.Expect(isvc.ValidateCreate()).Should(gomega.MatchError("Custom container validation error: must not set the field(s): stdin, stdinOnce")) +} + +func TestCustomOK(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Default.Predictor.Tensorflow = nil + isvc.Spec.Default.Predictor.Custom = &CustomSpec{ + v1.Container{ + Image: "custom:0.1", + }, + } + err := isvc.ValidateCreate() + fmt.Println(err) + g.Expect(isvc.ValidateCreate()).Should(gomega.Succeed()) +} + +func TestRejectBadTransformer(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Default.Transformer = &TransformerSpec{} + g.Expect(isvc.ValidateCreate()).Should(gomega.MatchError(ExactlyOneTransformerViolatedError)) +} + +func TestRejectBadExplainer(t *testing.T) { + g := gomega.NewGomegaWithT(t) + isvc := makeTestInferenceService() + isvc.Spec.Default.Explainer = &ExplainerSpec{} + g.Expect(isvc.ValidateCreate()).Should(gomega.MatchError(ExactlyOneExplainerViolatedError)) +} diff --git a/pkg/apis/serving/v1alpha2/kfservice_validation_test.go b/pkg/apis/serving/v1alpha2/kfservice_validation_test.go deleted file mode 100644 index f7314dc30c..0000000000 --- a/pkg/apis/serving/v1alpha2/kfservice_validation_test.go +++ /dev/null @@ -1,213 +0,0 @@ -/* -Copyright 2019 kubeflow.org. - -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 v1alpha2 - -import ( - "fmt" - "testing" - - "github.com/onsi/gomega" - v1 "k8s.io/api/core/v1" - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -func makeTestKFService() KFService { - kfservice := KFService{ - ObjectMeta: metav1.ObjectMeta{ - Name: "foo", - Namespace: "default", - }, - Spec: KFServiceSpec{ - Default: EndpointSpec{ - Predictor: PredictorSpec{ - Tensorflow: &TensorflowSpec{StorageURI: "gs://testbucket/testmodel"}, - }, - }, - }, - } - kfservice.Default() - return kfservice -} - -func TestValidStorageURIPrefixOK(t *testing.T) { - g := gomega.NewGomegaWithT(t) - for _, prefix := range SupportedStorageURIPrefixList { - kfsvc := makeTestKFService() - kfsvc.Spec.Default.Predictor.Tensorflow.StorageURI = prefix + "foo/bar" - g.Expect(kfsvc.ValidateCreate()).Should(gomega.Succeed()) - } -} - -func TestEmptyStorageURIPrefixOK(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Default.Predictor.Tensorflow.StorageURI = "" - g.Expect(kfsvc.ValidateCreate()).Should(gomega.Succeed()) -} - -func TestLocalPathStorageURIPrefixOK(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Default.Predictor.Tensorflow.StorageURI = "some/relative/path" - g.Expect(kfsvc.ValidateCreate()).Should(gomega.Succeed()) - kfsvc.Spec.Default.Predictor.Tensorflow.StorageURI = "/some/absolute/path" - g.Expect(kfsvc.ValidateCreate()).Should(gomega.Succeed()) - kfsvc.Spec.Default.Predictor.Tensorflow.StorageURI = "/" - g.Expect(kfsvc.ValidateCreate()).Should(gomega.Succeed()) - kfsvc.Spec.Default.Predictor.Tensorflow.StorageURI = "foo" - g.Expect(kfsvc.ValidateCreate()).Should(gomega.Succeed()) -} - -func TestAzureBlobOK(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Default.Predictor.Tensorflow.StorageURI = "https://kfserving.blob.core.windows.net/tensorrt/simple_string/" - g.Expect(kfsvc.ValidateCreate()).Should(gomega.Succeed()) - kfsvc.Spec.Default.Predictor.Tensorflow.StorageURI = "https://kfserving.blob.core.windows.net/tensorrt/simple_string" - g.Expect(kfsvc.ValidateCreate()).Should(gomega.Succeed()) - kfsvc.Spec.Default.Predictor.Tensorflow.StorageURI = "https://kfserving.blob.core.windows.net/tensorrt/" - g.Expect(kfsvc.ValidateCreate()).Should(gomega.Succeed()) - kfsvc.Spec.Default.Predictor.Tensorflow.StorageURI = "https://kfserving.blob.core.windows.net/tensorrt" - g.Expect(kfsvc.ValidateCreate()).Should(gomega.Succeed()) -} - -func TestAzureBlobNoAccountFails(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Default.Predictor.Tensorflow.StorageURI = "https://blob.core.windows.net/tensorrt/simple_string/" - g.Expect(kfsvc.ValidateCreate()).ShouldNot(gomega.Succeed()) -} - -func TestAzureBlobNoContainerFails(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Default.Predictor.Tensorflow.StorageURI = "https://foo.blob.core.windows.net/" - g.Expect(kfsvc.ValidateCreate()).ShouldNot(gomega.Succeed()) -} - -func TestUnkownStorageURIPrefixFails(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Default.Predictor.Tensorflow.StorageURI = "blob://foo/bar" - g.Expect(kfsvc.ValidateCreate()).ShouldNot(gomega.Succeed()) -} - -func TestRejectMultipleModelSpecs(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Default.Predictor.Custom = &CustomSpec{Container: v1.Container{}} - g.Expect(kfsvc.ValidateCreate()).Should(gomega.MatchError(ExactlyOnePredictorViolatedError)) -} - -func TestRejectModelSpecMissing(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Default.Predictor.Tensorflow = nil - g.Expect(kfsvc.ValidateCreate()).Should(gomega.MatchError(ExactlyOnePredictorViolatedError)) -} -func TestRejectMultipleCanaryModelSpecs(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Canary = &EndpointSpec{ - Predictor: PredictorSpec{ - Custom: &CustomSpec{Container: v1.Container{}}, - Tensorflow: kfsvc.Spec.Default.Predictor.Tensorflow, - }, - } - g.Expect(kfsvc.ValidateCreate()).Should(gomega.MatchError(ExactlyOnePredictorViolatedError)) -} - -func TestRejectCanaryModelSpecMissing(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Canary = &EndpointSpec{ - Predictor: PredictorSpec{}, - } - g.Expect(kfsvc.ValidateCreate()).Should(gomega.MatchError(ExactlyOnePredictorViolatedError)) -} -func TestRejectBadCanaryTrafficValues(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Canary = &kfsvc.Spec.Default - kfsvc.Spec.CanaryTrafficPercent = -1 - g.Expect(kfsvc.ValidateCreate()).Should(gomega.MatchError(TrafficBoundsExceededError)) - kfsvc.Spec.CanaryTrafficPercent = 101 - g.Expect(kfsvc.ValidateCreate()).Should(gomega.MatchError(TrafficBoundsExceededError)) -} - -func TestRejectTrafficProvidedWithoutCanary(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.CanaryTrafficPercent = 1 - g.Expect(kfsvc.ValidateCreate()).Should(gomega.MatchError(TrafficProvidedWithoutCanaryError)) -} - -func TestBadReplicaValues(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Default.Predictor.MinReplicas = -1 - g.Expect(kfsvc.ValidateCreate()).Should(gomega.MatchError(MinReplicasLowerBoundExceededError)) - kfsvc.Spec.Default.Predictor.MinReplicas = 1 - kfsvc.Spec.Default.Predictor.MaxReplicas = -1 - g.Expect(kfsvc.ValidateCreate()).Should(gomega.MatchError(MaxReplicasLowerBoundExceededError)) - kfsvc.Spec.Default.Predictor.MinReplicas = 2 - kfsvc.Spec.Default.Predictor.MaxReplicas = 1 - g.Expect(kfsvc.ValidateCreate()).Should(gomega.MatchError(MinReplicasShouldBeLessThanMaxError)) -} - -func TestCustomBadFields(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Default.Predictor.Tensorflow = nil - kfsvc.Spec.Default.Predictor.Custom = &CustomSpec{ - v1.Container{ - Name: "foo", - Image: "custom:0.1", - Stdin: true, - StdinOnce: true, - }, - } - g.Expect(kfsvc.ValidateCreate()).Should(gomega.MatchError("Custom container validation error: must not set the field(s): stdin, stdinOnce")) -} - -func TestCustomOK(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Default.Predictor.Tensorflow = nil - kfsvc.Spec.Default.Predictor.Custom = &CustomSpec{ - v1.Container{ - Image: "custom:0.1", - }, - } - err := kfsvc.ValidateCreate() - fmt.Println(err) - g.Expect(kfsvc.ValidateCreate()).Should(gomega.Succeed()) -} - -func TestRejectBadTransformer(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Default.Transformer = &TransformerSpec{} - g.Expect(kfsvc.ValidateCreate()).Should(gomega.MatchError(ExactlyOneTransformerViolatedError)) -} - -func TestRejectBadExplainer(t *testing.T) { - g := gomega.NewGomegaWithT(t) - kfsvc := makeTestKFService() - kfsvc.Spec.Default.Explainer = &ExplainerSpec{} - g.Expect(kfsvc.ValidateCreate()).Should(gomega.MatchError(ExactlyOneExplainerViolatedError)) -} diff --git a/pkg/apis/serving/v1alpha2/openapi_generated.go b/pkg/apis/serving/v1alpha2/openapi_generated.go index 0609010aaa..c8eadea385 100644 --- a/pkg/apis/serving/v1alpha2/openapi_generated.go +++ b/pkg/apis/serving/v1alpha2/openapi_generated.go @@ -102,7 +102,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.DeploymentSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "DeploymentSpec defines the configuration for a given KFService service component", + Description: "DeploymentSpec defines the configuration for a given InferenceService service component", Properties: map[string]spec.Schema{ "serviceAccountName": { SchemaProps: spec.SchemaProps{ @@ -233,10 +233,10 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Dependencies: []string{ "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.ExplainerConfig"}, }, - "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.KFService": { + "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.InferenceService": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "KFService is the Schema for the services API", + Description: "InferenceService is the Schema for the services API", Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ @@ -259,24 +259,24 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "spec": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.KFServiceSpec"), + Ref: ref("github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.InferenceServiceSpec"), }, }, "status": { SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.KFServiceStatus"), + Ref: ref("github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.InferenceServiceStatus"), }, }, }, }, }, Dependencies: []string{ - "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.KFServiceSpec", "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.KFServiceStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, + "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.InferenceServiceSpec", "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.InferenceServiceStatus", "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"}, }, - "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.KFServiceList": { + "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.InferenceServiceList": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "KFServiceList contains a list of Service", + Description: "InferenceServiceList contains a list of Service", Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ @@ -303,7 +303,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Items: &spec.SchemaOrArray{ Schema: &spec.Schema{ SchemaProps: spec.SchemaProps{ - Ref: ref("github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.KFService"), + Ref: ref("github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.InferenceService"), }, }, }, @@ -314,16 +314,16 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, }, Dependencies: []string{ - "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.KFService", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, + "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.InferenceService", "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"}, }, - "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.KFServiceSpec": { + "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.InferenceServiceSpec": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "KFServiceSpec defines the desired state of KFService", + Description: "InferenceServiceSpec defines the desired state of InferenceService", Properties: map[string]spec.Schema{ "default": { SchemaProps: spec.SchemaProps{ - Description: "Default defines default KFService endpoints", + Description: "Default defines default InferenceService endpoints", Ref: ref("github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.EndpointSpec"), }, }, @@ -335,7 +335,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA }, "canaryTrafficPercent": { SchemaProps: spec.SchemaProps{ - Description: "CanaryTrafficPercent defines the percentage of traffic going to canary KFService endpoints", + Description: "CanaryTrafficPercent defines the percentage of traffic going to canary InferenceService endpoints", Type: []string{"integer"}, Format: "int32", }, @@ -347,10 +347,10 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA Dependencies: []string{ "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.EndpointSpec"}, }, - "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.KFServiceStatus": { + "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2.InferenceServiceStatus": { Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "KFServiceStatus defines the observed state of KFService", + Description: "InferenceServiceStatus defines the observed state of InferenceService", Properties: map[string]spec.Schema{ "observedGeneration": { SchemaProps: spec.SchemaProps{ diff --git a/pkg/apis/serving/v1alpha2/swagger.json b/pkg/apis/serving/v1alpha2/swagger.json index 9e0dba9c59..e374b4faaf 100644 --- a/pkg/apis/serving/v1alpha2/swagger.json +++ b/pkg/apis/serving/v1alpha2/swagger.json @@ -94,7 +94,7 @@ } }, "v1alpha2.DeploymentSpec": { - "description": "DeploymentSpec defines the configuration for a given KFService service component", + "description": "DeploymentSpec defines the configuration for a given InferenceService service component", "properties": { "maxReplicas": { "description": "This is the up bound for autoscaler to scale to", @@ -174,8 +174,8 @@ } } }, - "v1alpha2.KFService": { - "description": "KFService is the Schema for the services API", + "v1alpha2.InferenceService": { + "description": "InferenceService is the Schema for the services API", "properties": { "apiVersion": { "description": "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources", @@ -189,15 +189,15 @@ "$ref": "#/definitions/v1.ObjectMeta" }, "spec": { - "$ref": "#/definitions/v1alpha2.KFServiceSpec" + "$ref": "#/definitions/v1alpha2.InferenceServiceSpec" }, "status": { - "$ref": "#/definitions/v1alpha2.KFServiceStatus" + "$ref": "#/definitions/v1alpha2.InferenceServiceStatus" } } }, - "v1alpha2.KFServiceList": { - "description": "KFServiceList contains a list of Service", + "v1alpha2.InferenceServiceList": { + "description": "InferenceServiceList contains a list of Service", "required": [ "items" ], @@ -209,7 +209,7 @@ "items": { "type": "array", "items": { - "$ref": "#/definitions/v1alpha2.KFService" + "$ref": "#/definitions/v1alpha2.InferenceService" } }, "kind": { @@ -221,8 +221,8 @@ } } }, - "v1alpha2.KFServiceSpec": { - "description": "KFServiceSpec defines the desired state of KFService", + "v1alpha2.InferenceServiceSpec": { + "description": "InferenceServiceSpec defines the desired state of InferenceService", "required": [ "default" ], @@ -232,18 +232,18 @@ "$ref": "#/definitions/v1alpha2.EndpointSpec" }, "canaryTrafficPercent": { - "description": "CanaryTrafficPercent defines the percentage of traffic going to canary KFService endpoints", + "description": "CanaryTrafficPercent defines the percentage of traffic going to canary InferenceService endpoints", "type": "integer", "format": "int32" }, "default": { - "description": "Default defines default KFService endpoints", + "description": "Default defines default InferenceService endpoints", "$ref": "#/definitions/v1alpha2.EndpointSpec" } } }, - "v1alpha2.KFServiceStatus": { - "description": "KFServiceStatus defines the observed state of KFService", + "v1alpha2.InferenceServiceStatus": { + "description": "InferenceServiceStatus defines the observed state of InferenceService", "properties": { "canary": { "type": "object", diff --git a/pkg/apis/serving/v1alpha2/zz_generated.deepcopy.go b/pkg/apis/serving/v1alpha2/zz_generated.deepcopy.go index a71cb2e818..f4d3180ce5 100644 --- a/pkg/apis/serving/v1alpha2/zz_generated.deepcopy.go +++ b/pkg/apis/serving/v1alpha2/zz_generated.deepcopy.go @@ -200,7 +200,7 @@ func (in *ExplainersConfig) DeepCopy() *ExplainersConfig { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KFService) DeepCopyInto(out *KFService) { +func (in *InferenceService) DeepCopyInto(out *InferenceService) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) @@ -209,18 +209,18 @@ func (in *KFService) DeepCopyInto(out *KFService) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KFService. -func (in *KFService) DeepCopy() *KFService { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InferenceService. +func (in *InferenceService) DeepCopy() *InferenceService { if in == nil { return nil } - out := new(KFService) + out := new(InferenceService) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *KFService) DeepCopyObject() runtime.Object { +func (in *InferenceService) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -228,13 +228,13 @@ func (in *KFService) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KFServiceList) DeepCopyInto(out *KFServiceList) { +func (in *InferenceServiceList) DeepCopyInto(out *InferenceServiceList) { *out = *in out.TypeMeta = in.TypeMeta out.ListMeta = in.ListMeta if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]KFService, len(*in)) + *out = make([]InferenceService, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -242,18 +242,18 @@ func (in *KFServiceList) DeepCopyInto(out *KFServiceList) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KFServiceList. -func (in *KFServiceList) DeepCopy() *KFServiceList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InferenceServiceList. +func (in *InferenceServiceList) DeepCopy() *InferenceServiceList { if in == nil { return nil } - out := new(KFServiceList) + out := new(InferenceServiceList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *KFServiceList) DeepCopyObject() runtime.Object { +func (in *InferenceServiceList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -261,7 +261,7 @@ func (in *KFServiceList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KFServiceSpec) DeepCopyInto(out *KFServiceSpec) { +func (in *InferenceServiceSpec) DeepCopyInto(out *InferenceServiceSpec) { *out = *in in.Default.DeepCopyInto(&out.Default) if in.Canary != nil { @@ -272,18 +272,18 @@ func (in *KFServiceSpec) DeepCopyInto(out *KFServiceSpec) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KFServiceSpec. -func (in *KFServiceSpec) DeepCopy() *KFServiceSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InferenceServiceSpec. +func (in *InferenceServiceSpec) DeepCopy() *InferenceServiceSpec { if in == nil { return nil } - out := new(KFServiceSpec) + out := new(InferenceServiceSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *KFServiceStatus) DeepCopyInto(out *KFServiceStatus) { +func (in *InferenceServiceStatus) DeepCopyInto(out *InferenceServiceStatus) { *out = *in in.Status.DeepCopyInto(&out.Status) if in.Default != nil { @@ -291,7 +291,7 @@ func (in *KFServiceStatus) DeepCopyInto(out *KFServiceStatus) { *out = new(EndpointStatusMap) if **in != nil { in, out := *in, *out - *out = make(map[constants.KFServiceEndpoint]*StatusConfigurationSpec, len(*in)) + *out = make(map[constants.InferenceServiceEndpoint]*StatusConfigurationSpec, len(*in)) for key, val := range *in { var outVal *StatusConfigurationSpec if val == nil { @@ -310,7 +310,7 @@ func (in *KFServiceStatus) DeepCopyInto(out *KFServiceStatus) { *out = new(EndpointStatusMap) if **in != nil { in, out := *in, *out - *out = make(map[constants.KFServiceEndpoint]*StatusConfigurationSpec, len(*in)) + *out = make(map[constants.InferenceServiceEndpoint]*StatusConfigurationSpec, len(*in)) for key, val := range *in { var outVal *StatusConfigurationSpec if val == nil { @@ -327,12 +327,12 @@ func (in *KFServiceStatus) DeepCopyInto(out *KFServiceStatus) { return } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KFServiceStatus. -func (in *KFServiceStatus) DeepCopy() *KFServiceStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new InferenceServiceStatus. +func (in *InferenceServiceStatus) DeepCopy() *InferenceServiceStatus { if in == nil { return nil } - out := new(KFServiceStatus) + out := new(InferenceServiceStatus) in.DeepCopyInto(out) return out } diff --git a/pkg/client/clientset/versioned/typed/serving/v1alpha2/fake/fake_inferenceservice.go b/pkg/client/clientset/versioned/typed/serving/v1alpha2/fake/fake_inferenceservice.go new file mode 100644 index 0000000000..9eead6b369 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/serving/v1alpha2/fake/fake_inferenceservice.go @@ -0,0 +1,140 @@ +/* +Copyright The Kubernetes 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha2 "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeInferenceServices implements InferenceServiceInterface +type FakeInferenceServices struct { + Fake *FakeServingV1alpha2 + ns string +} + +var inferenceservicesResource = schema.GroupVersionResource{Group: "serving.kubeflow.org", Version: "v1alpha2", Resource: "inferenceservices"} + +var inferenceservicesKind = schema.GroupVersionKind{Group: "serving.kubeflow.org", Version: "v1alpha2", Kind: "InferenceService"} + +// Get takes name of the inferenceService, and returns the corresponding inferenceService object, and an error if there is any. +func (c *FakeInferenceServices) Get(name string, options v1.GetOptions) (result *v1alpha2.InferenceService, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(inferenceservicesResource, c.ns, name), &v1alpha2.InferenceService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.InferenceService), err +} + +// List takes label and field selectors, and returns the list of InferenceServices that match those selectors. +func (c *FakeInferenceServices) List(opts v1.ListOptions) (result *v1alpha2.InferenceServiceList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(inferenceservicesResource, inferenceservicesKind, c.ns, opts), &v1alpha2.InferenceServiceList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha2.InferenceServiceList{ListMeta: obj.(*v1alpha2.InferenceServiceList).ListMeta} + for _, item := range obj.(*v1alpha2.InferenceServiceList).Items { + if label.Matches(labels.Set(item.Labels)) { + list.Items = append(list.Items, item) + } + } + return list, err +} + +// Watch returns a watch.Interface that watches the requested inferenceServices. +func (c *FakeInferenceServices) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(inferenceservicesResource, c.ns, opts)) + +} + +// Create takes the representation of a inferenceService and creates it. Returns the server's representation of the inferenceService, and an error, if there is any. +func (c *FakeInferenceServices) Create(inferenceService *v1alpha2.InferenceService) (result *v1alpha2.InferenceService, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(inferenceservicesResource, c.ns, inferenceService), &v1alpha2.InferenceService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.InferenceService), err +} + +// Update takes the representation of a inferenceService and updates it. Returns the server's representation of the inferenceService, and an error, if there is any. +func (c *FakeInferenceServices) Update(inferenceService *v1alpha2.InferenceService) (result *v1alpha2.InferenceService, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(inferenceservicesResource, c.ns, inferenceService), &v1alpha2.InferenceService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.InferenceService), err +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). +func (c *FakeInferenceServices) UpdateStatus(inferenceService *v1alpha2.InferenceService) (*v1alpha2.InferenceService, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(inferenceservicesResource, "status", c.ns, inferenceService), &v1alpha2.InferenceService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.InferenceService), err +} + +// Delete takes name of the inferenceService and deletes it. Returns an error if one occurs. +func (c *FakeInferenceServices) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(inferenceservicesResource, c.ns, name), &v1alpha2.InferenceService{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeInferenceServices) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(inferenceservicesResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &v1alpha2.InferenceServiceList{}) + return err +} + +// Patch applies the patch and returns the patched inferenceService. +func (c *FakeInferenceServices) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.InferenceService, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(inferenceservicesResource, c.ns, name, data, subresources...), &v1alpha2.InferenceService{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.InferenceService), err +} diff --git a/pkg/client/clientset/versioned/typed/serving/v1alpha2/fake/fake_kfservice.go b/pkg/client/clientset/versioned/typed/serving/v1alpha2/fake/fake_kfservice.go deleted file mode 100644 index c4e77e303b..0000000000 --- a/pkg/client/clientset/versioned/typed/serving/v1alpha2/fake/fake_kfservice.go +++ /dev/null @@ -1,140 +0,0 @@ -/* -Copyright The Kubernetes 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package fake - -import ( - v1alpha2 "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - labels "k8s.io/apimachinery/pkg/labels" - schema "k8s.io/apimachinery/pkg/runtime/schema" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - testing "k8s.io/client-go/testing" -) - -// FakeKFServices implements KFServiceInterface -type FakeKFServices struct { - Fake *FakeServingV1alpha2 - ns string -} - -var kfservicesResource = schema.GroupVersionResource{Group: "serving.kubeflow.org", Version: "v1alpha2", Resource: "kfservices"} - -var kfservicesKind = schema.GroupVersionKind{Group: "serving.kubeflow.org", Version: "v1alpha2", Kind: "KFService"} - -// Get takes name of the kFService, and returns the corresponding kFService object, and an error if there is any. -func (c *FakeKFServices) Get(name string, options v1.GetOptions) (result *v1alpha2.KFService, err error) { - obj, err := c.Fake. - Invokes(testing.NewGetAction(kfservicesResource, c.ns, name), &v1alpha2.KFService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.KFService), err -} - -// List takes label and field selectors, and returns the list of KFServices that match those selectors. -func (c *FakeKFServices) List(opts v1.ListOptions) (result *v1alpha2.KFServiceList, err error) { - obj, err := c.Fake. - Invokes(testing.NewListAction(kfservicesResource, kfservicesKind, c.ns, opts), &v1alpha2.KFServiceList{}) - - if obj == nil { - return nil, err - } - - label, _, _ := testing.ExtractFromListOptions(opts) - if label == nil { - label = labels.Everything() - } - list := &v1alpha2.KFServiceList{ListMeta: obj.(*v1alpha2.KFServiceList).ListMeta} - for _, item := range obj.(*v1alpha2.KFServiceList).Items { - if label.Matches(labels.Set(item.Labels)) { - list.Items = append(list.Items, item) - } - } - return list, err -} - -// Watch returns a watch.Interface that watches the requested kFServices. -func (c *FakeKFServices) Watch(opts v1.ListOptions) (watch.Interface, error) { - return c.Fake. - InvokesWatch(testing.NewWatchAction(kfservicesResource, c.ns, opts)) - -} - -// Create takes the representation of a kFService and creates it. Returns the server's representation of the kFService, and an error, if there is any. -func (c *FakeKFServices) Create(kFService *v1alpha2.KFService) (result *v1alpha2.KFService, err error) { - obj, err := c.Fake. - Invokes(testing.NewCreateAction(kfservicesResource, c.ns, kFService), &v1alpha2.KFService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.KFService), err -} - -// Update takes the representation of a kFService and updates it. Returns the server's representation of the kFService, and an error, if there is any. -func (c *FakeKFServices) Update(kFService *v1alpha2.KFService) (result *v1alpha2.KFService, err error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateAction(kfservicesResource, c.ns, kFService), &v1alpha2.KFService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.KFService), err -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). -func (c *FakeKFServices) UpdateStatus(kFService *v1alpha2.KFService) (*v1alpha2.KFService, error) { - obj, err := c.Fake. - Invokes(testing.NewUpdateSubresourceAction(kfservicesResource, "status", c.ns, kFService), &v1alpha2.KFService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.KFService), err -} - -// Delete takes name of the kFService and deletes it. Returns an error if one occurs. -func (c *FakeKFServices) Delete(name string, options *v1.DeleteOptions) error { - _, err := c.Fake. - Invokes(testing.NewDeleteAction(kfservicesResource, c.ns, name), &v1alpha2.KFService{}) - - return err -} - -// DeleteCollection deletes a collection of objects. -func (c *FakeKFServices) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - action := testing.NewDeleteCollectionAction(kfservicesResource, c.ns, listOptions) - - _, err := c.Fake.Invokes(action, &v1alpha2.KFServiceList{}) - return err -} - -// Patch applies the patch and returns the patched kFService. -func (c *FakeKFServices) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.KFService, err error) { - obj, err := c.Fake. - Invokes(testing.NewPatchSubresourceAction(kfservicesResource, c.ns, name, data, subresources...), &v1alpha2.KFService{}) - - if obj == nil { - return nil, err - } - return obj.(*v1alpha2.KFService), err -} diff --git a/pkg/client/clientset/versioned/typed/serving/v1alpha2/fake/fake_serving_client.go b/pkg/client/clientset/versioned/typed/serving/v1alpha2/fake/fake_serving_client.go index 4aff698d4d..f79a8eb6f3 100644 --- a/pkg/client/clientset/versioned/typed/serving/v1alpha2/fake/fake_serving_client.go +++ b/pkg/client/clientset/versioned/typed/serving/v1alpha2/fake/fake_serving_client.go @@ -28,8 +28,8 @@ type FakeServingV1alpha2 struct { *testing.Fake } -func (c *FakeServingV1alpha2) KFServices(namespace string) v1alpha2.KFServiceInterface { - return &FakeKFServices{c, namespace} +func (c *FakeServingV1alpha2) InferenceServices(namespace string) v1alpha2.InferenceServiceInterface { + return &FakeInferenceServices{c, namespace} } // RESTClient returns a RESTClient that is used to communicate diff --git a/pkg/client/clientset/versioned/typed/serving/v1alpha2/generated_expansion.go b/pkg/client/clientset/versioned/typed/serving/v1alpha2/generated_expansion.go index f8a41a307a..6e4e6f3037 100644 --- a/pkg/client/clientset/versioned/typed/serving/v1alpha2/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/serving/v1alpha2/generated_expansion.go @@ -18,4 +18,4 @@ limitations under the License. package v1alpha2 -type KFServiceExpansion interface{} +type InferenceServiceExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/serving/v1alpha2/inferenceservice.go b/pkg/client/clientset/versioned/typed/serving/v1alpha2/inferenceservice.go new file mode 100644 index 0000000000..02faed78c9 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/serving/v1alpha2/inferenceservice.go @@ -0,0 +1,174 @@ +/* +Copyright The Kubernetes 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. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2" + scheme "github.com/kubeflow/kfserving/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" +) + +// InferenceServicesGetter has a method to return a InferenceServiceInterface. +// A group's client should implement this interface. +type InferenceServicesGetter interface { + InferenceServices(namespace string) InferenceServiceInterface +} + +// InferenceServiceInterface has methods to work with InferenceService resources. +type InferenceServiceInterface interface { + Create(*v1alpha2.InferenceService) (*v1alpha2.InferenceService, error) + Update(*v1alpha2.InferenceService) (*v1alpha2.InferenceService, error) + UpdateStatus(*v1alpha2.InferenceService) (*v1alpha2.InferenceService, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha2.InferenceService, error) + List(opts v1.ListOptions) (*v1alpha2.InferenceServiceList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.InferenceService, err error) + InferenceServiceExpansion +} + +// inferenceServices implements InferenceServiceInterface +type inferenceServices struct { + client rest.Interface + ns string +} + +// newInferenceServices returns a InferenceServices +func newInferenceServices(c *ServingV1alpha2Client, namespace string) *inferenceServices { + return &inferenceServices{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the inferenceService, and returns the corresponding inferenceService object, and an error if there is any. +func (c *inferenceServices) Get(name string, options v1.GetOptions) (result *v1alpha2.InferenceService, err error) { + result = &v1alpha2.InferenceService{} + err = c.client.Get(). + Namespace(c.ns). + Resource("inferenceservices"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of InferenceServices that match those selectors. +func (c *inferenceServices) List(opts v1.ListOptions) (result *v1alpha2.InferenceServiceList, err error) { + result = &v1alpha2.InferenceServiceList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("inferenceservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested inferenceServices. +func (c *inferenceServices) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("inferenceservices"). + VersionedParams(&opts, scheme.ParameterCodec). + Watch() +} + +// Create takes the representation of a inferenceService and creates it. Returns the server's representation of the inferenceService, and an error, if there is any. +func (c *inferenceServices) Create(inferenceService *v1alpha2.InferenceService) (result *v1alpha2.InferenceService, err error) { + result = &v1alpha2.InferenceService{} + err = c.client.Post(). + Namespace(c.ns). + Resource("inferenceservices"). + Body(inferenceService). + Do(). + Into(result) + return +} + +// Update takes the representation of a inferenceService and updates it. Returns the server's representation of the inferenceService, and an error, if there is any. +func (c *inferenceServices) Update(inferenceService *v1alpha2.InferenceService) (result *v1alpha2.InferenceService, err error) { + result = &v1alpha2.InferenceService{} + err = c.client.Put(). + Namespace(c.ns). + Resource("inferenceservices"). + Name(inferenceService.Name). + Body(inferenceService). + Do(). + Into(result) + return +} + +// UpdateStatus was generated because the type contains a Status member. +// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + +func (c *inferenceServices) UpdateStatus(inferenceService *v1alpha2.InferenceService) (result *v1alpha2.InferenceService, err error) { + result = &v1alpha2.InferenceService{} + err = c.client.Put(). + Namespace(c.ns). + Resource("inferenceservices"). + Name(inferenceService.Name). + SubResource("status"). + Body(inferenceService). + Do(). + Into(result) + return +} + +// Delete takes name of the inferenceService and deletes it. Returns an error if one occurs. +func (c *inferenceServices) Delete(name string, options *v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("inferenceservices"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *inferenceServices) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("inferenceservices"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched inferenceService. +func (c *inferenceServices) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.InferenceService, err error) { + result = &v1alpha2.InferenceService{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("inferenceservices"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/pkg/client/clientset/versioned/typed/serving/v1alpha2/kfservice.go b/pkg/client/clientset/versioned/typed/serving/v1alpha2/kfservice.go deleted file mode 100644 index c265c3e002..0000000000 --- a/pkg/client/clientset/versioned/typed/serving/v1alpha2/kfservice.go +++ /dev/null @@ -1,174 +0,0 @@ -/* -Copyright The Kubernetes 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. -*/ - -// Code generated by client-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - v1alpha2 "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2" - scheme "github.com/kubeflow/kfserving/pkg/client/clientset/versioned/scheme" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" - types "k8s.io/apimachinery/pkg/types" - watch "k8s.io/apimachinery/pkg/watch" - rest "k8s.io/client-go/rest" -) - -// KFServicesGetter has a method to return a KFServiceInterface. -// A group's client should implement this interface. -type KFServicesGetter interface { - KFServices(namespace string) KFServiceInterface -} - -// KFServiceInterface has methods to work with KFService resources. -type KFServiceInterface interface { - Create(*v1alpha2.KFService) (*v1alpha2.KFService, error) - Update(*v1alpha2.KFService) (*v1alpha2.KFService, error) - UpdateStatus(*v1alpha2.KFService) (*v1alpha2.KFService, error) - Delete(name string, options *v1.DeleteOptions) error - DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error - Get(name string, options v1.GetOptions) (*v1alpha2.KFService, error) - List(opts v1.ListOptions) (*v1alpha2.KFServiceList, error) - Watch(opts v1.ListOptions) (watch.Interface, error) - Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.KFService, err error) - KFServiceExpansion -} - -// kFServices implements KFServiceInterface -type kFServices struct { - client rest.Interface - ns string -} - -// newKFServices returns a KFServices -func newKFServices(c *ServingV1alpha2Client, namespace string) *kFServices { - return &kFServices{ - client: c.RESTClient(), - ns: namespace, - } -} - -// Get takes name of the kFService, and returns the corresponding kFService object, and an error if there is any. -func (c *kFServices) Get(name string, options v1.GetOptions) (result *v1alpha2.KFService, err error) { - result = &v1alpha2.KFService{} - err = c.client.Get(). - Namespace(c.ns). - Resource("kfservices"). - Name(name). - VersionedParams(&options, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// List takes label and field selectors, and returns the list of KFServices that match those selectors. -func (c *kFServices) List(opts v1.ListOptions) (result *v1alpha2.KFServiceList, err error) { - result = &v1alpha2.KFServiceList{} - err = c.client.Get(). - Namespace(c.ns). - Resource("kfservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Do(). - Into(result) - return -} - -// Watch returns a watch.Interface that watches the requested kFServices. -func (c *kFServices) Watch(opts v1.ListOptions) (watch.Interface, error) { - opts.Watch = true - return c.client.Get(). - Namespace(c.ns). - Resource("kfservices"). - VersionedParams(&opts, scheme.ParameterCodec). - Watch() -} - -// Create takes the representation of a kFService and creates it. Returns the server's representation of the kFService, and an error, if there is any. -func (c *kFServices) Create(kFService *v1alpha2.KFService) (result *v1alpha2.KFService, err error) { - result = &v1alpha2.KFService{} - err = c.client.Post(). - Namespace(c.ns). - Resource("kfservices"). - Body(kFService). - Do(). - Into(result) - return -} - -// Update takes the representation of a kFService and updates it. Returns the server's representation of the kFService, and an error, if there is any. -func (c *kFServices) Update(kFService *v1alpha2.KFService) (result *v1alpha2.KFService, err error) { - result = &v1alpha2.KFService{} - err = c.client.Put(). - Namespace(c.ns). - Resource("kfservices"). - Name(kFService.Name). - Body(kFService). - Do(). - Into(result) - return -} - -// UpdateStatus was generated because the type contains a Status member. -// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). - -func (c *kFServices) UpdateStatus(kFService *v1alpha2.KFService) (result *v1alpha2.KFService, err error) { - result = &v1alpha2.KFService{} - err = c.client.Put(). - Namespace(c.ns). - Resource("kfservices"). - Name(kFService.Name). - SubResource("status"). - Body(kFService). - Do(). - Into(result) - return -} - -// Delete takes name of the kFService and deletes it. Returns an error if one occurs. -func (c *kFServices) Delete(name string, options *v1.DeleteOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("kfservices"). - Name(name). - Body(options). - Do(). - Error() -} - -// DeleteCollection deletes a collection of objects. -func (c *kFServices) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { - return c.client.Delete(). - Namespace(c.ns). - Resource("kfservices"). - VersionedParams(&listOptions, scheme.ParameterCodec). - Body(options). - Do(). - Error() -} - -// Patch applies the patch and returns the patched kFService. -func (c *kFServices) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha2.KFService, err error) { - result = &v1alpha2.KFService{} - err = c.client.Patch(pt). - Namespace(c.ns). - Resource("kfservices"). - SubResource(subresources...). - Name(name). - Body(data). - Do(). - Into(result) - return -} diff --git a/pkg/client/clientset/versioned/typed/serving/v1alpha2/serving_client.go b/pkg/client/clientset/versioned/typed/serving/v1alpha2/serving_client.go index a527dcbecb..dd060addb3 100644 --- a/pkg/client/clientset/versioned/typed/serving/v1alpha2/serving_client.go +++ b/pkg/client/clientset/versioned/typed/serving/v1alpha2/serving_client.go @@ -27,7 +27,7 @@ import ( type ServingV1alpha2Interface interface { RESTClient() rest.Interface - KFServicesGetter + InferenceServicesGetter } // ServingV1alpha2Client is used to interact with features provided by the serving.kubeflow.org group. @@ -35,8 +35,8 @@ type ServingV1alpha2Client struct { restClient rest.Interface } -func (c *ServingV1alpha2Client) KFServices(namespace string) KFServiceInterface { - return newKFServices(c, namespace) +func (c *ServingV1alpha2Client) InferenceServices(namespace string) InferenceServiceInterface { + return newInferenceServices(c, namespace) } // NewForConfig creates a new ServingV1alpha2Client for the given config. diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 9ad92bd159..de065d1d13 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -53,8 +53,8 @@ func (f *genericInformer) Lister() cache.GenericLister { func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { // Group=serving.kubeflow.org, Version=v1alpha2 - case v1alpha2.SchemeGroupVersion.WithResource("kfservices"): - return &genericInformer{resource: resource.GroupResource(), informer: f.Serving().V1alpha2().KFServices().Informer()}, nil + case v1alpha2.SchemeGroupVersion.WithResource("inferenceservices"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Serving().V1alpha2().InferenceServices().Informer()}, nil } diff --git a/pkg/client/informers/externalversions/serving/v1alpha2/kfservice.go b/pkg/client/informers/externalversions/serving/v1alpha2/inferenceservice.go similarity index 55% rename from pkg/client/informers/externalversions/serving/v1alpha2/kfservice.go rename to pkg/client/informers/externalversions/serving/v1alpha2/inferenceservice.go index 9fe3855bce..5c4192065a 100644 --- a/pkg/client/informers/externalversions/serving/v1alpha2/kfservice.go +++ b/pkg/client/informers/externalversions/serving/v1alpha2/inferenceservice.go @@ -31,59 +31,59 @@ import ( cache "k8s.io/client-go/tools/cache" ) -// KFServiceInformer provides access to a shared informer and lister for -// KFServices. -type KFServiceInformer interface { +// InferenceServiceInformer provides access to a shared informer and lister for +// InferenceServices. +type InferenceServiceInformer interface { Informer() cache.SharedIndexInformer - Lister() v1alpha2.KFServiceLister + Lister() v1alpha2.InferenceServiceLister } -type kFServiceInformer struct { +type inferenceServiceInformer struct { factory internalinterfaces.SharedInformerFactory tweakListOptions internalinterfaces.TweakListOptionsFunc namespace string } -// NewKFServiceInformer constructs a new informer for KFService type. +// NewInferenceServiceInformer constructs a new informer for InferenceService type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewKFServiceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { - return NewFilteredKFServiceInformer(client, namespace, resyncPeriod, indexers, nil) +func NewInferenceServiceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredInferenceServiceInformer(client, namespace, resyncPeriod, indexers, nil) } -// NewFilteredKFServiceInformer constructs a new informer for KFService type. +// NewFilteredInferenceServiceInformer constructs a new informer for InferenceService type. // Always prefer using an informer factory to get a shared informer instead of getting an independent // one. This reduces memory footprint and number of connections to the server. -func NewFilteredKFServiceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { +func NewFilteredInferenceServiceInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { return cache.NewSharedIndexInformer( &cache.ListWatch{ ListFunc: func(options v1.ListOptions) (runtime.Object, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.ServingV1alpha2().KFServices(namespace).List(options) + return client.ServingV1alpha2().InferenceServices(namespace).List(options) }, WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { if tweakListOptions != nil { tweakListOptions(&options) } - return client.ServingV1alpha2().KFServices(namespace).Watch(options) + return client.ServingV1alpha2().InferenceServices(namespace).Watch(options) }, }, - &servingv1alpha2.KFService{}, + &servingv1alpha2.InferenceService{}, resyncPeriod, indexers, ) } -func (f *kFServiceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { - return NewFilteredKFServiceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +func (f *inferenceServiceInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredInferenceServiceInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) } -func (f *kFServiceInformer) Informer() cache.SharedIndexInformer { - return f.factory.InformerFor(&servingv1alpha2.KFService{}, f.defaultInformer) +func (f *inferenceServiceInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&servingv1alpha2.InferenceService{}, f.defaultInformer) } -func (f *kFServiceInformer) Lister() v1alpha2.KFServiceLister { - return v1alpha2.NewKFServiceLister(f.Informer().GetIndexer()) +func (f *inferenceServiceInformer) Lister() v1alpha2.InferenceServiceLister { + return v1alpha2.NewInferenceServiceLister(f.Informer().GetIndexer()) } diff --git a/pkg/client/informers/externalversions/serving/v1alpha2/interface.go b/pkg/client/informers/externalversions/serving/v1alpha2/interface.go index df01a9f7bf..af84a5c7b5 100644 --- a/pkg/client/informers/externalversions/serving/v1alpha2/interface.go +++ b/pkg/client/informers/externalversions/serving/v1alpha2/interface.go @@ -24,8 +24,8 @@ import ( // Interface provides access to all the informers in this group version. type Interface interface { - // KFServices returns a KFServiceInformer. - KFServices() KFServiceInformer + // InferenceServices returns a InferenceServiceInformer. + InferenceServices() InferenceServiceInformer } type version struct { @@ -39,7 +39,7 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } -// KFServices returns a KFServiceInformer. -func (v *version) KFServices() KFServiceInformer { - return &kFServiceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +// InferenceServices returns a InferenceServiceInformer. +func (v *version) InferenceServices() InferenceServiceInformer { + return &inferenceServiceInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } diff --git a/pkg/client/listers/serving/v1alpha2/expansion_generated.go b/pkg/client/listers/serving/v1alpha2/expansion_generated.go index 04f6b43530..746173e76b 100644 --- a/pkg/client/listers/serving/v1alpha2/expansion_generated.go +++ b/pkg/client/listers/serving/v1alpha2/expansion_generated.go @@ -18,10 +18,10 @@ limitations under the License. package v1alpha2 -// KFServiceListerExpansion allows custom methods to be added to -// KFServiceLister. -type KFServiceListerExpansion interface{} +// InferenceServiceListerExpansion allows custom methods to be added to +// InferenceServiceLister. +type InferenceServiceListerExpansion interface{} -// KFServiceNamespaceListerExpansion allows custom methods to be added to -// KFServiceNamespaceLister. -type KFServiceNamespaceListerExpansion interface{} +// InferenceServiceNamespaceListerExpansion allows custom methods to be added to +// InferenceServiceNamespaceLister. +type InferenceServiceNamespaceListerExpansion interface{} diff --git a/pkg/client/listers/serving/v1alpha2/inferenceservice.go b/pkg/client/listers/serving/v1alpha2/inferenceservice.go new file mode 100644 index 0000000000..809a6a7f14 --- /dev/null +++ b/pkg/client/listers/serving/v1alpha2/inferenceservice.go @@ -0,0 +1,94 @@ +/* +Copyright The Kubernetes 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. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha2 + +import ( + v1alpha2 "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2" + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// InferenceServiceLister helps list InferenceServices. +type InferenceServiceLister interface { + // List lists all InferenceServices in the indexer. + List(selector labels.Selector) (ret []*v1alpha2.InferenceService, err error) + // InferenceServices returns an object that can list and get InferenceServices. + InferenceServices(namespace string) InferenceServiceNamespaceLister + InferenceServiceListerExpansion +} + +// inferenceServiceLister implements the InferenceServiceLister interface. +type inferenceServiceLister struct { + indexer cache.Indexer +} + +// NewInferenceServiceLister returns a new InferenceServiceLister. +func NewInferenceServiceLister(indexer cache.Indexer) InferenceServiceLister { + return &inferenceServiceLister{indexer: indexer} +} + +// List lists all InferenceServices in the indexer. +func (s *inferenceServiceLister) List(selector labels.Selector) (ret []*v1alpha2.InferenceService, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.InferenceService)) + }) + return ret, err +} + +// InferenceServices returns an object that can list and get InferenceServices. +func (s *inferenceServiceLister) InferenceServices(namespace string) InferenceServiceNamespaceLister { + return inferenceServiceNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// InferenceServiceNamespaceLister helps list and get InferenceServices. +type InferenceServiceNamespaceLister interface { + // List lists all InferenceServices in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1alpha2.InferenceService, err error) + // Get retrieves the InferenceService from the indexer for a given namespace and name. + Get(name string) (*v1alpha2.InferenceService, error) + InferenceServiceNamespaceListerExpansion +} + +// inferenceServiceNamespaceLister implements the InferenceServiceNamespaceLister +// interface. +type inferenceServiceNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all InferenceServices in the indexer for a given namespace. +func (s inferenceServiceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.InferenceService, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.InferenceService)) + }) + return ret, err +} + +// Get retrieves the InferenceService from the indexer for a given namespace and name. +func (s inferenceServiceNamespaceLister) Get(name string) (*v1alpha2.InferenceService, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha2.Resource("inferenceservice"), name) + } + return obj.(*v1alpha2.InferenceService), nil +} diff --git a/pkg/client/listers/serving/v1alpha2/kfservice.go b/pkg/client/listers/serving/v1alpha2/kfservice.go deleted file mode 100644 index fc2059d32c..0000000000 --- a/pkg/client/listers/serving/v1alpha2/kfservice.go +++ /dev/null @@ -1,94 +0,0 @@ -/* -Copyright The Kubernetes 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. -*/ - -// Code generated by lister-gen. DO NOT EDIT. - -package v1alpha2 - -import ( - v1alpha2 "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2" - "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/labels" - "k8s.io/client-go/tools/cache" -) - -// KFServiceLister helps list KFServices. -type KFServiceLister interface { - // List lists all KFServices in the indexer. - List(selector labels.Selector) (ret []*v1alpha2.KFService, err error) - // KFServices returns an object that can list and get KFServices. - KFServices(namespace string) KFServiceNamespaceLister - KFServiceListerExpansion -} - -// kFServiceLister implements the KFServiceLister interface. -type kFServiceLister struct { - indexer cache.Indexer -} - -// NewKFServiceLister returns a new KFServiceLister. -func NewKFServiceLister(indexer cache.Indexer) KFServiceLister { - return &kFServiceLister{indexer: indexer} -} - -// List lists all KFServices in the indexer. -func (s *kFServiceLister) List(selector labels.Selector) (ret []*v1alpha2.KFService, err error) { - err = cache.ListAll(s.indexer, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.KFService)) - }) - return ret, err -} - -// KFServices returns an object that can list and get KFServices. -func (s *kFServiceLister) KFServices(namespace string) KFServiceNamespaceLister { - return kFServiceNamespaceLister{indexer: s.indexer, namespace: namespace} -} - -// KFServiceNamespaceLister helps list and get KFServices. -type KFServiceNamespaceLister interface { - // List lists all KFServices in the indexer for a given namespace. - List(selector labels.Selector) (ret []*v1alpha2.KFService, err error) - // Get retrieves the KFService from the indexer for a given namespace and name. - Get(name string) (*v1alpha2.KFService, error) - KFServiceNamespaceListerExpansion -} - -// kFServiceNamespaceLister implements the KFServiceNamespaceLister -// interface. -type kFServiceNamespaceLister struct { - indexer cache.Indexer - namespace string -} - -// List lists all KFServices in the indexer for a given namespace. -func (s kFServiceNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.KFService, err error) { - err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { - ret = append(ret, m.(*v1alpha2.KFService)) - }) - return ret, err -} - -// Get retrieves the KFService from the indexer for a given namespace and name. -func (s kFServiceNamespaceLister) Get(name string) (*v1alpha2.KFService, error) { - obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) - if err != nil { - return nil, err - } - if !exists { - return nil, errors.NewNotFound(v1alpha2.Resource("kfservice"), name) - } - return obj.(*v1alpha2.KFService), nil -} diff --git a/pkg/constants/constants.go b/pkg/constants/constants.go index 7293ae34e1..d6dfae3077 100644 --- a/pkg/constants/constants.go +++ b/pkg/constants/constants.go @@ -32,23 +32,23 @@ var ( KFServingNamespace = getEnvOrDefault("POD_NAMESPACE", "kfserving-system") ) -// KFService Constants +// InferenceService Constants var ( - KFServiceName = "kfservice" - KFServiceAPIName = "kfservices" - KFServicePodLabelKey = KFServingAPIGroupName + "/" + KFServiceName - KFServiceConfigMapName = "kfservice-config" + InferenceServiceName = "inferenceservice" + InferenceServiceAPIName = "inferenceservices" + InferenceServicePodLabelKey = KFServingAPIGroupName + "/" + InferenceServiceName + InferenceServiceConfigMapName = "inferenceservice-config" ) -// KFService Annotations +// InferenceService Annotations var ( - KFServiceGKEAcceleratorAnnotationKey = KFServingAPIGroupName + "/gke-accelerator" + InferenceServiceGKEAcceleratorAnnotationKey = KFServingAPIGroupName + "/gke-accelerator" ) -// KFService Internal Annotations +// InferenceService Internal Annotations var ( - KFServiceInternalAnnotationsPrefix = "internal." + KFServingAPIGroupName - StorageInitializerSourceUriInternalAnnotationKey = KFServiceInternalAnnotationsPrefix + "/storage-initializer-sourceuri" + InferenceServiceInternalAnnotationsPrefix = "internal." + KFServingAPIGroupName + StorageInitializerSourceUriInternalAnnotationKey = InferenceServiceInternalAnnotationsPrefix + "/storage-initializer-sourceuri" ) // Controller Constants @@ -60,15 +60,15 @@ var ( // Webhook Constants var ( - WebhookServerName = KFServingName + "-webhook-server" - WebhookServerServiceName = WebhookServerName + "-service" - WebhookServerSecretName = WebhookServerName + "-secret" - KFServiceValidatingWebhookConfigName = strings.Join([]string{KFServiceName, KFServingAPIGroupName}, ".") - KFServiceMutatingWebhookConfigName = strings.Join([]string{KFServiceName, KFServingAPIGroupName}, ".") - KFServiceValidatingWebhookName = strings.Join([]string{KFServiceName, WebhookServerName, "validator"}, ".") - KFServiceDefaultingWebhookName = strings.Join([]string{KFServiceName, WebhookServerName, "defaulter"}, ".") - PodMutatorWebhookName = strings.Join([]string{KFServiceName, WebhookServerName, "pod-mutator"}, ".") - WebhookFailurePolicy = v1beta1.Fail + WebhookServerName = KFServingName + "-webhook-server" + WebhookServerServiceName = WebhookServerName + "-service" + WebhookServerSecretName = WebhookServerName + "-secret" + InferenceServiceValidatingWebhookConfigName = strings.Join([]string{InferenceServiceName, KFServingAPIGroupName}, ".") + InferenceServiceMutatingWebhookConfigName = strings.Join([]string{InferenceServiceName, KFServingAPIGroupName}, ".") + InferenceServiceValidatingWebhookName = strings.Join([]string{InferenceServiceName, WebhookServerName, "validator"}, ".") + InferenceServiceDefaultingWebhookName = strings.Join([]string{InferenceServiceName, WebhookServerName, "defaulter"}, ".") + PodMutatorWebhookName = strings.Join([]string{InferenceServiceName, WebhookServerName, "pod-mutator"}, ".") + WebhookFailurePolicy = v1beta1.Fail ) // GPU Constants @@ -79,45 +79,45 @@ const ( // DefaultModelLocalMountPath is where models will be mounted by the storage-initializer const DefaultModelLocalMountPath = "/mnt/models" -// KFService Environment Variables +// InferenceService Environment Variables const ( CustomSpecStorageUriEnvVarKey = "STORAGE_URI" ) -type KFServiceEndpoint string +type InferenceServiceEndpoint string -type KFServiceVerb string +type InferenceServiceVerb string -// KFService Endpoint enums +// InferenceService Endpoint enums const ( - Predictor KFServiceEndpoint = "predictor" - Explainer KFServiceEndpoint = "explainer" - Transformer KFServiceEndpoint = "transformer" + Predictor InferenceServiceEndpoint = "predictor" + Explainer InferenceServiceEndpoint = "explainer" + Transformer InferenceServiceEndpoint = "transformer" ) -// KFService verb enums +// InferenceService verb enums const ( - Predict KFServiceVerb = "predict" - Explain KFServiceVerb = "explain" + Predict InferenceServiceVerb = "predict" + Explain InferenceServiceVerb = "explain" ) -// KFService default/canary constants +// InferenceService default/canary constants const ( - KFServiceDefault = "default" - KFServiceCanary = "canary" + InferenceServiceDefault = "default" + InferenceServiceCanary = "canary" ) -// KFService model server args +// InferenceService model server args const ( ArgumentModelName = "--model_name" ArgumentPredictorHost = "--predictor_host" ) -func (e KFServiceEndpoint) String() string { +func (e InferenceServiceEndpoint) String() string { return string(e) } -func (v KFServiceVerb) String() string { +func (v InferenceServiceVerb) String() string { return string(v) } @@ -129,11 +129,11 @@ func getEnvOrDefault(key string, fallback string) string { } func DefaultPredictorServiceName(name string) string { - return name + "-" + string(Predictor) + "-" + KFServiceDefault + return name + "-" + string(Predictor) + "-" + InferenceServiceDefault } func CanaryPredictorServiceName(name string) string { - return name + "-" + string(Predictor) + "-" + KFServiceCanary + return name + "-" + string(Predictor) + "-" + InferenceServiceCanary } func PredictRouteName(name string) string { @@ -141,11 +141,11 @@ func PredictRouteName(name string) string { } func DefaultExplainerServiceName(name string) string { - return name + "-" + string(Explainer) + "-" + KFServiceDefault + return name + "-" + string(Explainer) + "-" + InferenceServiceDefault } func CanaryExplainerServiceName(name string) string { - return name + "-" + string(Explainer) + "-" + KFServiceCanary + return name + "-" + string(Explainer) + "-" + InferenceServiceCanary } func ExplainRouteName(name string) string { @@ -153,22 +153,22 @@ func ExplainRouteName(name string) string { } func DefaultTransformerServiceName(name string) string { - return name + "-" + string(Transformer) + "-" + KFServiceDefault + return name + "-" + string(Transformer) + "-" + InferenceServiceDefault } func CanaryTransformerServiceName(name string) string { - return name + "-" + string(Transformer) + "-" + KFServiceCanary + return name + "-" + string(Transformer) + "-" + InferenceServiceCanary } -func DefaultServiceName(name string, endpoint KFServiceEndpoint) string { - return name + "-" + endpoint.String() + "-" + KFServiceDefault +func DefaultServiceName(name string, endpoint InferenceServiceEndpoint) string { + return name + "-" + endpoint.String() + "-" + InferenceServiceDefault } -func CanaryServiceName(name string, endpoint KFServiceEndpoint) string { - return name + "-" + endpoint.String() + "-" + KFServiceCanary +func CanaryServiceName(name string, endpoint InferenceServiceEndpoint) string { + return name + "-" + endpoint.String() + "-" + InferenceServiceCanary } -func RouteName(name string, verb KFServiceVerb) string { +func RouteName(name string, verb InferenceServiceVerb) string { return name + "-" + verb.String() } diff --git a/pkg/controller/add_kfservice.go b/pkg/controller/add_inferenceservice.go similarity index 81% rename from pkg/controller/add_kfservice.go rename to pkg/controller/add_inferenceservice.go index ccf404c0af..6e896dbccd 100644 --- a/pkg/controller/add_kfservice.go +++ b/pkg/controller/add_inferenceservice.go @@ -16,9 +16,9 @@ limitations under the License. package controller -import kfservice "github.com/kubeflow/kfserving/pkg/controller/kfservice" +import inferenceservice "github.com/kubeflow/kfserving/pkg/controller/inferenceservice" func init() { // AddToManagerFuncs is a list of functions to create controllers and add them to a manager. - AddToManagerFuncs = append(AddToManagerFuncs, kfservice.Add) + AddToManagerFuncs = append(AddToManagerFuncs, inferenceservice.Add) } diff --git a/pkg/controller/kfservice/kfservice_controller.go b/pkg/controller/inferenceservice/controller.go similarity index 78% rename from pkg/controller/kfservice/kfservice_controller.go rename to pkg/controller/inferenceservice/controller.go index b896c18dfa..bccf8da733 100644 --- a/pkg/controller/kfservice/kfservice_controller.go +++ b/pkg/controller/inferenceservice/controller.go @@ -18,10 +18,10 @@ package service import ( "context" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/reconcilers/istio" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/reconcilers/istio" "github.com/kubeflow/kfserving/pkg/constants" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/reconcilers/knative" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/reconcilers/knative" "k8s.io/apimachinery/pkg/types" v1 "k8s.io/api/core/v1" @@ -49,7 +49,7 @@ const ( var log = logf.Log.WithName(ControllerName) -// Add creates a new KFService Controller and adds it to the Manager with default RBAC. The Manager will set fields on the Controller +// Add creates a new InferenceService Controller and adds it to the Manager with default RBAC. The Manager will set fields on the Controller // and Start it when the Manager is Started. func Add(mgr manager.Manager) error { return add(mgr, newReconciler(mgr)) @@ -74,14 +74,14 @@ func add(mgr manager.Manager, r reconcile.Reconciler) error { return err } - // Watch for changes to KFService - if err = c.Watch(&source.Kind{Type: &kfserving.KFService{}}, &handler.EnqueueRequestForObject{}); err != nil { + // Watch for changes to InferenceService + if err = c.Watch(&source.Kind{Type: &kfserving.InferenceService{}}, &handler.EnqueueRequestForObject{}); err != nil { return err } kfservingController := &handler.EnqueueRequestForOwner{ IsController: true, - OwnerType: &kfserving.KFService{}, + OwnerType: &kfserving.InferenceService{}, } // Watch for changes to Knative Service @@ -103,7 +103,7 @@ type ReconcileService struct { // Reconciler is implemented by all subresources type Reconciler interface { - Reconcile(kfsvc *v1alpha2.KFService) error + Reconcile(isvc *v1alpha2.InferenceService) error } // Reconcile reads that state of the cluster for a Service object and makes changes based on the state read @@ -112,15 +112,15 @@ type Reconciler interface { // +kubebuilder:rbac:groups=serving.knative.dev,resources=services/status,verbs=get;update;patch // +kubebuilder:rbac:groups=networking.istio.io,resources=virtualservices,verbs=get;list;watch;create;update;patch;delete // +kubebuilder:rbac:groups=networking.istio.io,resources=virtualservices/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=serving.kubeflow.org,resources=kfservices,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=serving.kubeflow.org,resources=kfservices/status,verbs=get;update;patch +// +kubebuilder:rbac:groups=serving.kubeflow.org,resources=inferenceservices,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=serving.kubeflow.org,resources=inferenceservices/status,verbs=get;update;patch // +kubebuilder:rbac:groups=,resources=serviceaccounts,verbs=get;list;watch // +kubebuilder:rbac:groups=,resources=secrets,verbs=get;list;watch // +kubebuilder:rbac:groups=,resources=configmaps,verbs=get;list;watch func (r *ReconcileService) Reconcile(request reconcile.Request) (reconcile.Result, error) { - // Fetch the KFService instance - kfsvc := &kfserving.KFService{} - if err := r.Get(context.TODO(), request.NamespacedName, kfsvc); err != nil { + // Fetch the InferenceService instance + isvc := &kfserving.InferenceService{} + if err := r.Get(context.TODO(), request.NamespacedName, isvc); err != nil { if errors.IsNotFound(err) { // Object not found, return. Created objects are automatically garbage collected. // For additional cleanup logic use finalizers. @@ -130,9 +130,9 @@ func (r *ReconcileService) Reconcile(request reconcile.Request) (reconcile.Resul } configMap := &v1.ConfigMap{} - err := r.Get(context.TODO(), types.NamespacedName{Name: constants.KFServiceConfigMapName, Namespace: constants.KFServingNamespace}, configMap) + err := r.Get(context.TODO(), types.NamespacedName{Name: constants.InferenceServiceConfigMapName, Namespace: constants.KFServingNamespace}, configMap) if err != nil { - log.Error(err, "Failed to find config map", "name", constants.KFServiceConfigMapName) + log.Error(err, "Failed to find config map", "name", constants.InferenceServiceConfigMapName) // Error reading the object - requeue the request. return reconcile.Result{}, err } @@ -143,21 +143,21 @@ func (r *ReconcileService) Reconcile(request reconcile.Request) (reconcile.Resul } for _, reconciler := range reconcilers { - if err := reconciler.Reconcile(kfsvc); err != nil { + if err := reconciler.Reconcile(isvc); err != nil { log.Error(err, "Failed to reconcile") - r.Recorder.Eventf(kfsvc, v1.EventTypeWarning, "InternalError", err.Error()) + r.Recorder.Eventf(isvc, v1.EventTypeWarning, "InternalError", err.Error()) return reconcile.Result{}, err } } - if err = r.updateStatus(kfsvc); err != nil { - r.Recorder.Eventf(kfsvc, v1.EventTypeWarning, "InternalError", err.Error()) + if err = r.updateStatus(isvc); err != nil { + r.Recorder.Eventf(isvc, v1.EventTypeWarning, "InternalError", err.Error()) } return reconcile.Result{}, nil } -func (r *ReconcileService) updateStatus(desiredService *kfserving.KFService) error { - existing := &kfserving.KFService{} +func (r *ReconcileService) updateStatus(desiredService *kfserving.InferenceService) error { + existing := &kfserving.InferenceService{} namespacedName := types.NamespacedName{Name: desiredService.Name, Namespace: desiredService.Namespace} if err := r.Get(context.TODO(), namespacedName, existing); err != nil { if errors.IsNotFound(err) { @@ -171,9 +171,9 @@ func (r *ReconcileService) updateStatus(desiredService *kfserving.KFService) err // cache may be stale and we don't want to overwrite a prior update // to status with this stale state. } else if err := r.Update(context.TODO(), desiredService); err != nil { - log.Error(err, "Failed to update KFService status") + log.Error(err, "Failed to update InferenceService status") r.Recorder.Eventf(desiredService, v1.EventTypeWarning, "UpdateFailed", - "Failed to update status for KFService %q: %v", desiredService.Name, err) + "Failed to update status for InferenceService %q: %v", desiredService.Name, err) return err } else if err == nil { // If there was a difference and there was no error. diff --git a/pkg/controller/kfservice/kfservice_controller_test.go b/pkg/controller/inferenceservice/controller_test.go similarity index 92% rename from pkg/controller/kfservice/kfservice_controller_test.go rename to pkg/controller/inferenceservice/controller_test.go index 97be420af3..15c1036eb2 100644 --- a/pkg/controller/kfservice/kfservice_controller_test.go +++ b/pkg/controller/inferenceservice/controller_test.go @@ -71,7 +71,7 @@ func testUrl(name string) string { return fmt.Sprintf("http://%s.myns.myingress.com/v1/models/%s", name, name) } -func TestKFServiceWithOnlyPredictor(t *testing.T) { +func TestInferenceServiceWithOnlyPredictor(t *testing.T) { var serviceName = "foo" var expectedRequest = reconcile.Request{NamespacedName: types.NamespacedName{Name: serviceName, Namespace: "default"}} var serviceKey = expectedRequest.NamespacedName @@ -79,12 +79,12 @@ func TestKFServiceWithOnlyPredictor(t *testing.T) { Namespace: serviceKey.Namespace} var virtualServiceName = types.NamespacedName{Name: serviceKey.Name, Namespace: serviceKey.Namespace} - var instance = &kfserving.KFService{ + var instance = &kfserving.InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: serviceKey.Name, Namespace: serviceKey.Namespace, }, - Spec: kfserving.KFServiceSpec{ + Spec: kfserving.InferenceServiceSpec{ Default: kfserving.EndpointSpec{ Predictor: kfserving.PredictorSpec{ DeploymentSpec: kfserving.DeploymentSpec{ @@ -119,7 +119,7 @@ func TestKFServiceWithOnlyPredictor(t *testing.T) { // Create configmap var configMap = &v1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ - Name: constants.KFServiceConfigMapName, + Name: constants.InferenceServiceConfigMapName, Namespace: constants.KFServingNamespace, }, Data: configs, @@ -127,7 +127,7 @@ func TestKFServiceWithOnlyPredictor(t *testing.T) { g.Expect(c.Create(context.TODO(), configMap)).NotTo(gomega.HaveOccurred()) defer c.Delete(context.TODO(), configMap) - // Create the KFService object and expect the Reconcile and Knative service/routes to be created + // Create the InferenceService object and expect the Reconcile and Knative service/routes to be created defaultInstance := instance.DeepCopy() g.Expect(c.Create(context.TODO(), defaultInstance)).NotTo(gomega.HaveOccurred()) @@ -147,7 +147,7 @@ func TestKFServiceWithOnlyPredictor(t *testing.T) { ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": serviceName}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": serviceName}, Annotations: map[string]string{ "autoscaling.knative.dev/target": "1", "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", @@ -238,8 +238,8 @@ func TestKFServiceWithOnlyPredictor(t *testing.T) { } g.Expect(virtualService.Spec).To(gomega.Equal(expectedVirtualService.Spec)) - // verify if KFService status is updated - expectedKfsvcStatus := kfserving.KFServiceStatus{ + // verify if InferenceService status is updated + expectedKfsvcStatus := kfserving.InferenceServiceStatus{ Status: duckv1beta1.Status{ Conditions: duckv1beta1.Conditions{ { @@ -267,26 +267,26 @@ func TestKFServiceWithOnlyPredictor(t *testing.T) { }, Canary: &kfserving.EndpointStatusMap{}, } - g.Eventually(func() *kfserving.KFServiceStatus { - kfsvc := &kfserving.KFService{} - err := c.Get(context.TODO(), serviceKey, kfsvc) + g.Eventually(func() *kfserving.InferenceServiceStatus { + isvc := &kfserving.InferenceService{} + err := c.Get(context.TODO(), serviceKey, isvc) if err != nil { return nil } - return &kfsvc.Status + return &isvc.Status }, timeout).Should(testutils.BeSematicEqual(&expectedKfsvcStatus)) } -func TestKFServiceWithDefaultAndCanaryPredictor(t *testing.T) { +func TestInferenceServiceWithDefaultAndCanaryPredictor(t *testing.T) { var expectedCanaryRequest = reconcile.Request{NamespacedName: types.NamespacedName{Name: "bar", Namespace: "default"}} var canaryServiceKey = expectedCanaryRequest.NamespacedName - var canary = &kfserving.KFService{ + var canary = &kfserving.InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: canaryServiceKey.Name, Namespace: canaryServiceKey.Namespace, }, - Spec: kfserving.KFServiceSpec{ + Spec: kfserving.InferenceServiceSpec{ Default: kfserving.EndpointSpec{ Predictor: kfserving.PredictorSpec{ DeploymentSpec: kfserving.DeploymentSpec{ @@ -313,7 +313,7 @@ func TestKFServiceWithDefaultAndCanaryPredictor(t *testing.T) { }, }, }, - Status: kfserving.KFServiceStatus{ + Status: kfserving.InferenceServiceStatus{ URL: canaryServiceKey.Name + ".svc.cluster.local", Default: &kfserving.EndpointStatusMap{ constants.Predictor: &kfserving.StatusConfigurationSpec{ @@ -346,7 +346,7 @@ func TestKFServiceWithDefaultAndCanaryPredictor(t *testing.T) { // Create configmap var configMap = &v1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ - Name: constants.KFServiceConfigMapName, + Name: constants.InferenceServiceConfigMapName, Namespace: constants.KFServingNamespace, }, Data: configs, @@ -354,7 +354,7 @@ func TestKFServiceWithDefaultAndCanaryPredictor(t *testing.T) { g.Expect(c.Create(context.TODO(), configMap)).NotTo(gomega.HaveOccurred()) defer c.Delete(context.TODO(), configMap) - // Create the KFService object and expect the Reconcile and knative service to be created + // Create the InferenceService object and expect the Reconcile and knative service to be created canaryInstance := canary.DeepCopy() g.Expect(c.Create(context.TODO(), canaryInstance)).NotTo(gomega.HaveOccurred()) defer c.Delete(context.TODO(), canaryInstance) @@ -376,7 +376,7 @@ func TestKFServiceWithDefaultAndCanaryPredictor(t *testing.T) { ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": "bar"}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": "bar"}, Annotations: map[string]string{ "autoscaling.knative.dev/target": "1", "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", @@ -494,8 +494,8 @@ func TestKFServiceWithDefaultAndCanaryPredictor(t *testing.T) { } g.Expect(virtualService.Spec).To(gomega.Equal(expectedVirtualService.Spec)) - // verify if KFService status is updated - expectedKfsvcStatus := kfserving.KFServiceStatus{ + // verify if InferenceService status is updated + expectedKfsvcStatus := kfserving.InferenceServiceStatus{ Status: duckv1beta1.Status{ Conditions: duckv1beta1.Conditions{ { @@ -534,11 +534,11 @@ func TestKFServiceWithDefaultAndCanaryPredictor(t *testing.T) { }, } g.Eventually(func() string { - kfsvc := &kfserving.KFService{} - if err := c.Get(context.TODO(), canaryServiceKey, kfsvc); err != nil { + isvc := &kfserving.InferenceService{} + if err := c.Get(context.TODO(), canaryServiceKey, isvc); err != nil { return err.Error() } - return cmp.Diff(&expectedKfsvcStatus, &kfsvc.Status, cmpopts.IgnoreTypes(apis.VolatileTime{})) + return cmp.Diff(&expectedKfsvcStatus, &isvc.Status, cmpopts.IgnoreTypes(apis.VolatileTime{})) }, timeout).Should(gomega.BeEmpty()) } @@ -554,12 +554,12 @@ func TestCanaryDelete(t *testing.T) { var expectedCanaryRequest = reconcile.Request{NamespacedName: types.NamespacedName{Name: serviceName, Namespace: namespace}} var canaryServiceKey = expectedCanaryRequest.NamespacedName - var canary = &kfserving.KFService{ + var canary = &kfserving.InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: canaryServiceKey.Name, Namespace: canaryServiceKey.Namespace, }, - Spec: kfserving.KFServiceSpec{ + Spec: kfserving.InferenceServiceSpec{ Default: kfserving.EndpointSpec{ Predictor: kfserving.PredictorSpec{ DeploymentSpec: kfserving.DeploymentSpec{ @@ -586,7 +586,7 @@ func TestCanaryDelete(t *testing.T) { }, }, }, - Status: kfserving.KFServiceStatus{ + Status: kfserving.InferenceServiceStatus{ URL: canaryServiceKey.Name + ".svc.cluster.local", Default: &kfserving.EndpointStatusMap{ constants.Predictor: &kfserving.StatusConfigurationSpec{ @@ -614,7 +614,7 @@ func TestCanaryDelete(t *testing.T) { // Create configmap var configMap = &v1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ - Name: constants.KFServiceConfigMapName, + Name: constants.InferenceServiceConfigMapName, Namespace: constants.KFServingNamespace, }, Data: configs, @@ -622,7 +622,7 @@ func TestCanaryDelete(t *testing.T) { g.Expect(c.Create(context.TODO(), configMap)).NotTo(gomega.HaveOccurred()) defer c.Delete(context.TODO(), configMap) - // Create the KFService object and expect the Reconcile + // Create the InferenceService object and expect the Reconcile // Default and Canary service should be present canaryInstance := canary.DeepCopy() canaryInstance.Name = serviceName @@ -672,8 +672,8 @@ func TestCanaryDelete(t *testing.T) { g.Expect(len(virtualService.Spec.HTTP)).To(gomega.Equal(1)) g.Expect(len(virtualService.Spec.HTTP[0].Route)).To(gomega.Equal(2)) - // Verify if KFService status is updated - expectedKfsvcStatus := kfserving.KFServiceStatus{ + // Verify if InferenceService status is updated + expectedKfsvcStatus := kfserving.InferenceServiceStatus{ Status: duckv1beta1.Status{ Conditions: duckv1beta1.Conditions{ { @@ -712,7 +712,7 @@ func TestCanaryDelete(t *testing.T) { }, } - canaryUpdate := &kfserving.KFService{} + canaryUpdate := &kfserving.InferenceService{} g.Eventually(func() string { if err := c.Get(context.TODO(), canaryServiceKey, canaryUpdate); err != nil { return err.Error() @@ -739,7 +739,7 @@ func TestCanaryDelete(t *testing.T) { return errors.IsNotFound(err) }, timeout).Should(gomega.BeTrue()) - expectedKfsvcStatus = kfserving.KFServiceStatus{ + expectedKfsvcStatus = kfserving.InferenceServiceStatus{ Status: duckv1beta1.Status{ Conditions: duckv1beta1.Conditions{ { @@ -766,13 +766,13 @@ func TestCanaryDelete(t *testing.T) { }, Canary: &kfserving.EndpointStatusMap{}, } - g.Eventually(func() *kfserving.KFServiceStatus { - kfsvc := &kfserving.KFService{} - err := c.Get(context.TODO(), canaryServiceKey, kfsvc) + g.Eventually(func() *kfserving.InferenceServiceStatus { + isvc := &kfserving.InferenceService{} + err := c.Get(context.TODO(), canaryServiceKey, isvc) if err != nil { return nil } - return &kfsvc.Status + return &isvc.Status }, timeout).Should(testutils.BeSematicEqual(&expectedKfsvcStatus)) // should see a virtual service with only 1 route @@ -784,7 +784,7 @@ func TestCanaryDelete(t *testing.T) { } -func TestKFServiceWithTransformer(t *testing.T) { +func TestInferenceServiceWithTransformer(t *testing.T) { serviceName := "svc-with-transformer" namespace := "default" var expectedRequest = reconcile.Request{NamespacedName: types.NamespacedName{Name: serviceName, Namespace: namespace}} @@ -799,12 +799,12 @@ func TestKFServiceWithTransformer(t *testing.T) { var canaryTransformer = types.NamespacedName{Name: constants.CanaryTransformerServiceName(serviceName), Namespace: namespace} var virtualServiceName = types.NamespacedName{Name: serviceName, Namespace: namespace} - var transformer = &kfserving.KFService{ + var transformer = &kfserving.InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: serviceName, Namespace: namespace, }, - Spec: kfserving.KFServiceSpec{ + Spec: kfserving.InferenceServiceSpec{ Default: kfserving.EndpointSpec{ Predictor: kfserving.PredictorSpec{ DeploymentSpec: kfserving.DeploymentSpec{ @@ -853,7 +853,7 @@ func TestKFServiceWithTransformer(t *testing.T) { }, }, }, - Status: kfserving.KFServiceStatus{ + Status: kfserving.InferenceServiceStatus{ URL: serviceName + ".svc.cluster.local", Default: &kfserving.EndpointStatusMap{ constants.Predictor: &kfserving.StatusConfigurationSpec{ @@ -882,7 +882,7 @@ func TestKFServiceWithTransformer(t *testing.T) { // Create configmap var configMap = &v1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ - Name: constants.KFServiceConfigMapName, + Name: constants.InferenceServiceConfigMapName, Namespace: constants.KFServingNamespace, }, Data: configs, @@ -890,7 +890,7 @@ func TestKFServiceWithTransformer(t *testing.T) { g.Expect(c.Create(context.TODO(), configMap)).NotTo(gomega.HaveOccurred()) defer c.Delete(context.TODO(), configMap) - // Create the KFService object and expect the Reconcile and knative service to be created + // Create the InferenceService object and expect the Reconcile and knative service to be created instance := transformer.DeepCopy() g.Expect(c.Create(context.TODO(), instance)).NotTo(gomega.HaveOccurred()) defer c.Delete(context.TODO(), instance) @@ -920,7 +920,7 @@ func TestKFServiceWithTransformer(t *testing.T) { ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": serviceName}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": serviceName}, Annotations: map[string]string{ "autoscaling.knative.dev/target": "1", "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", @@ -1012,8 +1012,8 @@ func TestKFServiceWithTransformer(t *testing.T) { g.Eventually(requests, timeout).Should(gomega.Receive(gomega.Equal(expectedRequest))) } - // verify if KFService status is updated - expectedKfsvcStatus := kfserving.KFServiceStatus{ + // verify if InferenceService status is updated + expectedKfsvcStatus := kfserving.InferenceServiceStatus{ Status: duckv1beta1.Status{ Conditions: duckv1beta1.Conditions{ { @@ -1070,11 +1070,11 @@ func TestKFServiceWithTransformer(t *testing.T) { }, } g.Eventually(func() string { - kfsvc := &kfserving.KFService{} - if err := c.Get(context.TODO(), serviceKey, kfsvc); err != nil { + isvc := &kfserving.InferenceService{} + if err := c.Get(context.TODO(), serviceKey, isvc); err != nil { return err.Error() } - return cmp.Diff(&expectedKfsvcStatus, &kfsvc.Status, cmpopts.IgnoreTypes(apis.VolatileTime{})) + return cmp.Diff(&expectedKfsvcStatus, &isvc.Status, cmpopts.IgnoreTypes(apis.VolatileTime{})) }, timeout).Should(gomega.BeEmpty()) // verify virtual service points to transformer diff --git a/pkg/controller/kfservice/reconcilers/istio/virtualservice_reconciler.go b/pkg/controller/inferenceservice/reconcilers/istio/virtualservice_reconciler.go similarity index 84% rename from pkg/controller/kfservice/reconcilers/istio/virtualservice_reconciler.go rename to pkg/controller/inferenceservice/reconcilers/istio/virtualservice_reconciler.go index 25a092b82f..13ad2baa3e 100644 --- a/pkg/controller/kfservice/reconcilers/istio/virtualservice_reconciler.go +++ b/pkg/controller/inferenceservice/reconcilers/istio/virtualservice_reconciler.go @@ -21,7 +21,7 @@ import ( "fmt" "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/resources/istio" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/resources/istio" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" @@ -50,27 +50,27 @@ func NewVirtualServiceReconciler(client client.Client, scheme *runtime.Scheme, c } } -func (r *VirtualServiceReconciler) Reconcile(kfsvc *v1alpha2.KFService) error { - desired, status := r.serviceBuilder.CreateVirtualService(kfsvc) +func (r *VirtualServiceReconciler) Reconcile(isvc *v1alpha2.InferenceService) error { + desired, status := r.serviceBuilder.CreateVirtualService(isvc) if desired == nil { if status != nil { - kfsvc.Status.PropagateRouteStatus(status) + isvc.Status.PropagateRouteStatus(status) return nil } return fmt.Errorf("failed to reconcile virtual service: desired and status are nil") } - if err := r.reconcileVirtualService(kfsvc, desired); err != nil { + if err := r.reconcileVirtualService(isvc, desired); err != nil { return err } - kfsvc.Status.PropagateRouteStatus(status) + isvc.Status.PropagateRouteStatus(status) return nil } -func (r *VirtualServiceReconciler) reconcileVirtualService(kfsvc *v1alpha2.KFService, desired *istiov1alpha3.VirtualService) error { - if err := controllerutil.SetControllerReference(kfsvc, desired, r.scheme); err != nil { +func (r *VirtualServiceReconciler) reconcileVirtualService(isvc *v1alpha2.InferenceService, desired *istiov1alpha3.VirtualService) error { + if err := controllerutil.SetControllerReference(isvc, desired, r.scheme); err != nil { return err } diff --git a/pkg/controller/kfservice/reconcilers/knative/service_reconciler.go b/pkg/controller/inferenceservice/reconcilers/knative/service_reconciler.go similarity index 67% rename from pkg/controller/kfservice/reconcilers/knative/service_reconciler.go rename to pkg/controller/inferenceservice/reconcilers/knative/service_reconciler.go index 57e4972b16..5bfdb387a8 100644 --- a/pkg/controller/kfservice/reconcilers/knative/service_reconciler.go +++ b/pkg/controller/inferenceservice/reconcilers/knative/service_reconciler.go @@ -22,7 +22,7 @@ import ( "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2" "github.com/kubeflow/kfserving/pkg/constants" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/resources/knative" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/resources/knative" "knative.dev/pkg/kmp" knservingv1alpha1 "knative.dev/serving/pkg/apis/serving/v1alpha1" @@ -54,48 +54,48 @@ func NewServiceReconciler(client client.Client, scheme *runtime.Scheme, config * } } -func (r *ServiceReconciler) Reconcile(kfsvc *v1alpha2.KFService) error { - if err := r.reconcileDefault(kfsvc); err != nil { +func (r *ServiceReconciler) Reconcile(isvc *v1alpha2.InferenceService) error { + if err := r.reconcileDefault(isvc); err != nil { return err } - if err := r.reconcileCanary(kfsvc); err != nil { + if err := r.reconcileCanary(isvc); err != nil { return err } return nil } -func (r *ServiceReconciler) reconcileDefault(kfsvc *v1alpha2.KFService) error { - for _, endpoint := range []constants.KFServiceEndpoint{constants.Predictor, constants.Transformer, constants.Explainer} { - if err := r.reconcileEndpoint(kfsvc, endpoint, false); err != nil { +func (r *ServiceReconciler) reconcileDefault(isvc *v1alpha2.InferenceService) error { + for _, endpoint := range []constants.InferenceServiceEndpoint{constants.Predictor, constants.Transformer, constants.Explainer} { + if err := r.reconcileEndpoint(isvc, endpoint, false); err != nil { return err } } return nil } -func (r *ServiceReconciler) reconcileCanary(kfsvc *v1alpha2.KFService) error { - for _, endpoint := range []constants.KFServiceEndpoint{constants.Predictor, constants.Transformer, constants.Explainer} { - if err := r.reconcileEndpoint(kfsvc, endpoint, true); err != nil { +func (r *ServiceReconciler) reconcileCanary(isvc *v1alpha2.InferenceService) error { + for _, endpoint := range []constants.InferenceServiceEndpoint{constants.Predictor, constants.Transformer, constants.Explainer} { + if err := r.reconcileEndpoint(isvc, endpoint, true); err != nil { return err } } return nil } -func (r *ServiceReconciler) reconcileEndpoint(kfsvc *v1alpha2.KFService, endpoint constants.KFServiceEndpoint, isCanary bool) error { +func (r *ServiceReconciler) reconcileEndpoint(isvc *v1alpha2.InferenceService, endpoint constants.InferenceServiceEndpoint, isCanary bool) error { if isCanary { - if kfsvc.Spec.Canary == nil { - if err := r.finalizeCanaryService(kfsvc, endpoint); err != nil { + if isvc.Spec.Canary == nil { + if err := r.finalizeCanaryService(isvc, endpoint); err != nil { return err } - kfsvc.Status.PropagateCanaryStatus(endpoint, nil) + isvc.Status.PropagateCanaryStatus(endpoint, nil) return nil } } service, err := r.serviceBuilder.CreateEndpointService( - kfsvc, + isvc, endpoint, isCanary, ) @@ -108,27 +108,27 @@ func (r *ServiceReconciler) reconcileEndpoint(kfsvc *v1alpha2.KFService, endpoin return nil } - status, err := r.reconcileService(kfsvc, service) + status, err := r.reconcileService(isvc, service) if err != nil { return err } if isCanary { - kfsvc.Status.PropagateCanaryStatus(endpoint, status) + isvc.Status.PropagateCanaryStatus(endpoint, status) } else { - kfsvc.Status.PropagateDefaultStatus(endpoint, status) + isvc.Status.PropagateDefaultStatus(endpoint, status) } return nil } -func (r *ServiceReconciler) finalizeCanaryService(kfsvc *v1alpha2.KFService, endpoint constants.KFServiceEndpoint) error { - canaryServiceName := constants.CanaryServiceName(kfsvc.Name, endpoint) +func (r *ServiceReconciler) finalizeCanaryService(isvc *v1alpha2.InferenceService, endpoint constants.InferenceServiceEndpoint) error { + canaryServiceName := constants.CanaryServiceName(isvc.Name, endpoint) existing := &knservingv1alpha1.Service{} - if err := r.client.Get(context.TODO(), types.NamespacedName{Name: canaryServiceName, Namespace: kfsvc.Namespace}, existing); err != nil { + if err := r.client.Get(context.TODO(), types.NamespacedName{Name: canaryServiceName, Namespace: isvc.Namespace}, existing); err != nil { if !errors.IsNotFound(err) { return err } } else { - log.Info("Deleting service", "namespace", kfsvc.Namespace, "name", canaryServiceName) + log.Info("Deleting service", "namespace", isvc.Namespace, "name", canaryServiceName) if err := r.client.Delete(context.TODO(), existing, client.PropagationPolicy(metav1.DeletePropagationBackground)); err != nil { if !errors.IsNotFound(err) { return err @@ -138,8 +138,8 @@ func (r *ServiceReconciler) finalizeCanaryService(kfsvc *v1alpha2.KFService, end return nil } -func (r *ServiceReconciler) reconcileService(kfsvc *v1alpha2.KFService, desired *knservingv1alpha1.Service) (*knservingv1alpha1.ServiceStatus, error) { - if err := controllerutil.SetControllerReference(kfsvc, desired, r.scheme); err != nil { +func (r *ServiceReconciler) reconcileService(isvc *v1alpha2.InferenceService, desired *knservingv1alpha1.Service) (*knservingv1alpha1.ServiceStatus, error) { + if err := controllerutil.SetControllerReference(isvc, desired, r.scheme); err != nil { return nil, err } // Create service if does not exist diff --git a/pkg/controller/kfservice/reconcilers/knative/service_reconciler_test.go b/pkg/controller/inferenceservice/reconcilers/knative/service_reconciler_test.go similarity index 92% rename from pkg/controller/kfservice/reconcilers/knative/service_reconciler_test.go rename to pkg/controller/inferenceservice/reconcilers/knative/service_reconciler_test.go index 52196fbb47..3fc46c08f5 100644 --- a/pkg/controller/kfservice/reconcilers/knative/service_reconciler_test.go +++ b/pkg/controller/inferenceservice/reconcilers/knative/service_reconciler_test.go @@ -53,17 +53,17 @@ func TestKnativeServiceReconcile(t *testing.T) { serviceReconciler := NewServiceReconciler(c, mgr.GetScheme(), &v1.ConfigMap{}) scenarios := map[string]struct { - kfsvc v1alpha2.KFService + isvc v1alpha2.InferenceService desiredDefault *knservingv1alpha1.Service desiredCanary *knservingv1alpha1.Service }{ "Reconcile creates default and canary service": { - kfsvc: v1alpha2.KFService{ + isvc: v1alpha2.InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: "mnist", Namespace: "default", }, - Spec: v1alpha2.KFServiceSpec{ + Spec: v1alpha2.InferenceServiceSpec{ Default: v1alpha2.EndpointSpec{ Predictor: v1alpha2.PredictorSpec{ Tensorflow: &v1alpha2.TensorflowSpec{ @@ -91,7 +91,7 @@ func TestKnativeServiceReconcile(t *testing.T) { ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": "mnist"}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": "mnist"}, Annotations: map[string]string{ "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", "autoscaling.knative.dev/target": "1", @@ -130,7 +130,7 @@ func TestKnativeServiceReconcile(t *testing.T) { ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": "mnist"}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": "mnist"}, Annotations: map[string]string{ "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", "autoscaling.knative.dev/target": "1", @@ -162,12 +162,12 @@ func TestKnativeServiceReconcile(t *testing.T) { }, }, "Reconcile ignores canary if unspecified": { - kfsvc: v1alpha2.KFService{ + isvc: v1alpha2.InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: "mnist", Namespace: "default", }, - Spec: v1alpha2.KFServiceSpec{ + Spec: v1alpha2.InferenceServiceSpec{ Default: v1alpha2.EndpointSpec{ Predictor: v1alpha2.PredictorSpec{ Tensorflow: &v1alpha2.TensorflowSpec{ @@ -187,7 +187,7 @@ func TestKnativeServiceReconcile(t *testing.T) { ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": "mnist"}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": "mnist"}, Annotations: map[string]string{ "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", "autoscaling.knative.dev/target": "1", @@ -222,16 +222,16 @@ func TestKnativeServiceReconcile(t *testing.T) { } for name, scenario := range scenarios { t.Logf("Scenario: %s", name) - g.Expect(c.Create(context.TODO(), &scenario.kfsvc)).NotTo(gomega.HaveOccurred()) + g.Expect(c.Create(context.TODO(), &scenario.isvc)).NotTo(gomega.HaveOccurred()) - if err := serviceReconciler.Reconcile(&scenario.kfsvc); err != nil { + if err := serviceReconciler.Reconcile(&scenario.isvc); err != nil { t.Errorf("Test %q failed: returned error: %v", name, err) } g.Eventually(func() error { return awaitDesired(c, scenario.desiredDefault) }, timeout).Should(gomega.Succeed()) g.Eventually(func() error { return awaitDesired(c, scenario.desiredCanary) }, timeout).Should(gomega.Succeed()) - g.Expect(c.Delete(context.TODO(), &scenario.kfsvc)).NotTo(gomega.HaveOccurred()) + g.Expect(c.Delete(context.TODO(), &scenario.isvc)).NotTo(gomega.HaveOccurred()) } } diff --git a/pkg/controller/kfservice/reconcilers/knative/suite_test.go b/pkg/controller/inferenceservice/reconcilers/knative/suite_test.go similarity index 100% rename from pkg/controller/kfservice/reconcilers/knative/suite_test.go rename to pkg/controller/inferenceservice/reconcilers/knative/suite_test.go diff --git a/pkg/controller/kfservice/resources/credentials/azure/azure_secret.go b/pkg/controller/inferenceservice/resources/credentials/azure/azure_secret.go similarity index 100% rename from pkg/controller/kfservice/resources/credentials/azure/azure_secret.go rename to pkg/controller/inferenceservice/resources/credentials/azure/azure_secret.go diff --git a/pkg/controller/kfservice/resources/credentials/azure/azure_secret_test.go b/pkg/controller/inferenceservice/resources/credentials/azure/azure_secret_test.go similarity index 100% rename from pkg/controller/kfservice/resources/credentials/azure/azure_secret_test.go rename to pkg/controller/inferenceservice/resources/credentials/azure/azure_secret_test.go diff --git a/pkg/controller/kfservice/resources/credentials/credentials_suite_test.go b/pkg/controller/inferenceservice/resources/credentials/credentials_suite_test.go similarity index 100% rename from pkg/controller/kfservice/resources/credentials/credentials_suite_test.go rename to pkg/controller/inferenceservice/resources/credentials/credentials_suite_test.go diff --git a/pkg/controller/kfservice/resources/credentials/gcs/gcs_secret.go b/pkg/controller/inferenceservice/resources/credentials/gcs/gcs_secret.go similarity index 100% rename from pkg/controller/kfservice/resources/credentials/gcs/gcs_secret.go rename to pkg/controller/inferenceservice/resources/credentials/gcs/gcs_secret.go diff --git a/pkg/controller/kfservice/resources/credentials/gcs/gcs_secret_test.go b/pkg/controller/inferenceservice/resources/credentials/gcs/gcs_secret_test.go similarity index 100% rename from pkg/controller/kfservice/resources/credentials/gcs/gcs_secret_test.go rename to pkg/controller/inferenceservice/resources/credentials/gcs/gcs_secret_test.go diff --git a/pkg/controller/kfservice/resources/credentials/s3/s3_secret.go b/pkg/controller/inferenceservice/resources/credentials/s3/s3_secret.go similarity index 79% rename from pkg/controller/kfservice/resources/credentials/s3/s3_secret.go rename to pkg/controller/inferenceservice/resources/credentials/s3/s3_secret.go index 44ffa7a23a..99735ccb78 100644 --- a/pkg/controller/kfservice/resources/credentials/s3/s3_secret.go +++ b/pkg/controller/inferenceservice/resources/credentials/s3/s3_secret.go @@ -41,10 +41,10 @@ type S3Config struct { } var ( - KFServiceS3SecretEndpointAnnotation = constants.KFServingAPIGroupName + "/" + "s3-endpoint" - KFServiceS3SecretRegionAnnotation = constants.KFServingAPIGroupName + "/" + "s3-region" - KFServiceS3SecretSSLAnnotation = constants.KFServingAPIGroupName + "/" + "s3-verifyssl" - KFServiceS3SecretHttpsAnnotation = constants.KFServingAPIGroupName + "/" + "s3-usehttps" + InferenceServiceS3SecretEndpointAnnotation = constants.KFServingAPIGroupName + "/" + "s3-endpoint" + InferenceServiceS3SecretRegionAnnotation = constants.KFServingAPIGroupName + "/" + "s3-region" + InferenceServiceS3SecretSSLAnnotation = constants.KFServingAPIGroupName + "/" + "s3-verifyssl" + InferenceServiceS3SecretHttpsAnnotation = constants.KFServingAPIGroupName + "/" + "s3-usehttps" ) func BuildSecretEnvs(secret *v1.Secret, s3Config *S3Config) []v1.EnvVar { @@ -82,11 +82,11 @@ func BuildSecretEnvs(secret *v1.Secret, s3Config *S3Config) []v1.EnvVar { }, } - if s3Endpoint, ok := secret.Annotations[KFServiceS3SecretEndpointAnnotation]; ok { + if s3Endpoint, ok := secret.Annotations[InferenceServiceS3SecretEndpointAnnotation]; ok { s3EndpointUrl := "https://" + s3Endpoint - if s3UseHttps, ok := secret.Annotations[KFServiceS3SecretHttpsAnnotation]; ok { + if s3UseHttps, ok := secret.Annotations[InferenceServiceS3SecretHttpsAnnotation]; ok { if s3UseHttps == "0" { - s3EndpointUrl = "http://" + secret.Annotations[KFServiceS3SecretEndpointAnnotation] + s3EndpointUrl = "http://" + secret.Annotations[InferenceServiceS3SecretEndpointAnnotation] } envs = append(envs, v1.EnvVar{ Name: S3UseHttps, @@ -120,14 +120,14 @@ func BuildSecretEnvs(secret *v1.Secret, s3Config *S3Config) []v1.EnvVar { }) } - if s3Region, ok := secret.Annotations[KFServiceS3SecretRegionAnnotation]; ok { + if s3Region, ok := secret.Annotations[InferenceServiceS3SecretRegionAnnotation]; ok { envs = append(envs, v1.EnvVar{ Name: AWSRegion, Value: s3Region, }) } - if val, ok := secret.Annotations[KFServiceS3SecretSSLAnnotation]; ok { + if val, ok := secret.Annotations[InferenceServiceS3SecretSSLAnnotation]; ok { envs = append(envs, v1.EnvVar{ Name: S3VerifySSL, Value: val, diff --git a/pkg/controller/kfservice/resources/credentials/s3/s3_secret_test.go b/pkg/controller/inferenceservice/resources/credentials/s3/s3_secret_test.go similarity index 94% rename from pkg/controller/kfservice/resources/credentials/s3/s3_secret_test.go rename to pkg/controller/inferenceservice/resources/credentials/s3/s3_secret_test.go index 8e5a69808f..332d63fc2d 100644 --- a/pkg/controller/kfservice/resources/credentials/s3/s3_secret_test.go +++ b/pkg/controller/inferenceservice/resources/credentials/s3/s3_secret_test.go @@ -34,7 +34,7 @@ func TestS3Secret(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "s3-secret", Annotations: map[string]string{ - KFServiceS3SecretEndpointAnnotation: "s3.aws.com", + InferenceServiceS3SecretEndpointAnnotation: "s3.aws.com", }, }, }, @@ -77,9 +77,9 @@ func TestS3Secret(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "s3-secret", Annotations: map[string]string{ - KFServiceS3SecretEndpointAnnotation: "s3.aws.com", - KFServiceS3SecretHttpsAnnotation: "0", - KFServiceS3SecretSSLAnnotation: "0", + InferenceServiceS3SecretEndpointAnnotation: "s3.aws.com", + InferenceServiceS3SecretHttpsAnnotation: "0", + InferenceServiceS3SecretSSLAnnotation: "0", }, }, }, diff --git a/pkg/controller/kfservice/resources/credentials/service_account_credentials.go b/pkg/controller/inferenceservice/resources/credentials/service_account_credentials.go similarity index 93% rename from pkg/controller/kfservice/resources/credentials/service_account_credentials.go rename to pkg/controller/inferenceservice/resources/credentials/service_account_credentials.go index 49c9add0ef..0726f3baf7 100644 --- a/pkg/controller/kfservice/resources/credentials/service_account_credentials.go +++ b/pkg/controller/inferenceservice/resources/credentials/service_account_credentials.go @@ -21,9 +21,9 @@ import ( "encoding/json" "fmt" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/resources/credentials/azure" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/resources/credentials/gcs" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/resources/credentials/s3" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/resources/credentials/azure" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/resources/credentials/gcs" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/resources/credentials/s3" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/pkg/controller/kfservice/resources/credentials/service_account_credentials_test.go b/pkg/controller/inferenceservice/resources/credentials/service_account_credentials_test.go similarity index 97% rename from pkg/controller/kfservice/resources/credentials/service_account_credentials_test.go rename to pkg/controller/inferenceservice/resources/credentials/service_account_credentials_test.go index 0c1ee750be..153ea181a4 100644 --- a/pkg/controller/kfservice/resources/credentials/service_account_credentials_test.go +++ b/pkg/controller/inferenceservice/resources/credentials/service_account_credentials_test.go @@ -20,11 +20,11 @@ import ( "context" "testing" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/resources/credentials/azure" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/resources/credentials/azure" "github.com/google/go-cmp/cmp" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/resources/credentials/gcs" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/resources/credentials/s3" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/resources/credentials/gcs" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/resources/credentials/s3" "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -63,7 +63,7 @@ func TestS3CredentialBuilder(t *testing.T) { Name: "s3-secret", Namespace: "default", Annotations: map[string]string{ - s3.KFServiceS3SecretEndpointAnnotation: "s3.aws.com", + s3.InferenceServiceS3SecretEndpointAnnotation: "s3.aws.com", }, }, Data: map[string][]byte{ diff --git a/pkg/controller/kfservice/resources/istio/virtualservice.go b/pkg/controller/inferenceservice/resources/istio/virtualservice.go similarity index 88% rename from pkg/controller/kfservice/resources/istio/virtualservice.go rename to pkg/controller/inferenceservice/resources/istio/virtualservice.go index 870ff22446..d3f613c693 100644 --- a/pkg/controller/kfservice/resources/istio/virtualservice.go +++ b/pkg/controller/inferenceservice/resources/istio/virtualservice.go @@ -84,45 +84,45 @@ func createFailedStatus(reason string, message string) *v1alpha2.VirtualServiceS } } -func (r *VirtualServiceBuilder) CreateVirtualService(kfsvc *v1alpha2.KFService) (*istiov1alpha3.VirtualService, *v1alpha2.VirtualServiceStatus) { +func (r *VirtualServiceBuilder) CreateVirtualService(isvc *v1alpha2.InferenceService) (*istiov1alpha3.VirtualService, *v1alpha2.VirtualServiceStatus) { httpRoutes := []istiov1alpha3.HTTPRoute{} // destination for the default predict is required - predictDefaultSpec, reason := getPredictStatusConfigurationSpec(&kfsvc.Spec.Default, kfsvc.Status.Default) + predictDefaultSpec, reason := getPredictStatusConfigurationSpec(&isvc.Spec.Default, isvc.Status.Default) if predictDefaultSpec == nil { return nil, createFailedStatus(reason, "Failed to reconcile default predictor") } // use transformer instead (if one is configured) - if kfsvc.Spec.Default.Transformer != nil { - predictDefaultSpec, reason = getTransformerStatusConfigurationSpec(&kfsvc.Spec.Default, kfsvc.Status.Default) + if isvc.Spec.Default.Transformer != nil { + predictDefaultSpec, reason = getTransformerStatusConfigurationSpec(&isvc.Spec.Default, isvc.Status.Default) if predictDefaultSpec == nil { return nil, createFailedStatus(reason, "Failed to reconcile default transformer") } } // extract the virtual service hostname from the predictor hostname - serviceHostname := constants.VirtualServiceHostname(kfsvc.Name, predictDefaultSpec.Hostname) - serviceURL := constants.ServiceURL(kfsvc.Name, serviceHostname) + serviceHostname := constants.VirtualServiceHostname(isvc.Name, predictDefaultSpec.Hostname) + serviceURL := constants.ServiceURL(isvc.Name, serviceHostname) // add the default route - defaultWeight := 100 - kfsvc.Spec.CanaryTrafficPercent - canaryWeight := kfsvc.Spec.CanaryTrafficPercent + defaultWeight := 100 - isvc.Spec.CanaryTrafficPercent + canaryWeight := isvc.Spec.CanaryTrafficPercent predictRouteDestinations := []istiov1alpha3.HTTPRouteDestination{ createHTTPRouteDestination(predictDefaultSpec.Hostname, defaultWeight, r.ingressConfig.IngressServiceName), } // optionally get a destination for canary predict - if kfsvc.Spec.Canary != nil { - predictCanarySpec, reason := getPredictStatusConfigurationSpec(kfsvc.Spec.Canary, kfsvc.Status.Canary) + if isvc.Spec.Canary != nil { + predictCanarySpec, reason := getPredictStatusConfigurationSpec(isvc.Spec.Canary, isvc.Status.Canary) if predictCanarySpec == nil { return nil, createFailedStatus(reason, "Failed to reconcile canary predictor") } // attempt use transformer instead if *Default* had one, see discussion: https://github.com/kubeflow/kfserving/issues/324 - if kfsvc.Spec.Default.Transformer != nil { - predictCanarySpec, reason = getTransformerStatusConfigurationSpec(kfsvc.Spec.Canary, kfsvc.Status.Canary) + if isvc.Spec.Default.Transformer != nil { + predictCanarySpec, reason = getTransformerStatusConfigurationSpec(isvc.Spec.Canary, isvc.Status.Canary) if predictCanarySpec == nil { return nil, createFailedStatus(reason, "Failed to reconcile canary transformer") } @@ -137,7 +137,7 @@ func (r *VirtualServiceBuilder) CreateVirtualService(kfsvc *v1alpha2.KFService) Match: []istiov1alpha3.HTTPMatchRequest{ istiov1alpha3.HTTPMatchRequest{ URI: &istiov1alpha1.StringMatch{ - Prefix: constants.PredictPrefix(kfsvc.Name), + Prefix: constants.PredictPrefix(isvc.Name), }, }, }, @@ -147,13 +147,13 @@ func (r *VirtualServiceBuilder) CreateVirtualService(kfsvc *v1alpha2.KFService) // optionally add the explain route explainRouteDestinations := []istiov1alpha3.HTTPRouteDestination{} - if kfsvc.Spec.Default.Explainer != nil { - explainDefaultSpec, defaultExplainerReason := getExplainStatusConfigurationSpec(&kfsvc.Spec.Default, kfsvc.Status.Default) + if isvc.Spec.Default.Explainer != nil { + explainDefaultSpec, defaultExplainerReason := getExplainStatusConfigurationSpec(&isvc.Spec.Default, isvc.Status.Default) if explainDefaultSpec != nil { routeDefaultDestination := createHTTPRouteDestination(explainDefaultSpec.Hostname, defaultWeight, r.ingressConfig.IngressServiceName) explainRouteDestinations = append(explainRouteDestinations, routeDefaultDestination) - explainCanarySpec, canaryExplainerReason := getExplainStatusConfigurationSpec(kfsvc.Spec.Canary, kfsvc.Status.Canary) + explainCanarySpec, canaryExplainerReason := getExplainStatusConfigurationSpec(isvc.Spec.Canary, isvc.Status.Canary) if explainCanarySpec != nil { routeCanaryDestination := createHTTPRouteDestination(explainCanarySpec.Hostname, canaryWeight, r.ingressConfig.IngressServiceName) explainRouteDestinations = append(explainRouteDestinations, routeCanaryDestination) @@ -168,7 +168,7 @@ func (r *VirtualServiceBuilder) CreateVirtualService(kfsvc *v1alpha2.KFService) Match: []istiov1alpha3.HTTPMatchRequest{ istiov1alpha3.HTTPMatchRequest{ URI: &istiov1alpha1.StringMatch{ - Prefix: constants.ExplainPrefix(kfsvc.Name), + Prefix: constants.ExplainPrefix(isvc.Name), }, }, }, @@ -179,10 +179,10 @@ func (r *VirtualServiceBuilder) CreateVirtualService(kfsvc *v1alpha2.KFService) vs := istiov1alpha3.VirtualService{ ObjectMeta: metav1.ObjectMeta{ - Name: kfsvc.Name, - Namespace: kfsvc.Namespace, - Labels: kfsvc.Labels, - Annotations: kfsvc.Annotations, + Name: isvc.Name, + Namespace: isvc.Namespace, + Labels: isvc.Labels, + Annotations: isvc.Annotations, }, Spec: istiov1alpha3.VirtualServiceSpec{ Hosts: []string{ diff --git a/pkg/controller/kfservice/resources/knative/service.go b/pkg/controller/inferenceservice/resources/knative/service.go similarity index 86% rename from pkg/controller/kfservice/resources/knative/service.go rename to pkg/controller/inferenceservice/resources/knative/service.go index 5618b91a09..e56cdb0ff2 100644 --- a/pkg/controller/kfservice/resources/knative/service.go +++ b/pkg/controller/inferenceservice/resources/knative/service.go @@ -24,7 +24,7 @@ import ( "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2" "github.com/kubeflow/kfserving/pkg/constants" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/resources/credentials" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/resources/credentials" "github.com/kubeflow/kfserving/pkg/utils" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -74,44 +74,44 @@ func NewServiceBuilder(client client.Client, config *v1.ConfigMap) *ServiceBuild } } -func (c *ServiceBuilder) CreateEndpointService(kfsvc *v1alpha2.KFService, endpoint constants.KFServiceEndpoint, isCanary bool) (*knservingv1alpha1.Service, error) { - serviceName := constants.DefaultServiceName(kfsvc.Name, endpoint) +func (c *ServiceBuilder) CreateEndpointService(isvc *v1alpha2.InferenceService, endpoint constants.InferenceServiceEndpoint, isCanary bool) (*knservingv1alpha1.Service, error) { + serviceName := constants.DefaultServiceName(isvc.Name, endpoint) if isCanary { - serviceName = constants.CanaryServiceName(kfsvc.Name, endpoint) + serviceName = constants.CanaryServiceName(isvc.Name, endpoint) } switch endpoint { case constants.Predictor: - predictorSpec := &kfsvc.Spec.Default.Predictor + predictorSpec := &isvc.Spec.Default.Predictor if isCanary { - predictorSpec = &kfsvc.Spec.Canary.Predictor + predictorSpec = &isvc.Spec.Canary.Predictor } - return c.CreatePredictorService(serviceName, kfsvc.ObjectMeta, predictorSpec) + return c.CreatePredictorService(serviceName, isvc.ObjectMeta, predictorSpec) case constants.Transformer: - transformerSpec := kfsvc.Spec.Default.Transformer + transformerSpec := isvc.Spec.Default.Transformer if isCanary { - transformerSpec = kfsvc.Spec.Canary.Transformer + transformerSpec = isvc.Spec.Canary.Transformer } if transformerSpec == nil { return nil, nil } - return c.CreateTransformerService(serviceName, kfsvc.ObjectMeta, transformerSpec, isCanary) + return c.CreateTransformerService(serviceName, isvc.ObjectMeta, transformerSpec, isCanary) case constants.Explainer: - explainerSpec := kfsvc.Spec.Default.Explainer - predictorService := constants.DefaultPredictorServiceName(kfsvc.Name) + "." + kfsvc.Namespace - if kfsvc.Spec.Default.Transformer != nil { - predictorService = constants.DefaultTransformerServiceName(kfsvc.Name) + "." + kfsvc.Namespace + explainerSpec := isvc.Spec.Default.Explainer + predictorService := constants.DefaultPredictorServiceName(isvc.Name) + "." + isvc.Namespace + if isvc.Spec.Default.Transformer != nil { + predictorService = constants.DefaultTransformerServiceName(isvc.Name) + "." + isvc.Namespace } if isCanary { - explainerSpec = kfsvc.Spec.Canary.Explainer - predictorService = constants.CanaryPredictorServiceName(kfsvc.Name) + "." + kfsvc.Namespace - if kfsvc.Spec.Canary.Transformer != nil { - predictorService = constants.CanaryTransformerServiceName(kfsvc.Name) + "." + kfsvc.Namespace + explainerSpec = isvc.Spec.Canary.Explainer + predictorService = constants.CanaryPredictorServiceName(isvc.Name) + "." + isvc.Namespace + if isvc.Spec.Canary.Transformer != nil { + predictorService = constants.CanaryTransformerServiceName(isvc.Name) + "." + isvc.Namespace } } if explainerSpec == nil { return nil, nil } - return c.CreateExplainerService(serviceName, kfsvc.ObjectMeta, explainerSpec, predictorService, isCanary) + return c.CreateExplainerService(serviceName, isvc.ObjectMeta, explainerSpec, predictorService, isCanary) } return nil, fmt.Errorf("Invalid endpoint") } @@ -154,7 +154,7 @@ func (c *ServiceBuilder) CreatePredictorService(name string, metadata metav1.Obj Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: utils.Union(metadata.Labels, map[string]string{ - constants.KFServicePodLabelKey: metadata.Name, + constants.InferenceServicePodLabelKey: metadata.Name, }), Annotations: annotations, }, @@ -233,7 +233,7 @@ func (c *ServiceBuilder) CreateTransformerService(name string, metadata metav1.O Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: utils.Union(metadata.Labels, map[string]string{ - constants.KFServicePodLabelKey: metadata.Name, + constants.InferenceServicePodLabelKey: metadata.Name, }), Annotations: annotations, }, @@ -305,7 +305,7 @@ func (c *ServiceBuilder) CreateExplainerService(name string, metadata metav1.Obj Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: utils.Union(metadata.Labels, map[string]string{ - constants.KFServicePodLabelKey: metadata.Name, + constants.InferenceServicePodLabelKey: metadata.Name, }), Annotations: annotations, }, diff --git a/pkg/controller/kfservice/resources/knative/service_test.go b/pkg/controller/inferenceservice/resources/knative/service_test.go similarity index 80% rename from pkg/controller/kfservice/resources/knative/service_test.go rename to pkg/controller/inferenceservice/resources/knative/service_test.go index 79bf27afd2..e34826bc88 100644 --- a/pkg/controller/kfservice/resources/knative/service_test.go +++ b/pkg/controller/inferenceservice/resources/knative/service_test.go @@ -29,15 +29,15 @@ import ( knservingv1alpha1 "knative.dev/serving/pkg/apis/serving/v1alpha1" ) -var kfsvc = v1alpha2.KFService{ +var isvc = v1alpha2.InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: "mnist", Namespace: "default", Annotations: map[string]string{ - constants.KFServiceGKEAcceleratorAnnotationKey: "nvidia-tesla-t4", + constants.InferenceServiceGKEAcceleratorAnnotationKey: "nvidia-tesla-t4", }, }, - Spec: v1alpha2.KFServiceSpec{ + Spec: v1alpha2.InferenceServiceSpec{ Default: v1alpha2.EndpointSpec{ Predictor: v1alpha2.PredictorSpec{ DeploymentSpec: v1alpha2.DeploymentSpec{ @@ -77,14 +77,14 @@ var defaultService = &knservingv1alpha1.Service{ ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": "mnist"}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": "mnist"}, Annotations: map[string]string{ "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", "autoscaling.knative.dev/target": "1", "autoscaling.knative.dev/minScale": "1", "autoscaling.knative.dev/maxScale": "3", - constants.KFServiceGKEAcceleratorAnnotationKey: "nvidia-tesla-t4", - constants.StorageInitializerSourceUriInternalAnnotationKey: kfsvc.Spec.Default.Predictor.Tensorflow.StorageURI, + constants.InferenceServiceGKEAcceleratorAnnotationKey: "nvidia-tesla-t4", + constants.StorageInitializerSourceUriInternalAnnotationKey: isvc.Spec.Default.Predictor.Tensorflow.StorageURI, }, }, Spec: knservingv1alpha1.RevisionSpec{ @@ -94,7 +94,7 @@ var defaultService = &knservingv1alpha1.Service{ ServiceAccountName: "testsvcacc", Containers: []v1.Container{ { - Image: v1alpha2.TensorflowServingImageName + ":" + kfsvc.Spec.Default.Predictor.Tensorflow.RuntimeVersion, + Image: v1alpha2.TensorflowServingImageName + ":" + isvc.Spec.Default.Predictor.Tensorflow.RuntimeVersion, Command: []string{v1alpha2.TensorflowEntrypointCommand}, Args: []string{ "--port=" + v1alpha2.TensorflowServingGRPCPort, @@ -121,13 +121,13 @@ var canaryService = &knservingv1alpha1.Service{ ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": "mnist"}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": "mnist"}, Annotations: map[string]string{ "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", "autoscaling.knative.dev/target": "1", "autoscaling.knative.dev/minScale": "1", "autoscaling.knative.dev/maxScale": "3", - constants.KFServiceGKEAcceleratorAnnotationKey: "nvidia-tesla-t4", + constants.InferenceServiceGKEAcceleratorAnnotationKey: "nvidia-tesla-t4", constants.StorageInitializerSourceUriInternalAnnotationKey: "s3://test/mnist-2/export", }, }, @@ -137,7 +137,7 @@ var canaryService = &knservingv1alpha1.Service{ PodSpec: v1.PodSpec{ Containers: []v1.Container{ { - Image: v1alpha2.TensorflowServingImageName + ":" + kfsvc.Spec.Default.Predictor.Tensorflow.RuntimeVersion, + Image: v1alpha2.TensorflowServingImageName + ":" + isvc.Spec.Default.Predictor.Tensorflow.RuntimeVersion, Command: []string{v1alpha2.TensorflowEntrypointCommand}, Args: []string{ "--port=" + v1alpha2.TensorflowServingGRPCPort, @@ -155,28 +155,28 @@ var canaryService = &knservingv1alpha1.Service{ }, } -func TestKFServiceToKnativeService(t *testing.T) { +func TestInferenceServiceToKnativeService(t *testing.T) { scenarios := map[string]struct { - configMapData map[string]string - kfService v1alpha2.KFService - expectedDefault *knservingv1alpha1.Service - expectedCanary *knservingv1alpha1.Service + configMapData map[string]string + INFERENCESERVICE v1alpha2.InferenceService + expectedDefault *knservingv1alpha1.Service + expectedCanary *knservingv1alpha1.Service }{ "RunLatestModel": { - kfService: kfsvc, - expectedDefault: defaultService, - expectedCanary: nil, + INFERENCESERVICE: isvc, + expectedDefault: defaultService, + expectedCanary: nil, }, "RunCanaryModel": { - kfService: v1alpha2.KFService{ + INFERENCESERVICE: v1alpha2.InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: "mnist", Namespace: "default", Annotations: map[string]string{ - constants.KFServiceGKEAcceleratorAnnotationKey: "nvidia-tesla-t4", + constants.InferenceServiceGKEAcceleratorAnnotationKey: "nvidia-tesla-t4", }, }, - Spec: v1alpha2.KFServiceSpec{ + Spec: v1alpha2.InferenceServiceSpec{ Default: v1alpha2.EndpointSpec{ Predictor: v1alpha2.PredictorSpec{ DeploymentSpec: v1alpha2.DeploymentSpec{ @@ -185,7 +185,7 @@ func TestKFServiceToKnativeService(t *testing.T) { ServiceAccountName: "testsvcacc", }, Tensorflow: &v1alpha2.TensorflowSpec{ - StorageURI: kfsvc.Spec.Default.Predictor.Tensorflow.StorageURI, + StorageURI: isvc.Spec.Default.Predictor.Tensorflow.StorageURI, RuntimeVersion: "1.13.0", }, }, @@ -204,7 +204,7 @@ func TestKFServiceToKnativeService(t *testing.T) { }, }, }, - Status: v1alpha2.KFServiceStatus{ + Status: v1alpha2.InferenceServiceStatus{ Default: &v1alpha2.EndpointStatusMap{ constants.Predictor: &v1alpha2.StatusConfigurationSpec{ Name: "v1", @@ -216,12 +216,12 @@ func TestKFServiceToKnativeService(t *testing.T) { expectedCanary: canaryService, }, "RunSklearnModel": { - kfService: v1alpha2.KFService{ + INFERENCESERVICE: v1alpha2.InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: "sklearn", Namespace: "default", }, - Spec: v1alpha2.KFServiceSpec{ + Spec: v1alpha2.InferenceServiceSpec{ Default: v1alpha2.EndpointSpec{ Predictor: v1alpha2.PredictorSpec{ SKLearn: &v1alpha2.SKLearnSpec{ @@ -241,7 +241,7 @@ func TestKFServiceToKnativeService(t *testing.T) { ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": "sklearn"}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": "sklearn"}, Annotations: map[string]string{ constants.StorageInitializerSourceUriInternalAnnotationKey: "s3://test/sklearn/export", "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", @@ -270,12 +270,12 @@ func TestKFServiceToKnativeService(t *testing.T) { }, }, "RunXgboostModel": { - kfService: v1alpha2.KFService{ + INFERENCESERVICE: v1alpha2.InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: "xgboost", Namespace: "default", }, - Spec: v1alpha2.KFServiceSpec{ + Spec: v1alpha2.InferenceServiceSpec{ Default: v1alpha2.EndpointSpec{ Predictor: v1alpha2.PredictorSpec{ XGBoost: &v1alpha2.XGBoostSpec{ @@ -295,7 +295,7 @@ func TestKFServiceToKnativeService(t *testing.T) { ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": "xgboost"}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": "xgboost"}, Annotations: map[string]string{ constants.StorageInitializerSourceUriInternalAnnotationKey: "s3://test/xgboost/export", "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", @@ -325,12 +325,12 @@ func TestKFServiceToKnativeService(t *testing.T) { }, "TestConfigOverride": { configMapData: configMapData, - kfService: v1alpha2.KFService{ + INFERENCESERVICE: v1alpha2.InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: "xgboost", Namespace: "default", }, - Spec: v1alpha2.KFServiceSpec{ + Spec: v1alpha2.InferenceServiceSpec{ Default: v1alpha2.EndpointSpec{ Predictor: v1alpha2.PredictorSpec{ XGBoost: &v1alpha2.XGBoostSpec{ @@ -350,7 +350,7 @@ func TestKFServiceToKnativeService(t *testing.T) { ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": "xgboost"}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": "xgboost"}, Annotations: map[string]string{ constants.StorageInitializerSourceUriInternalAnnotationKey: "s3://test/xgboost/export", "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", @@ -379,7 +379,7 @@ func TestKFServiceToKnativeService(t *testing.T) { }, }, "TestAnnotation": { - kfService: v1alpha2.KFService{ + INFERENCESERVICE: v1alpha2.InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: "sklearn", Namespace: "default", @@ -392,7 +392,7 @@ func TestKFServiceToKnativeService(t *testing.T) { "kubectl.kubernetes.io/last-applied-configuration": "test2", }, }, - Spec: v1alpha2.KFServiceSpec{ + Spec: v1alpha2.InferenceServiceSpec{ Default: v1alpha2.EndpointSpec{ Predictor: v1alpha2.PredictorSpec{ SKLearn: &v1alpha2.SKLearnSpec{ @@ -415,7 +415,7 @@ func TestKFServiceToKnativeService(t *testing.T) { ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": "sklearn"}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": "sklearn"}, Annotations: map[string]string{ constants.StorageInitializerSourceUriInternalAnnotationKey: "s3://test/sklearn/export", "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", @@ -453,9 +453,9 @@ func TestKFServiceToKnativeService(t *testing.T) { Data: scenario.configMapData, }) actualDefaultService, err := serviceBuilder.CreatePredictorService( - constants.DefaultPredictorServiceName(scenario.kfService.Name), - scenario.kfService.ObjectMeta, - &scenario.kfService.Spec.Default.Predictor, + constants.DefaultPredictorServiceName(scenario.INFERENCESERVICE.Name), + scenario.INFERENCESERVICE.ObjectMeta, + &scenario.INFERENCESERVICE.Spec.Default.Predictor, ) if err != nil { t.Errorf("Test %q unexpected error %s", name, err.Error()) @@ -465,11 +465,11 @@ func TestKFServiceToKnativeService(t *testing.T) { t.Errorf("Test %q unexpected default service (-want +got): %v", name, diff) } - if scenario.kfService.Spec.Canary != nil { + if scenario.INFERENCESERVICE.Spec.Canary != nil { actualCanaryService, err := serviceBuilder.CreatePredictorService( - constants.CanaryPredictorServiceName(kfsvc.Name), - scenario.kfService.ObjectMeta, - &scenario.kfService.Spec.Canary.Predictor, + constants.CanaryPredictorServiceName(isvc.Name), + scenario.INFERENCESERVICE.ObjectMeta, + &scenario.INFERENCESERVICE.Spec.Canary.Predictor, ) if err != nil { t.Errorf("Test %q unexpected error %s", name, err.Error()) @@ -483,12 +483,12 @@ func TestKFServiceToKnativeService(t *testing.T) { } func TestTransformerToKnativeService(t *testing.T) { - kfsvc := v1alpha2.KFService{ + isvc := v1alpha2.InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: "mnist", Namespace: "default", }, - Spec: v1alpha2.KFServiceSpec{ + Spec: v1alpha2.InferenceServiceSpec{ Default: v1alpha2.EndpointSpec{ Transformer: &v1alpha2.TransformerSpec{ DeploymentSpec: v1alpha2.DeploymentSpec{ @@ -517,9 +517,9 @@ func TestTransformerToKnativeService(t *testing.T) { }, } - kfsvcCanary := kfsvc.DeepCopy() - kfsvcCanary.Spec.CanaryTrafficPercent = 20 - kfsvcCanary.Spec.Canary = &v1alpha2.EndpointSpec{ + isvcCanary := isvc.DeepCopy() + isvcCanary.Spec.CanaryTrafficPercent = 20 + isvcCanary.Spec.Canary = &v1alpha2.EndpointSpec{ Transformer: &v1alpha2.TransformerSpec{ DeploymentSpec: v1alpha2.DeploymentSpec{ MinReplicas: 2, @@ -554,7 +554,7 @@ func TestTransformerToKnativeService(t *testing.T) { ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": "mnist"}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": "mnist"}, Annotations: map[string]string{ "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", "autoscaling.knative.dev/target": "1", @@ -572,9 +572,9 @@ func TestTransformerToKnativeService(t *testing.T) { Image: "transformer:latest", Args: []string{ constants.ArgumentModelName, - kfsvc.Name, + isvc.Name, constants.ArgumentPredictorHost, - constants.DefaultPredictorServiceName(kfsvc.Name) + "." + kfsvc.Namespace, + constants.DefaultPredictorServiceName(isvc.Name) + "." + isvc.Namespace, }, }, }, @@ -595,7 +595,7 @@ func TestTransformerToKnativeService(t *testing.T) { ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": "mnist"}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": "mnist"}, Annotations: map[string]string{ "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", "autoscaling.knative.dev/target": "1", @@ -613,9 +613,9 @@ func TestTransformerToKnativeService(t *testing.T) { Image: "transformer:v2", Args: []string{ constants.ArgumentModelName, - kfsvc.Name, + isvc.Name, constants.ArgumentPredictorHost, - constants.CanaryPredictorServiceName(kfsvc.Name) + "." + kfsvc.Namespace, + constants.CanaryPredictorServiceName(isvc.Name) + "." + isvc.Namespace, }, }, }, @@ -628,20 +628,20 @@ func TestTransformerToKnativeService(t *testing.T) { } scenarios := map[string]struct { - configMapData map[string]string - kfService v1alpha2.KFService - expectedDefault *knservingv1alpha1.Service - expectedCanary *knservingv1alpha1.Service + configMapData map[string]string + INFERENCESERVICE v1alpha2.InferenceService + expectedDefault *knservingv1alpha1.Service + expectedCanary *knservingv1alpha1.Service }{ "RunLatestModel": { - kfService: kfsvc, - expectedDefault: defaultService, - expectedCanary: nil, + INFERENCESERVICE: isvc, + expectedDefault: defaultService, + expectedCanary: nil, }, "RunCanaryModel": { - kfService: *kfsvcCanary, - expectedDefault: defaultService, - expectedCanary: canaryService, + INFERENCESERVICE: *isvcCanary, + expectedDefault: defaultService, + expectedCanary: canaryService, }, } @@ -650,9 +650,9 @@ func TestTransformerToKnativeService(t *testing.T) { Data: scenario.configMapData, }) actualDefaultService, err := serviceBuilder.CreateTransformerService( - constants.DefaultTransformerServiceName(scenario.kfService.Name), - scenario.kfService.ObjectMeta, - scenario.kfService.Spec.Default.Transformer, false) + constants.DefaultTransformerServiceName(scenario.INFERENCESERVICE.Name), + scenario.INFERENCESERVICE.ObjectMeta, + scenario.INFERENCESERVICE.Spec.Default.Transformer, false) if err != nil { t.Errorf("Test %q unexpected error %s", name, err.Error()) } @@ -661,11 +661,11 @@ func TestTransformerToKnativeService(t *testing.T) { t.Errorf("Test %q unexpected default service (-want +got): %v", name, diff) } - if scenario.kfService.Spec.Canary != nil { + if scenario.INFERENCESERVICE.Spec.Canary != nil { actualCanaryService, err := serviceBuilder.CreateTransformerService( - constants.CanaryTransformerServiceName(kfsvc.Name), - scenario.kfService.ObjectMeta, - scenario.kfService.Spec.Canary.Transformer, true) + constants.CanaryTransformerServiceName(isvc.Name), + scenario.INFERENCESERVICE.ObjectMeta, + scenario.INFERENCESERVICE.Spec.Canary.Transformer, true) if err != nil { t.Errorf("Test %q unexpected error %s", name, err.Error()) } @@ -678,12 +678,12 @@ func TestTransformerToKnativeService(t *testing.T) { } func TestExplainerToKnativeService(t *testing.T) { - kfsvc := v1alpha2.KFService{ + isvc := v1alpha2.InferenceService{ ObjectMeta: metav1.ObjectMeta{ Name: "mnist", Namespace: "default", }, - Spec: v1alpha2.KFServiceSpec{ + Spec: v1alpha2.InferenceServiceSpec{ Default: v1alpha2.EndpointSpec{ Predictor: v1alpha2.PredictorSpec{ @@ -707,9 +707,9 @@ func TestExplainerToKnativeService(t *testing.T) { }, } - kfsvcCanary := kfsvc.DeepCopy() - kfsvcCanary.Spec.CanaryTrafficPercent = 20 - kfsvcCanary.Spec.Canary = &v1alpha2.EndpointSpec{ + isvcCanary := isvc.DeepCopy() + isvcCanary.Spec.CanaryTrafficPercent = 20 + isvcCanary.Spec.Canary = &v1alpha2.EndpointSpec{ Predictor: v1alpha2.PredictorSpec{ DeploymentSpec: v1alpha2.DeploymentSpec{ MinReplicas: 1, @@ -738,7 +738,7 @@ func TestExplainerToKnativeService(t *testing.T) { ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": "mnist"}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": "mnist"}, Annotations: map[string]string{ "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", "autoscaling.knative.dev/target": "1", @@ -753,9 +753,9 @@ func TestExplainerToKnativeService(t *testing.T) { Image: "alibi:latest", Args: []string{ constants.ArgumentModelName, - kfsvc.Name, + isvc.Name, constants.ArgumentPredictorHost, - constants.DefaultPredictorServiceName(kfsvc.Name) + "." + kfsvc.Namespace, + constants.DefaultPredictorServiceName(isvc.Name) + "." + isvc.Namespace, string(v1alpha2.AlibiAnchorsTabularExplainer), }, }, @@ -777,7 +777,7 @@ func TestExplainerToKnativeService(t *testing.T) { ConfigurationSpec: knservingv1alpha1.ConfigurationSpec{ Template: &knservingv1alpha1.RevisionTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ - Labels: map[string]string{"serving.kubeflow.org/kfservice": "mnist"}, + Labels: map[string]string{"serving.kubeflow.org/inferenceservice": "mnist"}, Annotations: map[string]string{ "autoscaling.knative.dev/class": "kpa.autoscaling.knative.dev", "autoscaling.knative.dev/target": "1", @@ -792,9 +792,9 @@ func TestExplainerToKnativeService(t *testing.T) { Image: "alibi:latest", Args: []string{ constants.ArgumentModelName, - kfsvc.Name, + isvc.Name, constants.ArgumentPredictorHost, - constants.CanaryPredictorServiceName(kfsvc.Name) + "." + kfsvc.Namespace, + constants.CanaryPredictorServiceName(isvc.Name) + "." + isvc.Namespace, string(v1alpha2.AlibiAnchorsTabularExplainer), }, }, @@ -815,22 +815,22 @@ func TestExplainerToKnativeService(t *testing.T) { }`, } scenarios := map[string]struct { - configMapData map[string]string - kfService v1alpha2.KFService - expectedDefault *knservingv1alpha1.Service - expectedCanary *knservingv1alpha1.Service + configMapData map[string]string + INFERENCESERVICE v1alpha2.InferenceService + expectedDefault *knservingv1alpha1.Service + expectedCanary *knservingv1alpha1.Service }{ "RunLatestExplainer": { - kfService: kfsvc, - expectedDefault: defaultService, - expectedCanary: nil, - configMapData: configMapData, + INFERENCESERVICE: isvc, + expectedDefault: defaultService, + expectedCanary: nil, + configMapData: configMapData, }, "RunCanaryExplainer": { - kfService: *kfsvcCanary, - expectedDefault: defaultService, - expectedCanary: canaryService, - configMapData: configMapData, + INFERENCESERVICE: *isvcCanary, + expectedDefault: defaultService, + expectedCanary: canaryService, + configMapData: configMapData, }, } @@ -839,10 +839,10 @@ func TestExplainerToKnativeService(t *testing.T) { Data: scenario.configMapData, }) actualDefaultService, err := serviceBuilder.CreateExplainerService( - constants.DefaultExplainerServiceName(scenario.kfService.Name), - scenario.kfService.ObjectMeta, - scenario.kfService.Spec.Default.Explainer, - constants.DefaultPredictorServiceName(scenario.kfService.Name)+"."+scenario.kfService.Namespace, + constants.DefaultExplainerServiceName(scenario.INFERENCESERVICE.Name), + scenario.INFERENCESERVICE.ObjectMeta, + scenario.INFERENCESERVICE.Spec.Default.Explainer, + constants.DefaultPredictorServiceName(scenario.INFERENCESERVICE.Name)+"."+scenario.INFERENCESERVICE.Namespace, false) if err != nil { t.Errorf("Test %q unexpected error %s", name, err.Error()) @@ -852,12 +852,12 @@ func TestExplainerToKnativeService(t *testing.T) { t.Errorf("Test %q unexpected default service (-want +got): %v", name, diff) } - if scenario.kfService.Spec.Canary != nil { + if scenario.INFERENCESERVICE.Spec.Canary != nil { actualCanaryService, err := serviceBuilder.CreateExplainerService( - constants.CanaryTransformerServiceName(kfsvc.Name), - scenario.kfService.ObjectMeta, - scenario.kfService.Spec.Canary.Explainer, - constants.CanaryPredictorServiceName(scenario.kfService.Name)+"."+scenario.kfService.Namespace, + constants.CanaryTransformerServiceName(isvc.Name), + scenario.INFERENCESERVICE.ObjectMeta, + scenario.INFERENCESERVICE.Spec.Canary.Explainer, + constants.CanaryPredictorServiceName(scenario.INFERENCESERVICE.Name)+"."+scenario.INFERENCESERVICE.Namespace, true) if err != nil { t.Errorf("Test %q unexpected error %s", name, err.Error()) diff --git a/pkg/controller/kfservice/resources/knative/suite_test.go b/pkg/controller/inferenceservice/resources/knative/suite_test.go similarity index 100% rename from pkg/controller/kfservice/resources/knative/suite_test.go rename to pkg/controller/inferenceservice/resources/knative/suite_test.go diff --git a/pkg/controller/kfservice/kfservice_controller_suite_test.go b/pkg/controller/inferenceservice/suite_test.go similarity index 100% rename from pkg/controller/kfservice/kfservice_controller_suite_test.go rename to pkg/controller/inferenceservice/suite_test.go diff --git a/pkg/webhook/admission/kfservice/kfservice_defaulter.go b/pkg/webhook/admission/inferenceservice/inferenceservice_defaulter.go similarity index 81% rename from pkg/webhook/admission/kfservice/kfservice_defaulter.go rename to pkg/webhook/admission/inferenceservice/inferenceservice_defaulter.go index d865e96d1b..6494d24267 100644 --- a/pkg/webhook/admission/kfservice/kfservice_defaulter.go +++ b/pkg/webhook/admission/inferenceservice/inferenceservice_defaulter.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package kfservice +package inferenceservice import ( "context" @@ -29,7 +29,7 @@ import ( admissiontypes "sigs.k8s.io/controller-runtime/pkg/webhook/admission/types" ) -// Defaulter that sets default fields in KFServices +// Defaulter that sets default fields in InferenceServices type Defaulter struct { Client client.Client Decoder admissiontypes.Decoder @@ -37,17 +37,17 @@ type Defaulter struct { var _ admission.Handler = &Defaulter{} -// Handle decodes the incoming KFService and executes Validation logic. +// Handle decodes the incoming InferenceService and executes Validation logic. func (defaulter *Defaulter) Handle(ctx context.Context, req admissiontypes.Request) admissiontypes.Response { - kfsvc := &kfserving.KFService{} + isvc := &kfserving.InferenceService{} - if err := defaulter.Decoder.Decode(req, kfsvc); err != nil { + if err := defaulter.Decoder.Decode(req, isvc); err != nil { return admission.ErrorResponse(http.StatusBadRequest, err) } - kfsvc.Default() + isvc.Default() - patch, err := json.Marshal(kfsvc) + patch, err := json.Marshal(isvc) if err != nil { return admission.ErrorResponse(http.StatusInternalServerError, err) } diff --git a/pkg/webhook/admission/kfservice/kfservice_validator.go b/pkg/webhook/admission/inferenceservice/inferenceservice_validator.go similarity index 81% rename from pkg/webhook/admission/kfservice/kfservice_validator.go rename to pkg/webhook/admission/inferenceservice/inferenceservice_validator.go index 39b173974e..da35119adb 100644 --- a/pkg/webhook/admission/kfservice/kfservice_validator.go +++ b/pkg/webhook/admission/inferenceservice/inferenceservice_validator.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package kfservice +package inferenceservice import ( "context" @@ -27,7 +27,7 @@ import ( admissiontypes "sigs.k8s.io/controller-runtime/pkg/webhook/admission/types" ) -// Validator that validates KFServices +// Validator that validates InferenceServices type Validator struct { Client client.Client Decoder admissiontypes.Decoder @@ -35,15 +35,15 @@ type Validator struct { var _ admission.Handler = &Validator{} -// Handle decodes the incoming KFService and executes Validation logic. +// Handle decodes the incoming InferenceService and executes Validation logic. func (validator *Validator) Handle(ctx context.Context, req admissiontypes.Request) admissiontypes.Response { - kfsvc := &kfserving.KFService{} + isvc := &kfserving.InferenceService{} - if err := validator.Decoder.Decode(req, kfsvc); err != nil { + if err := validator.Decoder.Decode(req, isvc); err != nil { return admission.ErrorResponse(http.StatusInternalServerError, err) } - if err := kfsvc.ValidateCreate(); err != nil { + if err := isvc.ValidateCreate(); err != nil { return admission.ErrorResponse(http.StatusBadRequest, err) } diff --git a/pkg/webhook/admission/pod/accelerator_injector.go b/pkg/webhook/admission/pod/accelerator_injector.go index c890fafd8f..df141aa902 100644 --- a/pkg/webhook/admission/pod/accelerator_injector.go +++ b/pkg/webhook/admission/pod/accelerator_injector.go @@ -28,7 +28,7 @@ const ( ) func InjectGKEAcceleratorSelector(pod *v1.Pod) error { - if gpuSelector, ok := pod.Annotations[constants.KFServiceGKEAcceleratorAnnotationKey]; ok { + if gpuSelector, ok := pod.Annotations[constants.InferenceServiceGKEAcceleratorAnnotationKey]; ok { pod.Spec.NodeSelector = utils.Union( pod.Spec.NodeSelector, map[string]string{GkeAcceleratorNodeSelector: gpuSelector}, diff --git a/pkg/webhook/admission/pod/accelerator_injector_test.go b/pkg/webhook/admission/pod/accelerator_injector_test.go index fe773b6599..23e926a8b6 100644 --- a/pkg/webhook/admission/pod/accelerator_injector_test.go +++ b/pkg/webhook/admission/pod/accelerator_injector_test.go @@ -35,7 +35,7 @@ func TestAcceleratorInjector(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "deployment", Annotations: map[string]string{ - constants.KFServiceGKEAcceleratorAnnotationKey: "nvidia-tesla-v100", + constants.InferenceServiceGKEAcceleratorAnnotationKey: "nvidia-tesla-v100", }, }, Spec: v1.PodSpec{ @@ -50,7 +50,7 @@ func TestAcceleratorInjector(t *testing.T) { ObjectMeta: metav1.ObjectMeta{ Name: "deployment", Annotations: map[string]string{ - constants.KFServiceGKEAcceleratorAnnotationKey: "nvidia-tesla-v100", + constants.InferenceServiceGKEAcceleratorAnnotationKey: "nvidia-tesla-v100", }, }, Spec: v1.PodSpec{ diff --git a/pkg/webhook/admission/pod/mutator.go b/pkg/webhook/admission/pod/mutator.go index 5a49cd4b6b..2622be9698 100644 --- a/pkg/webhook/admission/pod/mutator.go +++ b/pkg/webhook/admission/pod/mutator.go @@ -26,7 +26,7 @@ import ( "k8s.io/klog" "github.com/kubeflow/kfserving/pkg/constants" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/resources/credentials" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/resources/credentials" "github.com/kubeflow/kfserving/pkg/webhook/third_party" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/webhook/admission" @@ -48,9 +48,9 @@ func (mutator *Mutator) Handle(ctx context.Context, req types.Request) types.Res } configMap := &v1.ConfigMap{} - err := mutator.Client.Get(context.TODO(), k8types.NamespacedName{Name: constants.KFServiceConfigMapName, Namespace: constants.KFServingNamespace}, configMap) + err := mutator.Client.Get(context.TODO(), k8types.NamespacedName{Name: constants.InferenceServiceConfigMapName, Namespace: constants.KFServingNamespace}, configMap) if err != nil { - klog.Error(err, "Failed to find config map", "name", constants.KFServiceConfigMapName) + klog.Error(err, "Failed to find config map", "name", constants.InferenceServiceConfigMapName) return admission.ErrorResponse(http.StatusInternalServerError, err) } diff --git a/pkg/webhook/admission/pod/storage_initializer_injector.go b/pkg/webhook/admission/pod/storage_initializer_injector.go index 634ce967e4..e21eb29bc6 100644 --- a/pkg/webhook/admission/pod/storage_initializer_injector.go +++ b/pkg/webhook/admission/pod/storage_initializer_injector.go @@ -18,7 +18,7 @@ import ( "strings" "github.com/kubeflow/kfserving/pkg/constants" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/resources/credentials" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/resources/credentials" v1 "k8s.io/api/core/v1" ) diff --git a/pkg/webhook/admission/pod/storage_initializer_injector_test.go b/pkg/webhook/admission/pod/storage_initializer_injector_test.go index b1966ea4ec..8fe325ad64 100644 --- a/pkg/webhook/admission/pod/storage_initializer_injector_test.go +++ b/pkg/webhook/admission/pod/storage_initializer_injector_test.go @@ -22,9 +22,9 @@ import ( "github.com/google/go-cmp/cmp" "github.com/kubeflow/kfserving/pkg/constants" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/resources/credentials" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/resources/credentials/gcs" - "github.com/kubeflow/kfserving/pkg/controller/kfservice/resources/credentials/s3" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/resources/credentials" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/resources/credentials/gcs" + "github.com/kubeflow/kfserving/pkg/controller/inferenceservice/resources/credentials/s3" "github.com/onsi/gomega" v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -437,7 +437,7 @@ func TestCredentialInjection(t *testing.T) { Name: "s3-secret", Namespace: "default", Annotations: map[string]string{ - s3.KFServiceS3SecretEndpointAnnotation: "s3.aws.com", + s3.InferenceServiceS3SecretEndpointAnnotation: "s3.aws.com", }, }, Data: map[string][]byte{ diff --git a/pkg/webhook/webhook.go b/pkg/webhook/webhook.go index 315358d7e1..d153f1d4dc 100644 --- a/pkg/webhook/webhook.go +++ b/pkg/webhook/webhook.go @@ -19,7 +19,7 @@ package webhook import ( "github.com/kubeflow/kfserving/pkg/apis/serving/v1alpha2" "github.com/kubeflow/kfserving/pkg/constants" - "github.com/kubeflow/kfserving/pkg/webhook/admission/kfservice" + "github.com/kubeflow/kfserving/pkg/webhook/admission/inferenceservice" "github.com/kubeflow/kfserving/pkg/webhook/admission/pod" "k8s.io/api/admissionregistration/v1beta1" v1 "k8s.io/api/core/v1" @@ -54,8 +54,8 @@ func AddToManager(manager manager.Manager) error { "control-plane": constants.ControllerLabelName, }, }, - ValidatingWebhookConfigName: constants.KFServiceValidatingWebhookConfigName, - MutatingWebhookConfigName: constants.KFServiceMutatingWebhookConfigName, + ValidatingWebhookConfigName: constants.InferenceServiceValidatingWebhookConfigName, + MutatingWebhookConfigName: constants.InferenceServiceMutatingWebhookConfigName, }, }) if err != nil { @@ -74,7 +74,7 @@ func AddToManager(manager manager.Manager) error { // https://github.com/kubernetes-sigs/controller-runtime/blob/master/pkg/webhook/admission/defaulter.go#L34 func register(manager manager.Manager, server *webhook.Server) error { return server.Register(&admission.Webhook{ - Name: constants.KFServiceValidatingWebhookName, + Name: constants.InferenceServiceValidatingWebhookName, FailurePolicy: &constants.WebhookFailurePolicy, Type: webhooktypes.WebhookTypeValidating, Rules: []v1beta1.RuleWithOperations{{ @@ -85,17 +85,17 @@ func register(manager manager.Manager, server *webhook.Server) error { Rule: v1beta1.Rule{ APIGroups: []string{constants.KFServingAPIGroupName}, APIVersions: []string{v1alpha2.APIVersion}, - Resources: []string{constants.KFServiceAPIName}, + Resources: []string{constants.InferenceServiceAPIName}, }, }}, Handlers: []admission.Handler{ - &kfservice.Validator{ + &inferenceservice.Validator{ Client: manager.GetClient(), Decoder: manager.GetAdmissionDecoder(), }, }, }, &admission.Webhook{ - Name: constants.KFServiceDefaultingWebhookName, + Name: constants.InferenceServiceDefaultingWebhookName, FailurePolicy: &constants.WebhookFailurePolicy, Type: webhooktypes.WebhookTypeMutating, Rules: []v1beta1.RuleWithOperations{{ @@ -106,11 +106,11 @@ func register(manager manager.Manager, server *webhook.Server) error { Rule: v1beta1.Rule{ APIGroups: []string{constants.KFServingAPIGroupName}, APIVersions: []string{v1alpha2.APIVersion}, - Resources: []string{constants.KFServiceAPIName}, + Resources: []string{constants.InferenceServiceAPIName}, }, }}, Handlers: []admission.Handler{ - &kfservice.Defaulter{ + &inferenceservice.Defaulter{ Client: manager.GetClient(), Decoder: manager.GetAdmissionDecoder(), }, diff --git a/python/kfserving/README.md b/python/kfserving/README.md index 6765dca44b..89b461e95e 100644 --- a/python/kfserving/README.md +++ b/python/kfserving/README.md @@ -50,16 +50,16 @@ KFServing supports the following storage providers: ### Getting Started -KFServing's python client interacts with KFServing APIs for executing operations on a remote KFServing cluster, such as creating, patching and deleting of a KFService instance. See the [Sample for KFServing Python SDK Client](../../docs/samples/client/kfserving_sdk_sample.ipynb) to get started. +KFServing's python client interacts with KFServing APIs for executing operations on a remote KFServing cluster, such as creating, patching and deleting of a InferenceService instance. See the [Sample for KFServing Python SDK Client](../../docs/samples/client/kfserving_sdk_sample.ipynb) to get started. ### Documentation for Client API Class | Method | Description ------------ | ------------- | ------------- -[KFServingClient](docs/KFServingClient.md) | [create](docs/KFServingClient.md#create) | Create the provided KFService in the specified namespace| -[KFServingClient](docs/KFServingClient.md) | [get](docs/KFServingClient.md#get) | Get the created KFService in the specified namespace| -[KFServingClient](docs/KFServingClient.md) | [patch](docs/KFServingClient.md#patch) | Patch the created KFService in the specified namespace | -[KFServingClient](docs/KFServingClient.md) | [delete](docs/KFServingClient.md#delete) | Delete the created KFService in the specified namespace | +[KFServingClient](docs/KFServingClient.md) | [create](docs/KFServingClient.md#create) | Create the provided InferenceService in the specified namespace| +[KFServingClient](docs/KFServingClient.md) | [get](docs/KFServingClient.md#get) | Get the created InferenceService in the specified namespace| +[KFServingClient](docs/KFServingClient.md) | [patch](docs/KFServingClient.md#patch) | Patch the created InferenceService in the specified namespace | +[KFServingClient](docs/KFServingClient.md) | [delete](docs/KFServingClient.md#delete) | Delete the created InferenceService in the specified namespace | ## Documentation For Models @@ -73,10 +73,10 @@ Class | Method | Description - [V1alpha2ExplainerSpec](docs/V1alpha2ExplainerSpec.md) - [V1alpha2FrameworkConfig](docs/V1alpha2FrameworkConfig.md) - [V1alpha2FrameworksConfig](docs/V1alpha2FrameworksConfig.md) - - [V1alpha2KFService](docs/V1alpha2KFService.md) - - [V1alpha2KFServiceList](docs/V1alpha2KFServiceList.md) - - [V1alpha2KFServiceSpec](docs/V1alpha2KFServiceSpec.md) - - [V1alpha2KFServiceStatus](docs/V1alpha2KFServiceStatus.md) + - [V1alpha2InferenceService](docs/V1alpha2InferenceService.md) + - [V1alpha2InferenceServiceList](docs/V1alpha2InferenceServiceList.md) + - [V1alpha2InferenceServiceSpec](docs/V1alpha2InferenceServiceSpec.md) + - [V1alpha2InferenceServiceStatus](docs/V1alpha2InferenceServiceStatus.md) - [V1alpha2ONNXSpec](docs/V1alpha2ONNXSpec.md) - [V1alpha2PredictorSpec](docs/V1alpha2PredictorSpec.md) - [V1alpha2PyTorchSpec](docs/V1alpha2PyTorchSpec.md) diff --git a/python/kfserving/docs/KFServingClient.md b/python/kfserving/docs/KFServingClient.md index e51dd0bcc9..e0668b35b1 100644 --- a/python/kfserving/docs/KFServingClient.md +++ b/python/kfserving/docs/KFServingClient.md @@ -17,18 +17,18 @@ The APIs for KFServingClient are as following: Class | Method | Description ------------ | ------------- | ------------- KFServingClient | [set_credentials](#set_credentials) | Set Credentials| -KFServingClient | [create](#create) | Create KFService| -KFServingClient | [get](#get) | Get or watch the specified KFService or all KFServices in the namespace | -KFServingClient | [patch](#patch) | Patch the specified KFService| -KFServingClient | [replace](#replace) | Replace the specified KFService| -KFServingClient | [rollout_canary](#rollout_canary) | Rollout the traffic on `canary` version for specified KFService| -KFServingClient | [promote](#promote) | Promote the `canary` version of the KFService to `default`| -KFServingClient | [delete](#delete) | Delete the specified KFService | +KFServingClient | [create](#create) | Create InferenceService| +KFServingClient | [get](#get) | Get or watch the specified InferenceService or all InferenceServices in the namespace | +KFServingClient | [patch](#patch) | Patch the specified InferenceService| +KFServingClient | [replace](#replace) | Replace the specified InferenceService| +KFServingClient | [rollout_canary](#rollout_canary) | Rollout the traffic on `canary` version for specified InferenceService| +KFServingClient | [promote](#promote) | Promote the `canary` version of the InferenceService to `default`| +KFServingClient | [delete](#delete) | Delete the specified InferenceService | ## set_credentials > set_credentials(storage_type, namespace=None, credentials_file=None, service_account='kfserving-service-credentials', **kwargs): -Create or update a `Secret` and `Service Account` for GCS and S3 for the provided credentials. Once the `Service Account` is applied, it may be used in the `Service Account` field of a KFService's [V1alpha2ModelSpec](V1alpha2ModelSpec.md). +Create or update a `Secret` and `Service Account` for GCS and S3 for the provided credentials. Once the `Service Account` is applied, it may be used in the `Service Account` field of a InferenceService's [V1alpha2ModelSpec](V1alpha2ModelSpec.md). ### Example @@ -90,9 +90,9 @@ s3_verify_ssl | str | S3 only|Optional. If HTTPS is used, SSL verification coul ## create -> create(kfservice, namespace=None, watch=False, timeout_seconds=600) +> create(inferenceservice, namespace=None, watch=False, timeout_seconds=600) -Create the provided KFService in the specified namespace +Create the provided InferenceService in the specified namespace ### Example @@ -104,33 +104,33 @@ from kfserving import constants from kfserving import V1alpha2EndpointSpec from kfserving import V1alpha2PredictorSpec from kfserving import V1alpha2TensorflowSpec -from kfserving import V1alpha2KFServiceSpec -from kfserving import V1alpha2KFService +from kfserving import V1alpha2InferenceServiceSpec +from kfserving import V1alpha2InferenceService default_model_spec = V1alpha2EndpointSpec(predictor=V1alpha2PredictorSpec(tensorflow=V1alpha2TensorflowSpec( storage_uri='gs://kfserving-samples/models/tensorflow/flowers'))) -kfsvc = V1alpha2KFService(api_version=constants.KFSERVING_GROUP + '/' + constants.KFSERVING_VERSION, +isvc = V1alpha2InferenceService(api_version=constants.KFSERVING_GROUP + '/' + constants.KFSERVING_VERSION, kind=constants.KFSERVING_KIND, metadata=client.V1ObjectMeta(name='flower-sample', namespace='kubeflow'), - spec=V1alpha2KFServiceSpec(default=default_model_spec)) + spec=V1alpha2InferenceServiceSpec(default=default_model_spec)) KFServing = KFServingClient() -KFServing.create(kfsvc) +KFServing.create(isvc) -# The API also supports watching the created KFService status till it's READY. -# KFServing.create(kfsvc, watch=True) +# The API also supports watching the created InferenceService status till it's READY. +# KFServing.create(isvc, watch=True) ``` ### Parameters Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -kfservice | [V1alpha2KFService](V1alpha2KFService.md) | KFService defination| Required | -namespace | str | Namespace for KFService deploying to. If the `namespace` is not defined, will align with KFService definition, or use current or default namespace if namespace is not specified in KFService definition. | Optional | -watch | bool | Watch the created KFService if `True`, otherwise will return the created KFService object. Stop watching if KFService reaches the optional specified `timeout_seconds` or once the KFService overall status `READY` is `True`. | Optional | +inferenceservice | [V1alpha2InferenceService](V1alpha2InferenceService.md) | InferenceService defination| Required | +namespace | str | Namespace for InferenceService deploying to. If the `namespace` is not defined, will align with InferenceService definition, or use current or default namespace if namespace is not specified in InferenceService definition. | Optional | +watch | bool | Watch the created InferenceService if `True`, otherwise will return the created InferenceService object. Stop watching if InferenceService reaches the optional specified `timeout_seconds` or once the InferenceService overall status `READY` is `True`. | Optional | timeout_seconds | int | Timeout seconds for watching. Defaults to 600. | Optional | ### Return type @@ -139,7 +139,7 @@ object ## get > get(name=None, namespace=None, watch=False, timeout_seconds=600) -Get the created KFService in the specified namespace +Get the created InferenceService in the specified namespace ### Example @@ -149,14 +149,14 @@ from kfserving import KFServingClient KFServing = KFServingClient() KFServing.get('flower-sample', namespace='kubeflow') ``` -The API also support watching the specified KFService or all KFService in the namespace. +The API also support watching the specified InferenceService or all InferenceService in the namespace. ```python from kfserving import KFServingClient KFServing = KFServingClient() KFServing.get('flower-sample', namespace='kubeflow', watch=True, timeout_seconds=120) ``` -The outputs will be as following. Stop watching if KFService reaches the optional specified `timeout_seconds` or once the KFService overall status `READY` is `True`. +The outputs will be as following. Stop watching if InferenceService reaches the optional specified `timeout_seconds` or once the InferenceService overall status `READY` is `True`. ```sh NAME READY DEFAULT_TRAFFIC CANARY_TRAFFIC URL flower-sample Unknown http://flower-sample.kubeflow.example.com @@ -168,9 +168,9 @@ flower-sample True 90 10 http://flower-sa ### Parameters Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -name | str | KFService name. If the `name` is not specified, it will get or watch all KFServices in the namespace.| Optional. | -namespace | str | The KFService's namespace. Defaults to current or default namespace.| Optional | -watch | bool | Watch the specified KFService or all KFService in the namespace if `True`, otherwise will return object for the specified KFService or all KFService in the namespace. Stop watching if KFService reaches the optional specified `timeout_seconds` or once the speficed KFService overall status `READY` is `True` (Only if the `name` is speficed). | Optional | +name | str | InferenceService name. If the `name` is not specified, it will get or watch all InferenceServices in the namespace.| Optional. | +namespace | str | The InferenceService's namespace. Defaults to current or default namespace.| Optional | +watch | bool | Watch the specified InferenceService or all InferenceService in the namespace if `True`, otherwise will return object for the specified InferenceService or all InferenceService in the namespace. Stop watching if InferenceService reaches the optional specified `timeout_seconds` or once the speficed InferenceService overall status `READY` is `True` (Only if the `name` is speficed). | Optional | timeout_seconds | int | Timeout seconds for watching. Defaults to 600. | Optional | ### Return type @@ -178,9 +178,9 @@ object ## patch -> patch(name, kfservice, namespace=None, watch=False, timeout_seconds=600) +> patch(name, inferenceservice, namespace=None, watch=False, timeout_seconds=600) -Patch the created KFService in the specified namespace. +Patch the created InferenceService in the specified namespace. Note that if you want to set the field from existing value to `None`, `patch` API may not work, you need to use [replace](#replace) API to remove the field value. @@ -192,8 +192,8 @@ from kfserving import constants from kfserving import V1alpha2EndpointSpec from kfserving import V1alpha2PredictorSpec from kfserving import V1alpha2TensorflowSpec -from kfserving import V1alpha2KFServiceSpec -from kfserving import V1alpha2KFService +from kfserving import V1alpha2InferenceServiceSpec +from kfserving import V1alpha2InferenceService from kfserving import KFServingClient default_model_spec = V1alpha2EndpointSpec(predictor=V1alpha2PredictorSpec(tensorflow=V1alpha2TensorflowSpec( @@ -201,35 +201,35 @@ default_model_spec = V1alpha2EndpointSpec(predictor=V1alpha2PredictorSpec(tensor canary_model_spec = V1alpha2EndpointSpec(predictor=V1alpha2PredictorSpec(tensorflow=V1alpha2TensorflowSpec( storage_uri='gs://kfserving-samples/models/tensorflow/flowers'))) -kfsvc = V1alpha2KFService(api_version=constants.KFSERVING_GROUP + '/' + constants.KFSERVING_VERSION, +isvc = V1alpha2InferenceService(api_version=constants.KFSERVING_GROUP + '/' + constants.KFSERVING_VERSION, kind=constants.KFSERVING_KIND, metadata=client.V1ObjectMeta(name='flower-sample', namespace='kubeflow'), - spec=V1alpha2KFServiceSpec(default=default_model_spec, + spec=V1alpha2InferenceServiceSpec(default=default_model_spec, canary=canary_model_spec, canary_traffic_percent=10)) KFServing = KFServingClient() -KFServing.patch('flower-sample', kfsvc) +KFServing.patch('flower-sample', isvc) -# The API also supports watching the patached KFService status till it's READY. -# KFServing.patch('flower-sample', kfsvc, watch=True) +# The API also supports watching the patached InferenceService status till it's READY. +# KFServing.patch('flower-sample', isvc, watch=True) ``` ### Parameters Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -kfservice | [V1alpha2KFService](V1alpha2KFService.md) | KFService defination| Required | -namespace | str | The KFService's namespace for patching. If the `namespace` is not defined, will align with KFService definition, or use current or default namespace if namespace is not specified in KFService definition. | Optional| -watch | bool | Watch the patched KFService if `True`, otherwise will return the patched KFService object. Stop watching if KFService reaches the optional specified `timeout_seconds` or once the KFService overall status `READY` is `True`. | Optional | +inferenceservice | [V1alpha2InferenceService](V1alpha2InferenceService.md) | InferenceService defination| Required | +namespace | str | The InferenceService's namespace for patching. If the `namespace` is not defined, will align with InferenceService definition, or use current or default namespace if namespace is not specified in InferenceService definition. | Optional| +watch | bool | Watch the patched InferenceService if `True`, otherwise will return the patched InferenceService object. Stop watching if InferenceService reaches the optional specified `timeout_seconds` or once the InferenceService overall status `READY` is `True`. | Optional | timeout_seconds | int | Timeout seconds for watching. Defaults to 600. | Optional | ### Return type object ## replace -> replace(name, kfservice, namespace=None, watch=False, timeout_seconds=600) +> replace(name, inferenceservice, namespace=None, watch=False, timeout_seconds=600) -Replace the created KFService in the specified namespace. Generally use the `replace` API to update whole KFService or remove a field such as canary or other components of the KFService. +Replace the created InferenceService in the specified namespace. Generally use the `replace` API to update whole InferenceService or remove a field such as canary or other components of the InferenceService. ### Example @@ -239,8 +239,8 @@ from kfserving import constants from kfserving import V1alpha2EndpointSpec from kfserving import V1alpha2PredictorSpec from kfserving import V1alpha2TensorflowSpec -from kfserving import V1alpha2KFServiceSpec -from kfserving import V1alpha2KFService +from kfserving import V1alpha2InferenceServiceSpec +from kfserving import V1alpha2InferenceService from kfserving import KFServingClient default_endpoint_spec = V1alpha2EndpointSpec( @@ -249,30 +249,30 @@ default_endpoint_spec = V1alpha2EndpointSpec( storage_uri='gs://kfserving-samples/models/tensorflow/flowers', resources=None))) -kfsvc = V1alpha2KFService(api_version=api_version, +isvc = V1alpha2InferenceService(api_version=api_version, kind=constants.KFSERVING_KIND, metadata=client.V1ObjectMeta( name='flower-sample', namespace='kubeflow', resource_version=resource_version), - spec=V1alpha2KFServiceSpec(default=default_endpoint_spec, + spec=V1alpha2InferenceServiceSpec(default=default_endpoint_spec, canary=None, canary_traffic_percent=0)) KFServing = KFServingClient() -KFServing.replace('flower-sample', kfsvc) +KFServing.replace('flower-sample', isvc) -# The API also supports watching the replaced KFService status till it's READY. -# KFServing.replace('flower-sample', kfsvc, watch=True) +# The API also supports watching the replaced InferenceService status till it's READY. +# KFServing.replace('flower-sample', isvc, watch=True) ``` ### Parameters Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -kfservice | [V1alpha2KFService](V1alpha2KFService.md) | KFService defination| Required | -namespace | str | The KFService's namespace. If the `namespace` is not defined, will align with KFService definition, or use current or default namespace if namespace is not specified in KFService definition. | Optional| -watch | bool | Watch the patched KFService if `True`, otherwise will return the replaced KFService object. Stop watching if KFService reaches the optional specified `timeout_seconds` or once the KFService overall status `READY` is `True`. | Optional | +inferenceservice | [V1alpha2InferenceService](V1alpha2InferenceService.md) | InferenceService defination| Required | +namespace | str | The InferenceService's namespace. If the `namespace` is not defined, will align with InferenceService definition, or use current or default namespace if namespace is not specified in InferenceService definition. | Optional| +watch | bool | Watch the patched InferenceService if `True`, otherwise will return the replaced InferenceService object. Stop watching if InferenceService reaches the optional specified `timeout_seconds` or once the InferenceService overall status `READY` is `True`. | Optional | timeout_seconds | int | Timeout seconds for watching. Defaults to 600. | Optional | ### Return type @@ -281,9 +281,9 @@ object ## rollout_canary > rollout_canary(name, percent=100, canary=None, namespace=None, watch=False, timeout_seconds=600) -Rollout canary for the created KFService in the specified namespace. The `rollout_canary` API updates the KFService `canaryTrafficPercent` to speficed `percent` to adjust the traffic percent that will be distributed on the canary version. The `rollout_canary` also supports setting or updating `canary` endpoint spec for the KFServing. If the KFService has no `canary` endpoint spec, need to specify with the API it while setting `canaryTrafficPercent`. +Rollout canary for the created InferenceService in the specified namespace. The `rollout_canary` API updates the InferenceService `canaryTrafficPercent` to speficed `percent` to adjust the traffic percent that will be distributed on the canary version. The `rollout_canary` also supports setting or updating `canary` endpoint spec for the KFServing. If the InferenceService has no `canary` endpoint spec, need to specify with the API it while setting `canaryTrafficPercent`. -The difference between [rollout_canary](#rollout_canary) and [promote](#promote) is that the `rollout_canary` only updates `canaryTrafficPercent` (or `canary` endpoint spec) while the `promote` moves the `canary` version of the KFService to `default`. +The difference between [rollout_canary](#rollout_canary) and [promote](#promote) is that the `rollout_canary` only updates `canaryTrafficPercent` (or `canary` endpoint spec) while the `promote` moves the `canary` version of the InferenceService to `default`. ### Example @@ -301,18 +301,18 @@ canary_spec = V1alpha2EndpointSpec( KFServing.rollout_canary('flower-sample', percent=50, canary=canary_spec, namespace='kubeflow') -# The API also supports watching the KFService status till it's READY. +# The API also supports watching the InferenceService status till it's READY. # KFServing.rollout_canary('flower-sample', percent=50, namespace='kubeflow', watch=True) ``` ### Parameters Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -name | str | The KFService name for promoting.| Required| +name | str | The InferenceService name for promoting.| Required| percent | int | The traffic percent that will be distributed on the canary version.| Required| canary | [V1alpha2EndpointSpec](V1alpha2EndpointSpec.md) | The canary endpoint spec for KFServing.|Optional | -namespace | str | The KFService's namespace. If the `namespace` is not defined, will align with KFService definition, or use current or default namespace if namespace is not specified in KFService definition. | Optional| -watch | bool | Watch the KFService if `True`, otherwise will return the KFService object. Stop watching if KFService reaches the optional specified `timeout_seconds` or once the KFService overall status `READY` is `True`. | Optional | +namespace | str | The InferenceService's namespace. If the `namespace` is not defined, will align with InferenceService definition, or use current or default namespace if namespace is not specified in InferenceService definition. | Optional| +watch | bool | Watch the InferenceService if `True`, otherwise will return the InferenceService object. Stop watching if InferenceService reaches the optional specified `timeout_seconds` or once the InferenceService overall status `READY` is `True`. | Optional | timeout_seconds | int | Timeout seconds for watching. Defaults to 600. | Optional | ### Return type @@ -321,7 +321,7 @@ object ## promote > promote(name, namespace=None, watch=False, timeout_seconds=600) -Promote the `Canary KFServiceSpec` to `Default KFServiceSpec` for the created KFService in the specified namespace. +Promote the `Canary InferenceServiceSpec` to `Default InferenceServiceSpec` for the created InferenceService in the specified namespace. If you just want to update canary version and canary traffic percent, please use API [rollout_canary](#rollout_canary). @@ -332,16 +332,16 @@ If you just want to update canary version and canary traffic percent, please use KFServing = KFServingClient() KFServing.promote('flower-sample', namespace='kubeflow') -# The API also supports watching the promoted KFService status till it's READY. +# The API also supports watching the promoted InferenceService status till it's READY. # KFServing.promote('flower-sample', namespace='kubeflow', watch=True) ``` ### Parameters Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -name | str | The KFService name for promoting.| Required| -namespace | str | The KFService's namespace. If the `namespace` is not defined, will align with KFService definition, or use current or default namespace if namespace is not specified in KFService definition. | Optional| -watch | bool | Watch the promoted KFService if `True`, otherwise will return the promoted KFService object. Stop watching if KFService reaches the optional specified `timeout_seconds` or once the KFService overall status `READY` is `True`. | Optional | +name | str | The InferenceService name for promoting.| Required| +namespace | str | The InferenceService's namespace. If the `namespace` is not defined, will align with InferenceService definition, or use current or default namespace if namespace is not specified in InferenceService definition. | Optional| +watch | bool | Watch the promoted InferenceService if `True`, otherwise will return the promoted InferenceService object. Stop watching if InferenceService reaches the optional specified `timeout_seconds` or once the InferenceService overall status `READY` is `True`. | Optional | timeout_seconds | int | Timeout seconds for watching. Defaults to 600. | Optional | ### Return type @@ -351,7 +351,7 @@ object ## delete > delete(name, namespace=None) -Delete the created KFService in the specified namespace +Delete the created InferenceService in the specified namespace ### Example @@ -365,8 +365,8 @@ KFServing.delete('flower-sample', namespace='kubeflow') ### Parameters Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -name | str | KFService name| | -namespace | str | The kfservice's namespace. Defaults to current or default namespace. | Optional| +name | str | InferenceService name| | +namespace | str | The inferenceservice's namespace. Defaults to current or default namespace. | Optional| ### Return type object diff --git a/python/kfserving/docs/V1alpha2KFService.md b/python/kfserving/docs/V1alpha2InferenceService.md similarity index 82% rename from python/kfserving/docs/V1alpha2KFService.md rename to python/kfserving/docs/V1alpha2InferenceService.md index 657686f984..bf272dfe5d 100644 --- a/python/kfserving/docs/V1alpha2KFService.md +++ b/python/kfserving/docs/V1alpha2InferenceService.md @@ -1,4 +1,4 @@ -# V1alpha2KFService +# V1alpha2InferenceService ## Properties Name | Type | Description | Notes @@ -6,8 +6,8 @@ Name | Type | Description | Notes **api_version** | **str** | APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources | [optional] **kind** | **str** | Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds | [optional] **metadata** | [**V1ObjectMeta**](https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1ObjectMeta.md) | | [optional] -**spec** | [**V1alpha2KFServiceSpec**](V1alpha2KFServiceSpec.md) | | [optional] -**status** | [**V1alpha2KFServiceStatus**](V1alpha2KFServiceStatus.md) | | [optional] +**spec** | [**V1alpha2InferenceServiceSpec**](V1alpha2InferenceServiceSpec.md) | | [optional] +**status** | [**V1alpha2InferenceServiceStatus**](V1alpha2InferenceServiceStatus.md) | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/python/kfserving/docs/V1alpha2KFServiceList.md b/python/kfserving/docs/V1alpha2InferenceServiceList.md similarity index 90% rename from python/kfserving/docs/V1alpha2KFServiceList.md rename to python/kfserving/docs/V1alpha2InferenceServiceList.md index 8ebb88b985..c79df10e10 100644 --- a/python/kfserving/docs/V1alpha2KFServiceList.md +++ b/python/kfserving/docs/V1alpha2InferenceServiceList.md @@ -1,10 +1,10 @@ -# V1alpha2KFServiceList +# V1alpha2InferenceServiceList ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **api_version** | **str** | APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources | [optional] -**items** | [**list[V1alpha2KFService]**](V1alpha2KFService.md) | | +**items** | [**list[V1alpha2InferenceService]**](V1alpha2InferenceService.md) | | **kind** | **str** | Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds | [optional] **metadata** | [**V1ListMeta**](https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1ListMeta.md) | | [optional] diff --git a/python/kfserving/docs/V1alpha2KFServiceSpec.md b/python/kfserving/docs/V1alpha2InferenceServiceSpec.md similarity index 75% rename from python/kfserving/docs/V1alpha2KFServiceSpec.md rename to python/kfserving/docs/V1alpha2InferenceServiceSpec.md index ce1e7b55ef..c961727284 100644 --- a/python/kfserving/docs/V1alpha2KFServiceSpec.md +++ b/python/kfserving/docs/V1alpha2InferenceServiceSpec.md @@ -1,11 +1,11 @@ -# V1alpha2KFServiceSpec +# V1alpha2InferenceServiceSpec ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **canary** | [**V1alpha2EndpointSpec**](V1alpha2EndpointSpec.md) | Canary defines an alternate endpoints to route a percentage of traffic. | [optional] -**canary_traffic_percent** | **int** | CanaryTrafficPercent defines the percentage of traffic going to canary KFService endpoints | [optional] -**default** | [**V1alpha2EndpointSpec**](V1alpha2EndpointSpec.md) | Default defines default KFService endpoints | +**canary_traffic_percent** | **int** | CanaryTrafficPercent defines the percentage of traffic going to canary InferenceService endpoints | [optional] +**default** | [**V1alpha2EndpointSpec**](V1alpha2EndpointSpec.md) | Default defines default InferenceService endpoints | [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/python/kfserving/docs/V1alpha2KFServiceStatus.md b/python/kfserving/docs/V1alpha2InferenceServiceStatus.md similarity index 96% rename from python/kfserving/docs/V1alpha2KFServiceStatus.md rename to python/kfserving/docs/V1alpha2InferenceServiceStatus.md index 980b66785c..e120f2f02c 100644 --- a/python/kfserving/docs/V1alpha2KFServiceStatus.md +++ b/python/kfserving/docs/V1alpha2InferenceServiceStatus.md @@ -1,4 +1,4 @@ -# V1alpha2KFServiceStatus +# V1alpha2InferenceServiceStatus ## Properties Name | Type | Description | Notes diff --git a/python/kfserving/kfserving/__init__.py b/python/kfserving/kfserving/__init__.py index 37852ed7d4..3f4e554f2b 100644 --- a/python/kfserving/kfserving/__init__.py +++ b/python/kfserving/kfserving/__init__.py @@ -34,10 +34,10 @@ from .models.v1alpha2_custom_spec import V1alpha2CustomSpec from .models.v1alpha2_framework_config import V1alpha2FrameworkConfig from .models.v1alpha2_frameworks_config import V1alpha2FrameworksConfig -from .models.v1alpha2_kf_service import V1alpha2KFService -from .models.v1alpha2_kf_service_list import V1alpha2KFServiceList -from .models.v1alpha2_kf_service_spec import V1alpha2KFServiceSpec -from .models.v1alpha2_kf_service_status import V1alpha2KFServiceStatus +from .models.v1alpha2_inference_service import V1alpha2InferenceService +from .models.v1alpha2_inference_service_list import V1alpha2InferenceServiceList +from .models.v1alpha2_inference_service_spec import V1alpha2InferenceServiceSpec +from .models.v1alpha2_inference_service_status import V1alpha2InferenceServiceStatus from .models.v1alpha2_endpoint_spec import V1alpha2EndpointSpec from .models.v1alpha2_predictor_spec import V1alpha2PredictorSpec from .models.v1alpha2_transformer_spec import V1alpha2TransformerSpec diff --git a/python/kfserving/kfserving/api/creds_utils.py b/python/kfserving/kfserving/api/creds_utils.py index babf5cc4c7..c86d5015a9 100644 --- a/python/kfserving/kfserving/api/creds_utils.py +++ b/python/kfserving/kfserving/api/creds_utils.py @@ -226,23 +226,23 @@ def patch_service_account(secret_name, namespace, sa_name): def get_creds_name_from_config_map(creds): - '''Get the credentials name from kfservice config map.''' + '''Get the credentials name from inferenceservice config map.''' try: - kfsvc_config_map = client.CoreV1Api().read_namespaced_config_map( - constants.KFSERVICE_CONFIG_MAP_NAME, - constants.KFSERVICE_SYSTEM_NAMESPACE) + isvc_config_map = client.CoreV1Api().read_namespaced_config_map( + constants.INFERENCESERVICE_CONFIG_MAP_NAME, + constants.INFERENCESERVICE_SYSTEM_NAMESPACE) except client.rest.ApiException as e: raise RuntimeError( "Exception when calling CoreV1Api->read_namespaced_config_map: %s\n" % e) - kfsvc_creds_str = kfsvc_config_map.data['credentials'] - kfsvc_creds_json = json.loads(kfsvc_creds_str) + isvc_creds_str = isvc_config_map.data['credentials'] + isvc_creds_json = json.loads(isvc_creds_str) if creds == 'gcsCredentialFileName': - return kfsvc_creds_json['gcs']['gcsCredentialFileName'] + return isvc_creds_json['gcs']['gcsCredentialFileName'] elif creds == 's3AccessKeyIDName': - return kfsvc_creds_json['s3']['s3AccessKeyIDName'] + return isvc_creds_json['s3']['s3AccessKeyIDName'] elif creds == 's3SecretAccessKeyName': - return kfsvc_creds_json['s3']['s3SecretAccessKeyName'] + return isvc_creds_json['s3']['s3SecretAccessKeyName'] else: raise RuntimeError("Unknown credentials.") diff --git a/python/kfserving/kfserving/api/kf_serving_client.py b/python/kfserving/kfserving/api/kf_serving_client.py index 92b077c53b..f0aec0f4ed 100644 --- a/python/kfserving/kfserving/api/kf_serving_client.py +++ b/python/kfserving/kfserving/api/kf_serving_client.py @@ -18,9 +18,9 @@ from ..constants import constants from ..utils import utils from .creds_utils import set_gcs_credentials, set_s3_credentials, set_azure_credentials -from .kf_serving_watch import watch as kfsvc_watch -from ..models.v1alpha2_kf_service import V1alpha2KFService -from ..models.v1alpha2_kf_service_spec import V1alpha2KFServiceSpec +from .kf_serving_watch import watch as isvc_watch +from ..models.v1alpha2_inference_service import V1alpha2InferenceService +from ..models.v1alpha2_inference_service_spec import V1alpha2InferenceServiceSpec class KFServingClient(object): @@ -77,11 +77,11 @@ def set_credentials(self, storage_type, namespace=None, credentials_file=None, raise RuntimeError("Invalid storage_type: %s, only support GCS, S3 and Azure\ currently.\n" % storage_type) - def create(self, kfservice, namespace=None, watch=False, timeout_seconds=600): #pylint:disable=inconsistent-return-statements - """Create the provided KFService in the specified namespace""" + def create(self, inferenceservice, namespace=None, watch=False, timeout_seconds=600): #pylint:disable=inconsistent-return-statements + """Create the provided InferenceService in the specified namespace""" if namespace is None: - namespace = utils.set_kfsvc_namespace(kfservice) + namespace = utils.set_isvc_namespace(inferenceservice) try: outputs = self.api_instance.create_namespaced_custom_object( @@ -89,14 +89,14 @@ def create(self, kfservice, namespace=None, watch=False, timeout_seconds=600): # constants.KFSERVING_VERSION, namespace, constants.KFSERVING_PLURAL, - kfservice) + inferenceservice) except client.rest.ApiException as e: raise RuntimeError( "Exception when calling CustomObjectsApi->create_namespaced_custom_object:\ %s\n" % e) if watch: - kfsvc_watch( + isvc_watch( name=outputs['metadata']['name'], namespace=namespace, timeout_seconds=timeout_seconds) @@ -104,14 +104,14 @@ def create(self, kfservice, namespace=None, watch=False, timeout_seconds=600): # return outputs def get(self, name=None, namespace=None, watch=False, timeout_seconds=600): #pylint:disable=inconsistent-return-statements - """Get the created KFService in the specified namespace""" + """Get the created InferenceService in the specified namespace""" if namespace is None: namespace = utils.get_default_target_namespace() if name: if watch: - kfsvc_watch( + isvc_watch( name=name, namespace=namespace, timeout_seconds=timeout_seconds) @@ -129,7 +129,7 @@ def get(self, name=None, namespace=None, watch=False, timeout_seconds=600): #pyl %s\n" % e) else: if watch: - kfsvc_watch( + isvc_watch( namespace=namespace, timeout_seconds=timeout_seconds) else: @@ -144,11 +144,11 @@ def get(self, name=None, namespace=None, watch=False, timeout_seconds=600): #pyl "Exception when calling CustomObjectsApi->list_namespaced_custom_object:\ %s\n" % e) - def patch(self, name, kfservice, namespace=None, watch=False, timeout_seconds=600): # pylint:disable=too-many-arguments,inconsistent-return-statements - """Patch the created KFService in the specified namespace""" + def patch(self, name, inferenceservice, namespace=None, watch=False, timeout_seconds=600): # pylint:disable=too-many-arguments,inconsistent-return-statements + """Patch the created InferenceService in the specified namespace""" if namespace is None: - namespace = utils.set_kfsvc_namespace(kfservice) + namespace = utils.set_isvc_namespace(inferenceservice) try: outputs = self.api_instance.patch_namespaced_custom_object( @@ -157,7 +157,7 @@ def patch(self, name, kfservice, namespace=None, watch=False, timeout_seconds=60 namespace, constants.KFSERVING_PLURAL, name, - kfservice) + inferenceservice) except client.rest.ApiException as e: raise RuntimeError( "Exception when calling CustomObjectsApi->patch_namespaced_custom_object:\ @@ -166,23 +166,23 @@ def patch(self, name, kfservice, namespace=None, watch=False, timeout_seconds=60 if watch: # Sleep 3 to avoid status still be True within a very short time. time.sleep(3) - kfsvc_watch( + isvc_watch( name=outputs['metadata']['name'], namespace=namespace, timeout_seconds=timeout_seconds) else: return outputs - def replace(self, name, kfservice, namespace=None, watch=False, timeout_seconds=600): # pylint:disable=too-many-arguments,inconsistent-return-statements - """Replace the created KFService in the specified namespace""" + def replace(self, name, inferenceservice, namespace=None, watch=False, timeout_seconds=600): # pylint:disable=too-many-arguments,inconsistent-return-statements + """Replace the created InferenceService in the specified namespace""" if namespace is None: - namespace = utils.set_kfsvc_namespace(kfservice) + namespace = utils.set_isvc_namespace(inferenceservice) - if kfservice.metadata.resource_version is None: - current_kfsvc = self.get(name, namespace=namespace) - current_resource_version = current_kfsvc['metadata']['resourceVersion'] - kfservice.metadata.resource_version = current_resource_version + if inferenceservice.metadata.resource_version is None: + current_isvc = self.get(name, namespace=namespace) + current_resource_version = current_isvc['metadata']['resourceVersion'] + inferenceservice.metadata.resource_version = current_resource_version try: outputs = self.api_instance.replace_namespaced_custom_object( @@ -191,14 +191,14 @@ def replace(self, name, kfservice, namespace=None, watch=False, timeout_seconds= namespace, constants.KFSERVING_PLURAL, name, - kfservice) + inferenceservice) except client.rest.ApiException as e: raise RuntimeError( "Exception when calling CustomObjectsApi->replace_namespaced_custom_object:\ %s\n" % e) if watch: - kfsvc_watch( + isvc_watch( name=outputs['metadata']['name'], namespace=namespace, timeout_seconds=timeout_seconds) @@ -208,55 +208,55 @@ def replace(self, name, kfservice, namespace=None, watch=False, timeout_seconds= def rollout_canary(self, name, percent, namespace=None, # pylint:disable=too-many-arguments,inconsistent-return-statements canary=None, watch=False, timeout_seconds=600): - """Rollout canary for the created KFService in the specified namespace""" + """Rollout canary for the created InferenceService in the specified namespace""" if namespace is None: namespace = utils.get_default_target_namespace() - current_kfsvc = self.get(name, namespace=namespace) + current_isvc = self.get(name, namespace=namespace) - if canary is None and 'canary' not in current_kfsvc['spec']: - raise RuntimeError("Canary spec missing? Specify canary for the KFService.") + if canary is None and 'canary' not in current_isvc['spec']: + raise RuntimeError("Canary spec missing? Specify canary for the InferenceService.") - current_kfsvc['spec']['canaryTrafficPercent'] = percent + current_isvc['spec']['canaryTrafficPercent'] = percent if canary: - current_kfsvc['spec']['canary'] = canary + current_isvc['spec']['canary'] = canary - return self.patch(name=name, kfservice=current_kfsvc, namespace=namespace, + return self.patch(name=name, inferenceservice=current_isvc, namespace=namespace, watch=watch, timeout_seconds=timeout_seconds) def promote(self, name, namespace=None, watch=False, timeout_seconds=600): # pylint:disable=too-many-arguments,inconsistent-return-statements - """Promote the created KFService in the specified namespace""" + """Promote the created InferenceService in the specified namespace""" if namespace is None: namespace = utils.get_default_target_namespace() - current_kfsvc = self.get(name, namespace=namespace) - api_version = current_kfsvc['apiVersion'] + current_isvc = self.get(name, namespace=namespace) + api_version = current_isvc['apiVersion'] try: - current_canary_spec = current_kfsvc['spec']['canary'] + current_canary_spec = current_isvc['spec']['canary'] except KeyError: - raise RuntimeError("Cannot promote a KFService that has no Canary Spec.") + raise RuntimeError("Cannot promote a InferenceService that has no Canary Spec.") - kfservice = V1alpha2KFService( + inferenceservice = V1alpha2InferenceService( api_version=api_version, kind=constants.KFSERVING_KIND, metadata=client.V1ObjectMeta( name=name, namespace=namespace), - spec=V1alpha2KFServiceSpec( + spec=V1alpha2InferenceServiceSpec( default=current_canary_spec, canary=None, canary_traffic_percent=0)) - return self.replace(name=name, kfservice=kfservice, namespace=namespace, + return self.replace(name=name, inferenceservice=inferenceservice, namespace=namespace, watch=watch, timeout_seconds=timeout_seconds) def delete(self, name, namespace=None): - """Delete the provided KFService in the specified namespace""" + """Delete the provided InferenceService in the specified namespace""" if namespace is None: namespace = utils.get_default_target_namespace() diff --git a/python/kfserving/kfserving/api/kf_serving_watch.py b/python/kfserving/kfserving/api/kf_serving_watch.py index 60a3f865e6..fec89b8f2c 100644 --- a/python/kfserving/kfserving/api/kf_serving_watch.py +++ b/python/kfserving/kfserving/api/kf_serving_watch.py @@ -21,7 +21,7 @@ def watch(name=None, namespace=None, timeout_seconds=600): - """Watch the created or patched KFService in the specified namespace""" + """Watch the created or patched InferenceService in the specified namespace""" if namespace is None: namespace = utils.get_default_target_namespace() @@ -41,8 +41,8 @@ def watch(name=None, namespace=None, timeout_seconds=600): for event in stream: kfserivce = event['object'] - kfsvc_name = kfserivce['metadata']['name'] - if name and name != kfsvc_name: + isvc_name = kfserivce['metadata']['name'] + if name and name != isvc_name: continue else: url = kfserivce['status'].get('url', '') @@ -52,7 +52,7 @@ def watch(name=None, namespace=None, timeout_seconds=600): for condition in kfserivce['status'].get('conditions', {}): if condition.get('type', '') == 'Ready': status = condition.get('status', 'Unknown') - tbl(kfsvc_name, status, default_traffic, canary_traffic, url) + tbl(isvc_name, status, default_traffic, canary_traffic, url) - if name == kfsvc_name and status == 'True': + if name == isvc_name and status == 'True': break diff --git a/python/kfserving/kfserving/constants/constants.py b/python/kfserving/kfserving/constants/constants.py index 6fbd528959..c10f67d7a6 100644 --- a/python/kfserving/kfserving/constants/constants.py +++ b/python/kfserving/kfserving/constants/constants.py @@ -14,13 +14,13 @@ # KFServing K8S constants KFSERVING_GROUP = "serving.kubeflow.org" -KFSERVING_KIND = "KFService" -KFSERVING_PLURAL = "kfservices" +KFSERVING_KIND = "InferenceService" +KFSERVING_PLURAL = "inferenceservices" KFSERVING_VERSION = "v1alpha2" -# KFservice credentials common constants -KFSERVICE_CONFIG_MAP_NAME = 'kfservice-config' -KFSERVICE_SYSTEM_NAMESPACE = 'kfserving-system' +# INFERENCESERVICE credentials common constants +INFERENCESERVICE_CONFIG_MAP_NAME = 'inferenceservice-config' +INFERENCESERVICE_SYSTEM_NAMESPACE = 'kfserving-system' DEFAULT_SECRET_NAME = "kfserving-secret-" DEFAULT_SA_NAME = "kfserving-service-credentials" diff --git a/python/kfserving/kfserving/models/__init__.py b/python/kfserving/kfserving/models/__init__.py index 7a65b966d2..f266b931d0 100644 --- a/python/kfserving/kfserving/models/__init__.py +++ b/python/kfserving/kfserving/models/__init__.py @@ -38,10 +38,10 @@ from kfserving.models.v1alpha2_explainer_spec import V1alpha2ExplainerSpec from kfserving.models.v1alpha2_framework_config import V1alpha2FrameworkConfig from kfserving.models.v1alpha2_frameworks_config import V1alpha2FrameworksConfig -from kfserving.models.v1alpha2_kf_service import V1alpha2KFService -from kfserving.models.v1alpha2_kf_service_list import V1alpha2KFServiceList -from kfserving.models.v1alpha2_kf_service_spec import V1alpha2KFServiceSpec -from kfserving.models.v1alpha2_kf_service_status import V1alpha2KFServiceStatus +from kfserving.models.v1alpha2_inference_service import V1alpha2InferenceService +from kfserving.models.v1alpha2_inference_service_list import V1alpha2InferenceServiceList +from kfserving.models.v1alpha2_inference_service_spec import V1alpha2InferenceServiceSpec +from kfserving.models.v1alpha2_inference_service_status import V1alpha2InferenceServiceStatus from kfserving.models.v1alpha2_onnx_spec import V1alpha2ONNXSpec from kfserving.models.v1alpha2_predictor_spec import V1alpha2PredictorSpec from kfserving.models.v1alpha2_py_torch_spec import V1alpha2PyTorchSpec diff --git a/python/kfserving/kfserving/models/v1alpha2_kf_service.py b/python/kfserving/kfserving/models/v1alpha2_inference_service.py similarity index 72% rename from python/kfserving/kfserving/models/v1alpha2_kf_service.py rename to python/kfserving/kfserving/models/v1alpha2_inference_service.py index c77edde0fa..84231c1932 100644 --- a/python/kfserving/kfserving/models/v1alpha2_kf_service.py +++ b/python/kfserving/kfserving/models/v1alpha2_inference_service.py @@ -30,12 +30,12 @@ import six -from kfserving.models.v1alpha2_kf_service_spec import V1alpha2KFServiceSpec # noqa: F401,E501 -from kfserving.models.v1alpha2_kf_service_status import V1alpha2KFServiceStatus # noqa: F401,E501 +from kfserving.models.v1alpha2_inference_service_spec import V1alpha2InferenceServiceSpec # noqa: F401,E501 +from kfserving.models.v1alpha2_inference_service_status import V1alpha2InferenceServiceStatus # noqa: F401,E501 from kubernetes.client import V1ObjectMeta # noqa: F401,E501 -class V1alpha2KFService(object): +class V1alpha2InferenceService(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. @@ -52,8 +52,8 @@ class V1alpha2KFService(object): 'api_version': 'str', 'kind': 'str', 'metadata': 'V1ObjectMeta', - 'spec': 'V1alpha2KFServiceSpec', - 'status': 'V1alpha2KFServiceStatus' + 'spec': 'V1alpha2InferenceServiceSpec', + 'status': 'V1alpha2InferenceServiceStatus' } attribute_map = { @@ -65,7 +65,7 @@ class V1alpha2KFService(object): } def __init__(self, api_version=None, kind=None, metadata=None, spec=None, status=None): # noqa: E501 - """V1alpha2KFService - a model defined in Swagger""" # noqa: E501 + """V1alpha2InferenceService - a model defined in Swagger""" # noqa: E501 self._api_version = None self._kind = None @@ -87,22 +87,22 @@ def __init__(self, api_version=None, kind=None, metadata=None, spec=None, status @property def api_version(self): - """Gets the api_version of this V1alpha2KFService. # noqa: E501 + """Gets the api_version of this V1alpha2InferenceService. # noqa: E501 APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources # noqa: E501 - :return: The api_version of this V1alpha2KFService. # noqa: E501 + :return: The api_version of this V1alpha2InferenceService. # noqa: E501 :rtype: str """ return self._api_version @api_version.setter def api_version(self, api_version): - """Sets the api_version of this V1alpha2KFService. + """Sets the api_version of this V1alpha2InferenceService. APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources # noqa: E501 - :param api_version: The api_version of this V1alpha2KFService. # noqa: E501 + :param api_version: The api_version of this V1alpha2InferenceService. # noqa: E501 :type: str """ @@ -110,22 +110,22 @@ def api_version(self, api_version): @property def kind(self): - """Gets the kind of this V1alpha2KFService. # noqa: E501 + """Gets the kind of this V1alpha2InferenceService. # noqa: E501 Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds # noqa: E501 - :return: The kind of this V1alpha2KFService. # noqa: E501 + :return: The kind of this V1alpha2InferenceService. # noqa: E501 :rtype: str """ return self._kind @kind.setter def kind(self, kind): - """Sets the kind of this V1alpha2KFService. + """Sets the kind of this V1alpha2InferenceService. Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds # noqa: E501 - :param kind: The kind of this V1alpha2KFService. # noqa: E501 + :param kind: The kind of this V1alpha2InferenceService. # noqa: E501 :type: str """ @@ -133,20 +133,20 @@ def kind(self, kind): @property def metadata(self): - """Gets the metadata of this V1alpha2KFService. # noqa: E501 + """Gets the metadata of this V1alpha2InferenceService. # noqa: E501 - :return: The metadata of this V1alpha2KFService. # noqa: E501 + :return: The metadata of this V1alpha2InferenceService. # noqa: E501 :rtype: V1ObjectMeta """ return self._metadata @metadata.setter def metadata(self, metadata): - """Sets the metadata of this V1alpha2KFService. + """Sets the metadata of this V1alpha2InferenceService. - :param metadata: The metadata of this V1alpha2KFService. # noqa: E501 + :param metadata: The metadata of this V1alpha2InferenceService. # noqa: E501 :type: V1ObjectMeta """ @@ -154,42 +154,42 @@ def metadata(self, metadata): @property def spec(self): - """Gets the spec of this V1alpha2KFService. # noqa: E501 + """Gets the spec of this V1alpha2InferenceService. # noqa: E501 - :return: The spec of this V1alpha2KFService. # noqa: E501 - :rtype: V1alpha2KFServiceSpec + :return: The spec of this V1alpha2InferenceService. # noqa: E501 + :rtype: V1alpha2InferenceServiceSpec """ return self._spec @spec.setter def spec(self, spec): - """Sets the spec of this V1alpha2KFService. + """Sets the spec of this V1alpha2InferenceService. - :param spec: The spec of this V1alpha2KFService. # noqa: E501 - :type: V1alpha2KFServiceSpec + :param spec: The spec of this V1alpha2InferenceService. # noqa: E501 + :type: V1alpha2InferenceServiceSpec """ self._spec = spec @property def status(self): - """Gets the status of this V1alpha2KFService. # noqa: E501 + """Gets the status of this V1alpha2InferenceService. # noqa: E501 - :return: The status of this V1alpha2KFService. # noqa: E501 - :rtype: V1alpha2KFServiceStatus + :return: The status of this V1alpha2InferenceService. # noqa: E501 + :rtype: V1alpha2InferenceServiceStatus """ return self._status @status.setter def status(self, status): - """Sets the status of this V1alpha2KFService. + """Sets the status of this V1alpha2InferenceService. - :param status: The status of this V1alpha2KFService. # noqa: E501 - :type: V1alpha2KFServiceStatus + :param status: The status of this V1alpha2InferenceService. # noqa: E501 + :type: V1alpha2InferenceServiceStatus """ self._status = status @@ -215,7 +215,7 @@ def to_dict(self): )) else: result[attr] = value - if issubclass(V1alpha2KFService, dict): + if issubclass(V1alpha2InferenceService, dict): for key, value in self.items(): result[key] = value @@ -231,7 +231,7 @@ def __repr__(self): def __eq__(self, other): """Returns true if both objects are equal""" - if not isinstance(other, V1alpha2KFService): + if not isinstance(other, V1alpha2InferenceService): return False return self.__dict__ == other.__dict__ diff --git a/python/kfserving/kfserving/models/v1alpha2_kf_service_list.py b/python/kfserving/kfserving/models/v1alpha2_inference_service_list.py similarity index 76% rename from python/kfserving/kfserving/models/v1alpha2_kf_service_list.py rename to python/kfserving/kfserving/models/v1alpha2_inference_service_list.py index 13db41a3aa..b0a9471b95 100644 --- a/python/kfserving/kfserving/models/v1alpha2_kf_service_list.py +++ b/python/kfserving/kfserving/models/v1alpha2_inference_service_list.py @@ -30,11 +30,11 @@ import six -from kfserving.models.v1alpha2_kf_service import V1alpha2KFService # noqa: F401,E501 +from kfserving.models.v1alpha2_inference_service import V1alpha2InferenceService # noqa: F401,E501 from kubernetes.client import V1ListMeta # noqa: F401,E501 -class V1alpha2KFServiceList(object): +class V1alpha2InferenceServiceList(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. @@ -49,7 +49,7 @@ class V1alpha2KFServiceList(object): """ swagger_types = { 'api_version': 'str', - 'items': 'list[V1alpha2KFService]', + 'items': 'list[V1alpha2InferenceService]', 'kind': 'str', 'metadata': 'V1ListMeta' } @@ -62,7 +62,7 @@ class V1alpha2KFServiceList(object): } def __init__(self, api_version=None, items=None, kind=None, metadata=None): # noqa: E501 - """V1alpha2KFServiceList - a model defined in Swagger""" # noqa: E501 + """V1alpha2InferenceServiceList - a model defined in Swagger""" # noqa: E501 self._api_version = None self._items = None @@ -80,22 +80,22 @@ def __init__(self, api_version=None, items=None, kind=None, metadata=None): # n @property def api_version(self): - """Gets the api_version of this V1alpha2KFServiceList. # noqa: E501 + """Gets the api_version of this V1alpha2InferenceServiceList. # noqa: E501 APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources # noqa: E501 - :return: The api_version of this V1alpha2KFServiceList. # noqa: E501 + :return: The api_version of this V1alpha2InferenceServiceList. # noqa: E501 :rtype: str """ return self._api_version @api_version.setter def api_version(self, api_version): - """Sets the api_version of this V1alpha2KFServiceList. + """Sets the api_version of this V1alpha2InferenceServiceList. APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources # noqa: E501 - :param api_version: The api_version of this V1alpha2KFServiceList. # noqa: E501 + :param api_version: The api_version of this V1alpha2InferenceServiceList. # noqa: E501 :type: str """ @@ -103,21 +103,21 @@ def api_version(self, api_version): @property def items(self): - """Gets the items of this V1alpha2KFServiceList. # noqa: E501 + """Gets the items of this V1alpha2InferenceServiceList. # noqa: E501 - :return: The items of this V1alpha2KFServiceList. # noqa: E501 - :rtype: list[V1alpha2KFService] + :return: The items of this V1alpha2InferenceServiceList. # noqa: E501 + :rtype: list[V1alpha2InferenceService] """ return self._items @items.setter def items(self, items): - """Sets the items of this V1alpha2KFServiceList. + """Sets the items of this V1alpha2InferenceServiceList. - :param items: The items of this V1alpha2KFServiceList. # noqa: E501 - :type: list[V1alpha2KFService] + :param items: The items of this V1alpha2InferenceServiceList. # noqa: E501 + :type: list[V1alpha2InferenceService] """ if items is None: raise ValueError("Invalid value for `items`, must not be `None`") # noqa: E501 @@ -126,22 +126,22 @@ def items(self, items): @property def kind(self): - """Gets the kind of this V1alpha2KFServiceList. # noqa: E501 + """Gets the kind of this V1alpha2InferenceServiceList. # noqa: E501 Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds # noqa: E501 - :return: The kind of this V1alpha2KFServiceList. # noqa: E501 + :return: The kind of this V1alpha2InferenceServiceList. # noqa: E501 :rtype: str """ return self._kind @kind.setter def kind(self, kind): - """Sets the kind of this V1alpha2KFServiceList. + """Sets the kind of this V1alpha2InferenceServiceList. Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds # noqa: E501 - :param kind: The kind of this V1alpha2KFServiceList. # noqa: E501 + :param kind: The kind of this V1alpha2InferenceServiceList. # noqa: E501 :type: str """ @@ -149,20 +149,20 @@ def kind(self, kind): @property def metadata(self): - """Gets the metadata of this V1alpha2KFServiceList. # noqa: E501 + """Gets the metadata of this V1alpha2InferenceServiceList. # noqa: E501 - :return: The metadata of this V1alpha2KFServiceList. # noqa: E501 + :return: The metadata of this V1alpha2InferenceServiceList. # noqa: E501 :rtype: V1ListMeta """ return self._metadata @metadata.setter def metadata(self, metadata): - """Sets the metadata of this V1alpha2KFServiceList. + """Sets the metadata of this V1alpha2InferenceServiceList. - :param metadata: The metadata of this V1alpha2KFServiceList. # noqa: E501 + :param metadata: The metadata of this V1alpha2InferenceServiceList. # noqa: E501 :type: V1ListMeta """ @@ -189,7 +189,7 @@ def to_dict(self): )) else: result[attr] = value - if issubclass(V1alpha2KFServiceList, dict): + if issubclass(V1alpha2InferenceServiceList, dict): for key, value in self.items(): result[key] = value @@ -205,7 +205,7 @@ def __repr__(self): def __eq__(self, other): """Returns true if both objects are equal""" - if not isinstance(other, V1alpha2KFServiceList): + if not isinstance(other, V1alpha2InferenceServiceList): return False return self.__dict__ == other.__dict__ diff --git a/python/kfserving/kfserving/models/v1alpha2_kf_service_spec.py b/python/kfserving/kfserving/models/v1alpha2_inference_service_spec.py similarity index 77% rename from python/kfserving/kfserving/models/v1alpha2_kf_service_spec.py rename to python/kfserving/kfserving/models/v1alpha2_inference_service_spec.py index db280a5ed2..7cd16c5c41 100644 --- a/python/kfserving/kfserving/models/v1alpha2_kf_service_spec.py +++ b/python/kfserving/kfserving/models/v1alpha2_inference_service_spec.py @@ -33,7 +33,7 @@ from kfserving.models.v1alpha2_endpoint_spec import V1alpha2EndpointSpec # noqa: F401,E501 -class V1alpha2KFServiceSpec(object): +class V1alpha2InferenceServiceSpec(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. @@ -59,7 +59,7 @@ class V1alpha2KFServiceSpec(object): } def __init__(self, canary=None, canary_traffic_percent=None, default=None): # noqa: E501 - """V1alpha2KFServiceSpec - a model defined in Swagger""" # noqa: E501 + """V1alpha2InferenceServiceSpec - a model defined in Swagger""" # noqa: E501 self._canary = None self._canary_traffic_percent = None @@ -74,22 +74,22 @@ def __init__(self, canary=None, canary_traffic_percent=None, default=None): # n @property def canary(self): - """Gets the canary of this V1alpha2KFServiceSpec. # noqa: E501 + """Gets the canary of this V1alpha2InferenceServiceSpec. # noqa: E501 Canary defines an alternate endpoints to route a percentage of traffic. # noqa: E501 - :return: The canary of this V1alpha2KFServiceSpec. # noqa: E501 + :return: The canary of this V1alpha2InferenceServiceSpec. # noqa: E501 :rtype: V1alpha2EndpointSpec """ return self._canary @canary.setter def canary(self, canary): - """Sets the canary of this V1alpha2KFServiceSpec. + """Sets the canary of this V1alpha2InferenceServiceSpec. Canary defines an alternate endpoints to route a percentage of traffic. # noqa: E501 - :param canary: The canary of this V1alpha2KFServiceSpec. # noqa: E501 + :param canary: The canary of this V1alpha2InferenceServiceSpec. # noqa: E501 :type: V1alpha2EndpointSpec """ @@ -97,22 +97,22 @@ def canary(self, canary): @property def canary_traffic_percent(self): - """Gets the canary_traffic_percent of this V1alpha2KFServiceSpec. # noqa: E501 + """Gets the canary_traffic_percent of this V1alpha2InferenceServiceSpec. # noqa: E501 - CanaryTrafficPercent defines the percentage of traffic going to canary KFService endpoints # noqa: E501 + CanaryTrafficPercent defines the percentage of traffic going to canary InferenceService endpoints # noqa: E501 - :return: The canary_traffic_percent of this V1alpha2KFServiceSpec. # noqa: E501 + :return: The canary_traffic_percent of this V1alpha2InferenceServiceSpec. # noqa: E501 :rtype: int """ return self._canary_traffic_percent @canary_traffic_percent.setter def canary_traffic_percent(self, canary_traffic_percent): - """Sets the canary_traffic_percent of this V1alpha2KFServiceSpec. + """Sets the canary_traffic_percent of this V1alpha2InferenceServiceSpec. - CanaryTrafficPercent defines the percentage of traffic going to canary KFService endpoints # noqa: E501 + CanaryTrafficPercent defines the percentage of traffic going to canary InferenceService endpoints # noqa: E501 - :param canary_traffic_percent: The canary_traffic_percent of this V1alpha2KFServiceSpec. # noqa: E501 + :param canary_traffic_percent: The canary_traffic_percent of this V1alpha2InferenceServiceSpec. # noqa: E501 :type: int """ @@ -120,22 +120,22 @@ def canary_traffic_percent(self, canary_traffic_percent): @property def default(self): - """Gets the default of this V1alpha2KFServiceSpec. # noqa: E501 + """Gets the default of this V1alpha2InferenceServiceSpec. # noqa: E501 - Default defines default KFService endpoints # noqa: E501 + Default defines default InferenceService endpoints # noqa: E501 - :return: The default of this V1alpha2KFServiceSpec. # noqa: E501 + :return: The default of this V1alpha2InferenceServiceSpec. # noqa: E501 :rtype: V1alpha2EndpointSpec """ return self._default @default.setter def default(self, default): - """Sets the default of this V1alpha2KFServiceSpec. + """Sets the default of this V1alpha2InferenceServiceSpec. - Default defines default KFService endpoints # noqa: E501 + Default defines default InferenceService endpoints # noqa: E501 - :param default: The default of this V1alpha2KFServiceSpec. # noqa: E501 + :param default: The default of this V1alpha2InferenceServiceSpec. # noqa: E501 :type: V1alpha2EndpointSpec """ if default is None: @@ -164,7 +164,7 @@ def to_dict(self): )) else: result[attr] = value - if issubclass(V1alpha2KFServiceSpec, dict): + if issubclass(V1alpha2InferenceServiceSpec, dict): for key, value in self.items(): result[key] = value @@ -180,7 +180,7 @@ def __repr__(self): def __eq__(self, other): """Returns true if both objects are equal""" - if not isinstance(other, V1alpha2KFServiceSpec): + if not isinstance(other, V1alpha2InferenceServiceSpec): return False return self.__dict__ == other.__dict__ diff --git a/python/kfserving/kfserving/models/v1alpha2_kf_service_status.py b/python/kfserving/kfserving/models/v1alpha2_inference_service_status.py similarity index 76% rename from python/kfserving/kfserving/models/v1alpha2_kf_service_status.py rename to python/kfserving/kfserving/models/v1alpha2_inference_service_status.py index 6dc5636f5b..9b52ff4cfa 100644 --- a/python/kfserving/kfserving/models/v1alpha2_kf_service_status.py +++ b/python/kfserving/kfserving/models/v1alpha2_inference_service_status.py @@ -34,7 +34,7 @@ from kfserving.models.v1alpha2_status_configuration_spec import V1alpha2StatusConfigurationSpec # noqa: F401,E501 -class V1alpha2KFServiceStatus(object): +class V1alpha2InferenceServiceStatus(object): """NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. @@ -64,7 +64,7 @@ class V1alpha2KFServiceStatus(object): } def __init__(self, canary=None, conditions=None, default=None, observed_generation=None, url=None): # noqa: E501 - """V1alpha2KFServiceStatus - a model defined in Swagger""" # noqa: E501 + """V1alpha2InferenceServiceStatus - a model defined in Swagger""" # noqa: E501 self._canary = None self._conditions = None @@ -86,20 +86,20 @@ def __init__(self, canary=None, conditions=None, default=None, observed_generati @property def canary(self): - """Gets the canary of this V1alpha2KFServiceStatus. # noqa: E501 + """Gets the canary of this V1alpha2InferenceServiceStatus. # noqa: E501 - :return: The canary of this V1alpha2KFServiceStatus. # noqa: E501 + :return: The canary of this V1alpha2InferenceServiceStatus. # noqa: E501 :rtype: V1alpha2StatusConfigurationSpec """ return self._canary @canary.setter def canary(self, canary): - """Sets the canary of this V1alpha2KFServiceStatus. + """Sets the canary of this V1alpha2InferenceServiceStatus. - :param canary: The canary of this V1alpha2KFServiceStatus. # noqa: E501 + :param canary: The canary of this V1alpha2InferenceServiceStatus. # noqa: E501 :type: V1alpha2StatusConfigurationSpec """ @@ -107,22 +107,22 @@ def canary(self, canary): @property def conditions(self): - """Gets the conditions of this V1alpha2KFServiceStatus. # noqa: E501 + """Gets the conditions of this V1alpha2InferenceServiceStatus. # noqa: E501 Conditions the latest available observations of a resource's current state. # noqa: E501 - :return: The conditions of this V1alpha2KFServiceStatus. # noqa: E501 + :return: The conditions of this V1alpha2InferenceServiceStatus. # noqa: E501 :rtype: list[KnativeCondition] """ return self._conditions @conditions.setter def conditions(self, conditions): - """Sets the conditions of this V1alpha2KFServiceStatus. + """Sets the conditions of this V1alpha2InferenceServiceStatus. Conditions the latest available observations of a resource's current state. # noqa: E501 - :param conditions: The conditions of this V1alpha2KFServiceStatus. # noqa: E501 + :param conditions: The conditions of this V1alpha2InferenceServiceStatus. # noqa: E501 :type: list[KnativeCondition] """ @@ -130,20 +130,20 @@ def conditions(self, conditions): @property def default(self): - """Gets the default of this V1alpha2KFServiceStatus. # noqa: E501 + """Gets the default of this V1alpha2InferenceServiceStatus. # noqa: E501 - :return: The default of this V1alpha2KFServiceStatus. # noqa: E501 + :return: The default of this V1alpha2InferenceServiceStatus. # noqa: E501 :rtype: V1alpha2StatusConfigurationSpec """ return self._default @default.setter def default(self, default): - """Sets the default of this V1alpha2KFServiceStatus. + """Sets the default of this V1alpha2InferenceServiceStatus. - :param default: The default of this V1alpha2KFServiceStatus. # noqa: E501 + :param default: The default of this V1alpha2InferenceServiceStatus. # noqa: E501 :type: V1alpha2StatusConfigurationSpec """ @@ -151,22 +151,22 @@ def default(self, default): @property def observed_generation(self): - """Gets the observed_generation of this V1alpha2KFServiceStatus. # noqa: E501 + """Gets the observed_generation of this V1alpha2InferenceServiceStatus. # noqa: E501 ObservedGeneration is the 'Generation' of the Service that was last processed by the controller. # noqa: E501 - :return: The observed_generation of this V1alpha2KFServiceStatus. # noqa: E501 + :return: The observed_generation of this V1alpha2InferenceServiceStatus. # noqa: E501 :rtype: int """ return self._observed_generation @observed_generation.setter def observed_generation(self, observed_generation): - """Sets the observed_generation of this V1alpha2KFServiceStatus. + """Sets the observed_generation of this V1alpha2InferenceServiceStatus. ObservedGeneration is the 'Generation' of the Service that was last processed by the controller. # noqa: E501 - :param observed_generation: The observed_generation of this V1alpha2KFServiceStatus. # noqa: E501 + :param observed_generation: The observed_generation of this V1alpha2InferenceServiceStatus. # noqa: E501 :type: int """ @@ -174,20 +174,20 @@ def observed_generation(self, observed_generation): @property def url(self): - """Gets the url of this V1alpha2KFServiceStatus. # noqa: E501 + """Gets the url of this V1alpha2InferenceServiceStatus. # noqa: E501 - :return: The url of this V1alpha2KFServiceStatus. # noqa: E501 + :return: The url of this V1alpha2InferenceServiceStatus. # noqa: E501 :rtype: str """ return self._url @url.setter def url(self, url): - """Sets the url of this V1alpha2KFServiceStatus. + """Sets the url of this V1alpha2InferenceServiceStatus. - :param url: The url of this V1alpha2KFServiceStatus. # noqa: E501 + :param url: The url of this V1alpha2InferenceServiceStatus. # noqa: E501 :type: str """ @@ -214,7 +214,7 @@ def to_dict(self): )) else: result[attr] = value - if issubclass(V1alpha2KFServiceStatus, dict): + if issubclass(V1alpha2InferenceServiceStatus, dict): for key, value in self.items(): result[key] = value @@ -230,7 +230,7 @@ def __repr__(self): def __eq__(self, other): """Returns true if both objects are equal""" - if not isinstance(other, V1alpha2KFServiceStatus): + if not isinstance(other, V1alpha2InferenceServiceStatus): return False return self.__dict__ == other.__dict__ diff --git a/python/kfserving/kfserving/utils/utils.py b/python/kfserving/kfserving/utils/utils.py index 95b11a102a..9eafbfc578 100644 --- a/python/kfserving/kfserving/utils/utils.py +++ b/python/kfserving/kfserving/utils/utils.py @@ -29,7 +29,7 @@ def get_default_target_namespace(): return get_current_k8s_namespace() -def set_kfsvc_namespace(kfservice): - kfsvc_namespace = kfservice.metadata.namespace - namespace = kfsvc_namespace or get_default_target_namespace() +def set_isvc_namespace(inferenceservice): + isvc_namespace = inferenceservice.metadata.namespace + namespace = isvc_namespace or get_default_target_namespace() return namespace diff --git a/python/kfserving/test/test_kfservice_client.py b/python/kfserving/test/test_inference_service_client.py similarity index 65% rename from python/kfserving/test/test_kfservice_client.py rename to python/kfserving/test/test_inference_service_client.py index 8560669c06..f668ea9e2c 100644 --- a/python/kfserving/test/test_kfservice_client.py +++ b/python/kfserving/test/test_inference_service_client.py @@ -19,17 +19,17 @@ from kfserving import V1alpha2EndpointSpec from kfserving import V1alpha2PredictorSpec from kfserving import V1alpha2TensorflowSpec -from kfserving import V1alpha2KFServiceSpec -from kfserving import V1alpha2KFService +from kfserving import V1alpha2InferenceServiceSpec +from kfserving import V1alpha2InferenceService from kfserving import KFServingClient KFServing = KFServingClient() mocked_unit_result = \ -''' + ''' { "api_version": "serving.kubeflow.org/v1alpha2", - "kind": "KFService", + "kind": "InferenceService", "metadata": { "name": "flower-sample", "namespace": "kubeflow" @@ -47,35 +47,38 @@ ''' -def generate_kfservice(): +def generate_inferenceservice(): tf_spec = V1alpha2TensorflowSpec( storage_uri='gs://kfserving-samples/models/tensorflow/flowers') default_endpoint_spec = V1alpha2EndpointSpec(predictor=V1alpha2PredictorSpec( tensorflow=tf_spec)) - kfsvc = V1alpha2KFService(api_version='serving.kubeflow.org/v1alpha2', - kind='KFService', - metadata=client.V1ObjectMeta(name='flower-sample'), - spec=V1alpha2KFServiceSpec(default=default_endpoint_spec)) - return kfsvc + isvc = V1alpha2InferenceService( + api_version='serving.kubeflow.org/v1alpha2', + kind='InferenceService', + metadata=client.V1ObjectMeta(name='flower-sample'), + spec=V1alpha2InferenceServiceSpec(default=default_endpoint_spec)) + return isvc -def test_kfservice_client_creat(): +def test_inferenceservice_client_creat(): '''Unit test for kfserving create api''' with patch('kfserving.api.kf_serving_client.KFServingClient.create', return_value=mocked_unit_result): - kfsvc = generate_kfservice() - assert mocked_unit_result == KFServing.create(kfsvc, namespace='kubeflow') + isvc = generate_inferenceservice() + assert mocked_unit_result == KFServing.create( + isvc, namespace='kubeflow') -def test_kfservice_client_get(): +def test_inferenceservice_client_get(): '''Unit test for kfserving get api''' with patch('kfserving.api.kf_serving_client.KFServingClient.get', return_value=mocked_unit_result): - assert mocked_unit_result == KFServing.get('flower-sample', namespace='kubeflow') + assert mocked_unit_result == KFServing.get( + 'flower-sample', namespace='kubeflow') -def test_kfservice_client_watch(): +def test_inferenceservice_client_watch(): '''Unit test for kfserving get api''' with patch('kfserving.api.kf_serving_client.KFServingClient.get', return_value=mocked_unit_result): @@ -83,28 +86,35 @@ def test_kfservice_client_watch(): watch=True, timeout_seconds=120) -def test_kfservice_client_patch(): +def test_inferenceservice_client_patch(): '''Unit test for kfserving patch api''' with patch('kfserving.api.kf_serving_client.KFServingClient.patch', return_value=mocked_unit_result): - kfsvc = generate_kfservice() - assert mocked_unit_result == KFServing.patch('flower-sample', kfsvc, namespace='kubeflow') + isvc = generate_inferenceservice() + assert mocked_unit_result == KFServing.patch( + 'flower-sample', isvc, namespace='kubeflow') -def test_kfservice_client_promote(): + +def test_inferenceservice_client_promote(): '''Unit test for kfserving promote api''' with patch('kfserving.api.kf_serving_client.KFServingClient.promote', return_value=mocked_unit_result): - assert mocked_unit_result == KFServing.promote('flower-sample', namespace='kubeflow') + assert mocked_unit_result == KFServing.promote( + 'flower-sample', namespace='kubeflow') + -def test_kfservice_client_replace(): +def test_inferenceservice_client_replace(): '''Unit test for kfserving replace api''' with patch('kfserving.api.kf_serving_client.KFServingClient.replace', return_value=mocked_unit_result): - kfsvc = generate_kfservice() - assert mocked_unit_result == KFServing.replace('flower-sample', kfsvc, namespace='kubeflow') + isvc = generate_inferenceservice() + assert mocked_unit_result == KFServing.replace( + 'flower-sample', isvc, namespace='kubeflow') + -def test_kfservice_client_delete(): +def test_inferenceservice_client_delete(): '''Unit test for kfserving delete api''' with patch('kfserving.api.kf_serving_client.KFServingClient.delete', return_value=mocked_unit_result): - assert mocked_unit_result == KFServing.delete('flower-sample', namespace='kubeflow') + assert mocked_unit_result == KFServing.delete( + 'flower-sample', namespace='kubeflow') diff --git a/python/kfserving/test/test_v1alpha2_kf_service.py b/python/kfserving/test/test_v1alpha2_inference_service.py similarity index 73% rename from python/kfserving/test/test_v1alpha2_kf_service.py rename to python/kfserving/test/test_v1alpha2_inference_service.py index b16337ae40..80059997be 100644 --- a/python/kfserving/test/test_v1alpha2_kf_service.py +++ b/python/kfserving/test/test_v1alpha2_inference_service.py @@ -30,12 +30,12 @@ import unittest import kfserving -from kfserving.models.v1alpha2_kf_service import V1alpha2KFService # noqa: E501 +from kfserving.models.v1alpha2_inference_service import V1alpha2InferenceService # noqa: E501 from kfserving.rest import ApiException -class TestV1alpha2KFService(unittest.TestCase): - """V1alpha2KFService unit test stubs""" +class TestV1alpha2InferenceService(unittest.TestCase): + """V1alpha2InferenceService unit test stubs""" def setUp(self): pass @@ -43,10 +43,10 @@ def setUp(self): def tearDown(self): pass - def testV1alpha2KFService(self): - """Test V1alpha2KFService""" + def testV1alpha2InferenceService(self): + """Test V1alpha2InferenceService""" # FIXME: construct object with mandatory attributes with example values - # model = kfserving.models.v1alpha2_kf_service.V1alpha2KFService() # noqa: E501 + # model = kfserving.models.v1alpha2_inference_service.V1alpha2InferenceService() # noqa: E501 pass diff --git a/python/kfserving/test/test_v1alpha2_kf_service_list.py b/python/kfserving/test/test_v1alpha2_inference_service_list.py similarity index 72% rename from python/kfserving/test/test_v1alpha2_kf_service_list.py rename to python/kfserving/test/test_v1alpha2_inference_service_list.py index a79b111585..a31b7f6188 100644 --- a/python/kfserving/test/test_v1alpha2_kf_service_list.py +++ b/python/kfserving/test/test_v1alpha2_inference_service_list.py @@ -30,12 +30,12 @@ import unittest import kfserving -from kfserving.models.v1alpha2_kf_service_list import V1alpha2KFServiceList # noqa: E501 +from kfserving.models.v1alpha2_inference_service_list import V1alpha2InferenceServiceList # noqa: E501 from kfserving.rest import ApiException -class TestV1alpha2KFServiceList(unittest.TestCase): - """V1alpha2KFServiceList unit test stubs""" +class TestV1alpha2InferenceServiceList(unittest.TestCase): + """V1alpha2InferenceServiceList unit test stubs""" def setUp(self): pass @@ -43,10 +43,10 @@ def setUp(self): def tearDown(self): pass - def testV1alpha2KFServiceList(self): - """Test V1alpha2KFServiceList""" + def testV1alpha2InferenceServiceList(self): + """Test V1alpha2InferenceServiceList""" # FIXME: construct object with mandatory attributes with example values - # model = kfserving.models.v1alpha2_kf_service_list.V1alpha2KFServiceList() # noqa: E501 + # model = kfserving.models.v1alpha2_inference_service_list.V1alpha2InferenceServiceList() # noqa: E501 pass diff --git a/python/kfserving/test/test_v1alpha2_kf_service_status.py b/python/kfserving/test/test_v1alpha2_inference_service_spec.py similarity index 72% rename from python/kfserving/test/test_v1alpha2_kf_service_status.py rename to python/kfserving/test/test_v1alpha2_inference_service_spec.py index f0fe49a0d8..b5cedeeb6a 100644 --- a/python/kfserving/test/test_v1alpha2_kf_service_status.py +++ b/python/kfserving/test/test_v1alpha2_inference_service_spec.py @@ -30,12 +30,12 @@ import unittest import kfserving -from kfserving.models.v1alpha2_kf_service_status import V1alpha2KFServiceStatus # noqa: E501 +from kfserving.models.v1alpha2_inference_service_spec import V1alpha2InferenceServiceSpec # noqa: E501 from kfserving.rest import ApiException -class TestV1alpha2KFServiceStatus(unittest.TestCase): - """V1alpha2KFServiceStatus unit test stubs""" +class TestV1alpha2InferenceServiceSpec(unittest.TestCase): + """V1alpha2InferenceServiceSpec unit test stubs""" def setUp(self): pass @@ -43,10 +43,10 @@ def setUp(self): def tearDown(self): pass - def testV1alpha2KFServiceStatus(self): - """Test V1alpha2KFServiceStatus""" + def testV1alpha2InferenceServiceSpec(self): + """Test V1alpha2InferenceServiceSpec""" # FIXME: construct object with mandatory attributes with example values - # model = kfserving.models.v1alpha2_kf_service_status.V1alpha2KFServiceStatus() # noqa: E501 + # model = kfserving.models.v1alpha2_inference_service_spec.V1alpha2InferenceServiceSpec() # noqa: E501 pass diff --git a/python/kfserving/test/test_v1alpha2_kf_service_spec.py b/python/kfserving/test/test_v1alpha2_inference_service_status.py similarity index 71% rename from python/kfserving/test/test_v1alpha2_kf_service_spec.py rename to python/kfserving/test/test_v1alpha2_inference_service_status.py index 430ebbaf86..1ed7e4a8ef 100644 --- a/python/kfserving/test/test_v1alpha2_kf_service_spec.py +++ b/python/kfserving/test/test_v1alpha2_inference_service_status.py @@ -30,12 +30,12 @@ import unittest import kfserving -from kfserving.models.v1alpha2_kf_service_spec import V1alpha2KFServiceSpec # noqa: E501 +from kfserving.models.v1alpha2_inference_service_status import V1alpha2InferenceServiceStatus # noqa: E501 from kfserving.rest import ApiException -class TestV1alpha2KFServiceSpec(unittest.TestCase): - """V1alpha2KFServiceSpec unit test stubs""" +class TestV1alpha2InferenceServiceStatus(unittest.TestCase): + """V1alpha2InferenceServiceStatus unit test stubs""" def setUp(self): pass @@ -43,10 +43,10 @@ def setUp(self): def tearDown(self): pass - def testV1alpha2KFServiceSpec(self): - """Test V1alpha2KFServiceSpec""" + def testV1alpha2InferenceServiceStatus(self): + """Test V1alpha2InferenceServiceStatus""" # FIXME: construct object with mandatory attributes with example values - # model = kfserving.models.v1alpha2_kf_service_spec.V1alpha2KFServiceSpec() # noqa: E501 + # model = kfserving.models.v1alpha2_inference_service_status.V1alpha2InferenceServiceStatus() # noqa: E501 pass diff --git a/python/pytorchserver/README.md b/python/pytorchserver/README.md index 89e6a4b628..9c5ec45c40 100644 --- a/python/pytorchserver/README.md +++ b/python/pytorchserver/README.md @@ -111,7 +111,7 @@ An empty result will indicate success. ## Building your own PyTorch server Docker Image -You can build and publish your own image for development needs. Please ensure that you modify the kfservice files for PyTorch in the api directory to point to your own image. +You can build and publish your own image for development needs. Please ensure that you modify the inferenceservice files for PyTorch in the api directory to point to your own image. To build your own image, navigate up one directory level to the `python` directory and run: diff --git a/python/sklearnserver/README.md b/python/sklearnserver/README.md index 3455478e7e..aba44baf93 100644 --- a/python/sklearnserver/README.md +++ b/python/sklearnserver/README.md @@ -107,7 +107,7 @@ An empty result will indicate success. ## Building your own Scikit-Learn Server Docker Image -You can build and publish your own image for development needs. Please ensure that you modify the kfservice files for Scikit-Learn in the api directory to point to your own image. +You can build and publish your own image for development needs. Please ensure that you modify the inferenceservice files for Scikit-Learn in the api directory to point to your own image. To build your own image, navigate up one directory level to the `python` directory and run: diff --git a/python/xgbserver/README.md b/python/xgbserver/README.md index 57f197aa69..e1ef57f31a 100644 --- a/python/xgbserver/README.md +++ b/python/xgbserver/README.md @@ -110,7 +110,7 @@ An empty result will indicate success. ## Building your own XGBoost Server Docker Image -You can build and publish your own image for development needs. Please ensure that you modify the kfservice files for XGBoost in the api directory to point to your own image. +You can build and publish your own image for development needs. Please ensure that you modify the inferenceservice files for XGBoost in the api directory to point to your own image. To build your own image, navigate up one directory level to the `python` directory and run: