This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 211
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add KServe manifests to odh-manifests
- Loading branch information
Showing
81 changed files
with
22,099 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
approvers: | ||
- anishasthana | ||
- danielezonca | ||
- heyselbi | ||
- israel-hdez | ||
- Jooho | ||
- VedantMahabaleshwarkar | ||
- Xaenalt | ||
|
||
reviewers: | ||
- anishasthana | ||
- danielezonca | ||
- heyselbi | ||
- israel-hdez | ||
- Jooho | ||
- VedantMahabaleshwarkar | ||
- Xaenalt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
# KServe | ||
|
||
KServe comes with two component: | ||
|
||
1. [KServe](#KServe) | ||
2. [KServe runtimes](#KServe-Runtimes) | ||
|
||
## KServe | ||
|
||
Contains deployment manifests for the KServe controller. | ||
|
||
- [kserve-controller](https://github.com/opendatahub-io/kserve) | ||
- Forked upstream kserve/kserve repository | ||
|
||
## KServe runtimes | ||
|
||
Contains the runtime manifests for KServe. | ||
|
||
- [kserve-controller](https://github.com/opendatahub-io/kserve) | ||
- Forked upstream kserve/kserve repository | ||
|
||
## Original manifests | ||
|
||
KServe also uses `kustomize` so we can directly use [their manifests](https://github.com/kserve/kserve/tree/master/config). | ||
|
||
* `default` is the entrypoint for CRDs, KServe controller and RBAC resources. | ||
* `runtimes` is the second entrypoint for the KServe runtimes. They are referenced separately, as these are not namespaced. | ||
|
||
### Updating the KServe manifests | ||
|
||
Use the script in `hack` to update the KServe manifests: | ||
|
||
```bash | ||
./hack/update-kserve-manifests.sh | ||
``` | ||
|
||
## Overlays | ||
|
||
There are two overlays defined with the necessary changes for ODH: | ||
|
||
* [controller](./odh-overlays/controller) | ||
* [runtimes](./odh-overlays/runtimes) | ||
|
||
|
||
### Installation process | ||
|
||
Following are the steps to install Model Mesh as a part of OpenDataHub install: | ||
|
||
1. Install the OpenDataHub operator | ||
2. Make sure you install Service Mesh and Serverless components and configure them appropriately | ||
3. Create a KfDef that includes the KServe components and runtimes | ||
|
||
``` | ||
apiVersion: kfdef.apps.kubeflow.org/v1 | ||
kind: KfDef | ||
metadata: | ||
name: opendatahub | ||
namespace: opendatahub | ||
spec: | ||
applications: | ||
- kustomizeConfig: | ||
repoRef: | ||
name: manifests | ||
path: odh-common | ||
name: odh-common | ||
- kustomizeConfig: | ||
repoRef: | ||
name: manifests | ||
path: kserve | ||
name: kserve | ||
repos: | ||
- name: manifests | ||
uri: https://api.github.com/repos/opendatahub-io/odh-manifests/tarball/master | ||
version: master | ||
``` | ||
|
||
4. You can now create a new project and create an `InferenceService` CR. | ||
|
||
## Using KServe in ODH | ||
|
||
You can use the `InferenceService` examples from KServe. Make sure to include the additional annotation for OpenShift Service Mesh: | ||
|
||
```yaml | ||
metadata: | ||
annotations: | ||
sidecar.istio.io/inject: "true" | ||
sidecar.istio.io/rewriteAppHTTPProbers: "true" | ||
serving.knative.openshift.io/enablePassthrough: "true" | ||
``` | ||
Example: | ||
```yaml | ||
apiVersion: "serving.kserve.io/v1beta1" | ||
kind: "InferenceService" | ||
metadata: | ||
name: "sklearn-iris" | ||
namespace: kserve-demo | ||
annotations: | ||
sidecar.istio.io/inject: "true" | ||
sidecar.istio.io/rewriteAppHTTPProbers: "true" | ||
serving.knative.openshift.io/enablePassthrough: "true" | ||
spec: | ||
predictor: | ||
model: | ||
modelFormat: | ||
name: sklearn | ||
storageUri: "gs://kfserving-examples/models/sklearn/1.0/model" | ||
``` | ||
## Limitations | ||
Currently, the target namespace service account must be allowed to run as `anyuid`, so allow this using: | ||
|
||
```bash | ||
oc adm policy add-scc-to-user anyuid -z default -n <your-namespace> | ||
``` | ||
|
||
**Reason** | ||
* for istio: allow to run as user 1337 because of https://istio.io/latest/docs/setup/additional-setup/cni/#compatibility-with-application-init-containers | ||
* for the python images of KServe: allow to run as user 1000 because of: https://github.com/kserve/kserve/blob/master/python/aiffairness.Dockerfile#L46 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ../../odh-overlays/controller | ||
|
||
namespace: opendatahub | ||
|
||
configMapGenerator: | ||
- envs: | ||
- params.env | ||
name: kserve-parameters | ||
|
||
generatorOptions: | ||
disableNameSuffixHash: true | ||
|
||
vars: | ||
- fieldref: | ||
fieldpath: data.kserve-controller | ||
name: kserve-controller | ||
objref: | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
name: kserve-parameters | ||
- fieldref: | ||
fieldpath: data.kserve-alibi-explainer | ||
name: kserve-alibi-explainer | ||
objref: | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
name: kserve-parameters | ||
- fieldref: | ||
fieldpath: data.kserve-art-explainer | ||
name: kserve-art-explainer | ||
objref: | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
name: kserve-parameters | ||
- fieldref: | ||
fieldpath: data.kserve-explainer-version | ||
name: kserve-explainer-version | ||
objref: | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
name: kserve-parameters | ||
- fieldref: | ||
fieldpath: data.kserve-storage-initializer | ||
name: kserve-storage-initializer | ||
objref: | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
name: kserve-parameters | ||
- fieldref: | ||
fieldpath: data.kserve-agent | ||
name: kserve-agent | ||
objref: | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
name: kserve-parameters | ||
- fieldref: | ||
fieldpath: data.kserve-router | ||
name: kserve-router | ||
objref: | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
name: kserve-parameters | ||
|
||
labels: | ||
- includeSelectors: true | ||
pairs: | ||
app.kubernetes.io/part-of: kserve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
kserve-controller=quay.io/opendatahub/kserve-controller:v0.10.1 | ||
kserve-explainer-version=v0.10.1 | ||
kserve-alibi-explainer=quay.io/opendatahub/kserve-alibiexplainer | ||
kserve-art-explainer=quay.io/opendatahub/kserve-art-explainer:v0.10.1 | ||
kserve-agent=quay.io/opendatahub/kserve-agent:v0.10.1 | ||
kserve-router=quay.io/opendatahub/kserve-router:v0.10.1 | ||
kserve-storage-initializer=quay.io/opendatahub/storage-initializer:v0.10.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- ../../odh-overlays/runtimes | ||
|
||
labels: | ||
- includeSelectors: true | ||
pairs: | ||
app.kubernetes.io/part-of: kserve |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env bash | ||
|
||
echo "Updating KServe manifests" | ||
script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
kserve_dir="$script_dir/../kserve" | ||
tmp_dir="$(mktemp -d)" | ||
|
||
git init "$tmp_dir" | ||
cd "$tmp_dir" || exit | ||
git remote add -f origin https://github.com/kserve/kserve.git | ||
git config core.sparseCheckout true | ||
echo "config" >> .git/info/sparse-checkout | ||
git pull origin master | ||
|
||
rm -rf "$kserve_dir" | ||
mkdir "$kserve_dir" | ||
|
||
mv ./config/* "$kserve_dir" | ||
|
||
echo "KServe manifests fetched from upstream" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# The following manifests contain a self-signed issuer CR and a certificate CR. | ||
# More document can be found at https://docs.cert-manager.io | ||
apiVersion: cert-manager.io/v1 | ||
kind: Issuer | ||
metadata: | ||
name: selfsigned-issuer | ||
namespace: kserve | ||
spec: | ||
selfSigned: {} | ||
--- | ||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: serving-cert # this name should match the one appeared in kustomizeconfig.yaml | ||
namespace: kserve | ||
spec: | ||
# $(SERVICE_NAME) and $(SERVICE_NAMESPACE) will be substituted by kustomize | ||
commonName: $(webhookServiceName).$(kserveNamespace).svc | ||
dnsNames: | ||
- $(webhookServiceName).$(kserveNamespace).svc | ||
issuerRef: | ||
kind: Issuer | ||
name: selfsigned-issuer | ||
secretName: kserve-webhook-server-cert # this secret will not be prefixed, since it's not managed by kustomize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
resources: | ||
- certificate.yaml | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: inferenceservice-config | ||
namespace: kserve | ||
data: | ||
explainers: |- | ||
{ | ||
"alibi": { | ||
"image" : "kserve/alibi-explainer", | ||
"defaultImageVersion": "latest" | ||
}, | ||
"art": { | ||
"image" : "kserve/art-explainer", | ||
"defaultImageVersion": "latest" | ||
} | ||
} | ||
storageInitializer: |- | ||
{ | ||
"image" : "kserve/storage-initializer:latest", | ||
"memoryRequest": "100Mi", | ||
"memoryLimit": "1Gi", | ||
"cpuRequest": "100m", | ||
"cpuLimit": "1", | ||
"storageSpecSecretName": "storage-config", | ||
"enableDirectPvcVolumeMount": false | ||
} | ||
# ====================================== CREDENTIALS ====================================== | ||
# For a quick reference about AWS ENV variables: | ||
# AWS Cli: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-envvars.html | ||
# Boto: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html#using-environment-variables | ||
# | ||
# The `s3AccessKeyIDName` and `s3SecretAccessKeyName` fields are only used from this configmap when static credentials (IAM User Access Key Secret) | ||
# are used as the authentication method for AWS S3. | ||
# The rest of the fields are used in both authentication methods (IAM Role for Service Account & IAM User Access Key Secret) if a non-empty value is provided. | ||
credentials: |- | ||
{ | ||
"gcs": { | ||
"gcsCredentialFileName": "gcloud-application-credentials.json" | ||
}, | ||
"s3": { | ||
"s3AccessKeyIDName": "AWS_ACCESS_KEY_ID", | ||
"s3SecretAccessKeyName": "AWS_SECRET_ACCESS_KEY", | ||
"s3Endpoint": "", | ||
"s3UseHttps": "", | ||
"s3Region": "", | ||
"s3VerifySSL": "", | ||
"s3UseVirtualBucket": "", | ||
"s3UseAnonymousCredential": "", | ||
"s3CABundle": "" | ||
} | ||
} | ||
ingress: |- | ||
{ | ||
"ingressGateway" : "knative-serving/knative-ingress-gateway", | ||
"ingressService" : "istio-ingressgateway.istio-system.svc.cluster.local", | ||
"localGateway" : "knative-serving/knative-local-gateway", | ||
"localGatewayService" : "knative-local-gateway.istio-system.svc.cluster.local", | ||
"ingressDomain" : "example.com", | ||
"ingressClassName" : "istio", | ||
"domainTemplate": "{{ .Name }}-{{ .Namespace }}.{{ .IngressDomain }}", | ||
"urlScheme": "http", | ||
"disableIstioVirtualHost": false | ||
} | ||
logger: |- | ||
{ | ||
"image" : "kserve/agent:latest", | ||
"memoryRequest": "100Mi", | ||
"memoryLimit": "1Gi", | ||
"cpuRequest": "100m", | ||
"cpuLimit": "1", | ||
"defaultUrl": "http://default-broker" | ||
} | ||
batcher: |- | ||
{ | ||
"image" : "kserve/agent:latest", | ||
"memoryRequest": "1Gi", | ||
"memoryLimit": "1Gi", | ||
"cpuRequest": "1", | ||
"cpuLimit": "1" | ||
} | ||
agent: |- | ||
{ | ||
"image" : "kserve/agent:latest", | ||
"memoryRequest": "100Mi", | ||
"memoryLimit": "1Gi", | ||
"cpuRequest": "100m", | ||
"cpuLimit": "1" | ||
} | ||
router: |- | ||
{ | ||
"image" : "kserve/router:latest", | ||
"memoryRequest": "100Mi", | ||
"memoryLimit": "1Gi", | ||
"cpuRequest": "100m", | ||
"cpuLimit": "1" | ||
} | ||
deploy: |- | ||
{ | ||
"defaultDeploymentMode": "Serverless" | ||
} | ||
metricsAggregator: |- | ||
{ | ||
"enableMetricAggregation": "false", | ||
"enablePrometheusScraping" : "false" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
|
||
resources: | ||
- inferenceservice.yaml |
Oops, something went wrong.