Skip to content

Commit

Permalink
feat: Support customizable deployment strategy for RawDeployment mode.
Browse files Browse the repository at this point in the history
…Fixes kserve#3452 (kserve#3603)

* feat: Support customizable deployment strategy for RawDeployment mode

Signed-off-by: Yuan Tang <[email protected]>

* regen

Signed-off-by: Yuan Tang <[email protected]>

* lint

Signed-off-by: Yuan Tang <[email protected]>

* Correctly apply rollingupdate

Signed-off-by: Yuan Tang <[email protected]>

* address comments

Signed-off-by: Yuan Tang <[email protected]>

* Add validation

Signed-off-by: Yuan Tang <[email protected]>

---------

Signed-off-by: Yuan Tang <[email protected]>
Signed-off-by: asd981256 <[email protected]>
  • Loading branch information
terrytangyuan authored and asd981256 committed May 14, 2024
1 parent 4437792 commit 2a22f5a
Show file tree
Hide file tree
Showing 31 changed files with 1,126 additions and 303 deletions.
54 changes: 54 additions & 0 deletions config/crd/full/serving.kserve.io_inferenceservices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1688,6 +1688,24 @@ spec:
- name
type: object
type: array
deploymentStrategy:
properties:
rollingUpdate:
properties:
maxSurge:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
maxUnavailable:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
type: object
type:
type: string
type: object
dnsConfig:
properties:
nameservers:
Expand Down Expand Up @@ -4333,6 +4351,24 @@ spec:
- name
type: object
type: array
deploymentStrategy:
properties:
rollingUpdate:
properties:
maxSurge:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
maxUnavailable:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
type: object
type:
type: string
type: object
dnsConfig:
properties:
nameservers:
Expand Down Expand Up @@ -13886,6 +13922,24 @@ spec:
- name
type: object
type: array
deploymentStrategy:
properties:
rollingUpdate:
properties:
maxSurge:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
maxUnavailable:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
type: object
type:
type: string
type: object
dnsConfig:
properties:
nameservers:
Expand Down
62 changes: 36 additions & 26 deletions docs/samples/client/kfserving_sdk_v1beta1_sample.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"metadata": {},
"outputs": [],
"source": [
"from kubernetes import client \n",
"from kubernetes import client\n",
"from kfserving import KFServingClient\n",
"from kfserving import constants\n",
"from kfserving import utils\n",
Expand All @@ -45,8 +45,8 @@
"metadata": {},
"outputs": [],
"source": [
"#namespace = utils.get_default_target_namespace()\n",
"namespace = 'kfserving-test'"
"# namespace = utils.get_default_target_namespace()\n",
"namespace = \"kfserving-test\""
]
},
{
Expand All @@ -69,16 +69,21 @@
"metadata": {},
"outputs": [],
"source": [
"api_version = constants.KFSERVING_GROUP + '/' + kfserving_version\n",
"api_version = constants.KFSERVING_GROUP + \"/\" + kfserving_version\n",
"\n",
"isvc = V1beta1InferenceService(api_version=api_version,\n",
" kind=constants.KFSERVING_KIND,\n",
" metadata=client.V1ObjectMeta(\n",
" name='flower-sample', namespace=namespace),\n",
" spec=V1beta1InferenceServiceSpec(\n",
" predictor=V1beta1PredictorSpec(\n",
" tensorflow=(V1beta1TFServingSpec(\n",
" storage_uri='gs://kfserving-examples/models/tensorflow/flowers'))))\n",
"isvc = V1beta1InferenceService(\n",
" api_version=api_version,\n",
" kind=constants.KFSERVING_KIND,\n",
" metadata=client.V1ObjectMeta(name=\"flower-sample\", namespace=namespace),\n",
" spec=V1beta1InferenceServiceSpec(\n",
" predictor=V1beta1PredictorSpec(\n",
" tensorflow=(\n",
" V1beta1TFServingSpec(\n",
" storage_uri=\"gs://kfserving-examples/models/tensorflow/flowers\"\n",
" )\n",
" )\n",
" )\n",
" ),\n",
")"
]
},
Expand Down Expand Up @@ -152,7 +157,7 @@
}
],
"source": [
"KFServing.get('flower-sample', namespace=namespace, watch=True, timeout_seconds=120)"
"KFServing.get(\"flower-sample\", namespace=namespace, watch=True, timeout_seconds=120)"
]
},
{
Expand Down Expand Up @@ -223,18 +228,23 @@
}
],
"source": [
"isvc = V1beta1InferenceService(api_version=api_version,\n",
" kind=constants.KFSERVING_KIND,\n",
" metadata=client.V1ObjectMeta(\n",
" name='flower-sample', namespace=namespace),\n",
" spec=V1beta1InferenceServiceSpec(\n",
" predictor=V1beta1PredictorSpec(\n",
" canary_traffic_percent=20,\n",
" tensorflow=(V1beta1TFServingSpec(\n",
" storage_uri='gs://kfserving-examples/models/tensorflow/flowers-2'))))\n",
"isvc = V1beta1InferenceService(\n",
" api_version=api_version,\n",
" kind=constants.KFSERVING_KIND,\n",
" metadata=client.V1ObjectMeta(name=\"flower-sample\", namespace=namespace),\n",
" spec=V1beta1InferenceServiceSpec(\n",
" predictor=V1beta1PredictorSpec(\n",
" canary_traffic_percent=20,\n",
" tensorflow=(\n",
" V1beta1TFServingSpec(\n",
" storage_uri=\"gs://kfserving-examples/models/tensorflow/flowers-2\"\n",
" )\n",
" ),\n",
" )\n",
" ),\n",
")\n",
"\n",
"KFServing.patch('flower-sample', isvc, namespace=namespace)"
"KFServing.patch(\"flower-sample\", isvc, namespace=namespace)"
]
},
{
Expand All @@ -250,7 +260,7 @@
"metadata": {},
"outputs": [],
"source": [
"KFServing.wait_isvc_ready('flower-sample', namespace=namespace)"
"KFServing.wait_isvc_ready(\"flower-sample\", namespace=namespace)"
]
},
{
Expand All @@ -268,7 +278,7 @@
}
],
"source": [
"KFServing.get('flower-sample', namespace=namespace, watch=True)"
"KFServing.get(\"flower-sample\", namespace=namespace, watch=True)"
]
},
{
Expand Down Expand Up @@ -313,7 +323,7 @@
}
],
"source": [
"KFServing.delete('flower-sample', namespace=namespace)"
"KFServing.delete(\"flower-sample\", namespace=namespace)"
]
},
{
Expand Down

0 comments on commit 2a22f5a

Please sign in to comment.