diff --git a/docs/modelserving/storage/storagecontainers.md b/docs/modelserving/storage/storagecontainers.md index 4d4f84970..b86d884c3 100644 --- a/docs/modelserving/storage/storagecontainers.md +++ b/docs/modelserving/storage/storagecontainers.md @@ -36,10 +36,32 @@ In a _ClusterStorageContainer_ spec, you can specify container resource requests If a storage URI is supported by two or more _ClusterStorageContainer_ CRs, there is no guarantee which one will be used. **Please make sure that the URI format is only supported by one ClusterStorageContainer CR**. +## Custom Protocol Example -If you would like to use a custom protocol `model-registry://`, for example, you can create a custom image and add a new ClusterStorageContainer CR like this: +If you would like to use a custom protocol `model-registry://`, for example, you can create a custom image and add a new `ClusterStorageContainer` CR to make it available to KServe. -```yaml +### Create the `Custom Storage Initializer` Image + +The first step is to create a custom container image that will be injected into the KServe deployment, as init container, and that will be in charge to download the model. + +The only requirement is that the `Entrypoint` of this container image should take (and properly manage) 2 positional arguments: +1. __Source URI__: identifies the `storageUri` set in the `InferenceService` +2. __Destination Path__: the location where the model should be stored, e.g., `/mnt/models` + +!!! note + KServe controller will take care of properly injecting your container image and invoking it with those proper arguments. + +A more concrete example can be found [here](https://github.com/lampajr/model-registry-storage-initializer), where the storage initializer query an existing `model registry` service in order to retrieve the original location of the model that the user requested to deploy. + +### Create the `ClusterStorageContainer` CR + +Once the Custom Storage Initializer image is ready, you just need to create a new `ClusterStorageContainer` CR to make it available in the cluster. You just need to provide 2 essential information: +1. The _container spec definition_, this is strictly dependent on your own custom storage initializer image. +2. The _supported uri formats_ for which your custom storage initializer should be injected, in this case just `model-registry://`. + +=== "kubectl" +```bash +kubectl apply -f - <