Skip to content

Commit

Permalink
User instructions for installing Model Registry
Browse files Browse the repository at this point in the history
Signed-off-by: Ramesh Reddy <[email protected]>
  • Loading branch information
rareddy committed Sep 20, 2024
1 parent 637ed69 commit 36a15eb
Show file tree
Hide file tree
Showing 9 changed files with 441 additions and 0 deletions.
12 changes: 12 additions & 0 deletions docs/authorino-subscription.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: authorino-operator
namespace: openshift-operators
spec:
channel: tech-preview-v1
installPlanApproval: Automatic
name: authorino-operator
source: redhat-operators
sourceNamespace: openshift-marketplace
startingCSV: authorino-operator.v1.0.2
46 changes: 46 additions & 0 deletions docs/dsc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: datasciencecluster.opendatahub.io/v1
kind: DataScienceCluster
metadata:
labels:
app.kubernetes.io/created-by: opendatahub-operator
app.kubernetes.io/instance: default
app.kubernetes.io/managed-by: kustomize
app.kubernetes.io/name: datasciencecluster
app.kubernetes.io/part-of: opendatahub-operator
name: default-dsc
spec:
components:
codeflare:
managementState: Removed
kserve:
managementState: Managed
serving:
ingressGateway:
certificate:
type: OpenshiftDefaultIngress
managementState: Managed
name: knative-serving
modelregistry:
managementState: Managed
registriesNamespace: odh-model-registries
trustyai:
managementState: Removed
ray:
managementState: Removed
kueue:
managementState: Removed
workbenches:
managementState: Managed
dashboard:
devFlags:
manifests:
- contextDir: manifests
sourcePath: ''
uri: 'https://github.com/mturley/odh-dashboard/tarball/custom-manifest-quay-main'
managementState: Managed
modelmeshserving:
managementState: Managed
datasciencepipelines:
managementState: Managed
trainingoperator:
managementState: Removed
24 changes: 24 additions & 0 deletions docs/dsci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: dscinitialization.opendatahub.io/v1
kind: DSCInitialization
metadata:
name: default-dsci
spec:
applicationsNamespace: opendatahub
devFlags:
logmode: production
monitoring:
managementState: Managed
namespace: opendatahub
serviceMesh:
auth:
audiences:
- 'https://kubernetes.default.svc'
controlPlane:
metricsCollection: Istio
name: data-science-smcp
namespace: istio-system
managementState: Managed
trustedCABundle:
customCABundle: ''
managementState: Managed

126 changes: 126 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# Installation of Model Registry (Terminal Based)

This document outlines the instructions to install the Model Registry using "Open Data Hub" Operator on OpenShift. You can find this operator in the OpenShift Opererator market place. Please note that "Model Registry Operator" is sub-component of this operator and can not be used independently.

## Prerequisites
The following prerequisites are needed for the Operator to work correctly.
<ol>
<li> Access to OpenShift Cluster 4.17 + (recommened)
<li> To install the operators you need "cluster-admin" access
<li> Make sure you have enough capacity on the cluster to install a "data science cluster" minimum is with HCP cluster is 2 nodes of m6i
<li> Model registry currently only works MySQL or MariaDB database, if you have an access to external database collect the credentials for it. you would need `user-id`, `password`, `host`, `port`, `database-name`
</ol>


## Installing needed Operators
Once you have the OpenShift cluster available,
<ol>
<li> Log in "Openshift Console", you can go to your name on top right use "Copy Login Command" to find the below command and use the terminal to login.

```
oc login --token=xxxx --server=xxx
```

<li> Search and install "Authorino" operator, use the one with name `Red Hat - Authorino (Technical Preview)`

```
oc apply -f authorino-subscription.yaml
oc get csv authorino-operator.v1.0.2 -n openshift-operators -o json | jq '.status.phase' # verify it "Succeeded"
```

<li> Search and install "Service Mesh" operator

```
oc apply -f sm-subscription.yaml
oc get csv servicemeshoperator.v2.6.1 -n openshift-operators -o json | jq '.status.phase' # verify it "Succeeded"
```

<li> Search and install Server Less Operator

```
oc apply -f serverless-subscription.yaml
oc get csv serverless-operator.v1.33.2 -n openshift-operators -o json | jq '.status.phase' # verify it "Succeeded"
```

<li> Search and install "Open Data Hub" operator 2.18.1+ (latest is recommended)

```
oc apply -f odh-subscription.yaml
oc get csv opendatahub-operator.v2.18.1 -n openshift-operators -o json | jq '.status.phase' # verify it "Succeeded"
```

<li> If you are using local storage mechanisams for S3 bucket, try installing "minio" operator and configure its access (TDB..)
<li>
</ol>

## Install "Data Science Cluster"
Once all the operators all installed and no errors reported, then proceed to installing a "Data Science Cluster". You can navigate "Open data Hub" operator install from left navigation under "Operators --> Installed Operators" and click on "Open Data Hub Operator" and switch to the tab "DSC" and create DSC and make sure edit the YAML set the modelregistry to `managed` state like shown below

```
modelregistry:
managementState: Managed
```

Or You can also use following script

```
oc apply -f dsci.yaml
oc get dsci default-dsci # make sure it is ready before proceeding to next step
oc apply -f dsc.yaml
oc get dsc default-dsc -o json | jq '.status.phase' # make sure you see `Ready` state
```

## Install Database (skip if you using existing database)

Model registry currently requires MySQL database 8.0.3 or above to function correctly. If you have a database already available you can skip this section all toghether. For "Development" or "NON-PRODUCTION" scenarios you can use following script to install MySQL database.

```
oc new-project test-database
oc apply -f mysql-db.yaml
oc get deployment model-registry-db # make sure the database in Ready state
```

## install Model Registry

To install Model Registry use the following script

```
oc project odh-model-registries
oc apply -f registry.yaml
oc get modelregistry modelregistry-public # make sure the registry is available and running
```

## Dashboard Install

You do not need to install dashboard separately, however if for any reason Dashboard is not showing the Model Registry in the left navigation, you can use following script to enable it

```
oc patch odhdashboardconfig.opendatahub.io odh-dashboard-config -n opendatahub --type merge -p '{"spec": {"dashboardConfig": {"disableModelRegistry": false}}}'
```
## Find Model Registry URL
Model Registry uses service mesh and opens a Gateway for external clients to reach. Execute following to find the URL where Model Registry is available.

```
URL=`echo "https://$(oc get routes -n istio-system -o json | jq '.items[2].status.ingress[0].host')" | tr -d '"'`
```

## Validation
Now we can validate if everyhing working correctly by executing the following

```
export TOKEN=`oc whoami -t`
curl -k -H "Authorization: Bearer $TOKEN" $URL/api/model_registry/v1alpha3/registered_models
```

and you should see an output like

```
{"items":[],"nextPageToken":"","pageSize":0,"size":0}
```

Model Registry is fully installed and ready to go. You can log into ODH Console and find "Model Registry" on left navigation to see the available models.
146 changes: 146 additions & 0 deletions docs/mysql-db.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
apiVersion: v1
items:
- apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/name: model-registry-db
app.kubernetes.io/instance: model-registry-db
app.kubernetes.io/part-of: model-registry-db
app.kubernetes.io/managed-by: kustomize
annotations:
template.openshift.io/expose-uri: mysql://{.spec.clusterIP}:{.spec.ports[?(.name==\mysql\)].port}
name: model-registry-db
spec:
ports:
- name: mysql
nodePort: 0
port: 3306
protocol: TCP
appProtocol: tcp
targetPort: 3306
selector:
name: model-registry-db
sessionAffinity: None
type: ClusterIP
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
labels:
app.kubernetes.io/name: model-registry-db
app.kubernetes.io/instance: model-registry-db
app.kubernetes.io/part-of: model-registry-db
app.kubernetes.io/managed-by: kustomize
name: model-registry-db
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 5Gi
- apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: model-registry-db
app.kubernetes.io/instance: model-registry-db
app.kubernetes.io/part-of: model-registry-db
app.kubernetes.io/managed-by: kustomize
annotations:
template.alpha.openshift.io/wait-for-ready: "true"
name: model-registry-db
spec:
replicas: 1
revisionHistoryLimit: 0
selector:
matchLabels:
name: model-registry-db
strategy:
type: Recreate
template:
metadata:
labels:
name: model-registry-db
sidecar.istio.io/inject: "false"
spec:
containers:
- env:
- name: MYSQL_USER
valueFrom:
secretKeyRef:
key: database-user
name: model-registry-db
- name: MYSQL_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: model-registry-db
- name: MYSQL_ROOT_PASSWORD
valueFrom:
secretKeyRef:
key: database-password
name: model-registry-db
- name: MYSQL_DATABASE
valueFrom:
secretKeyRef:
key: database-name
name: model-registry-db
args:
- --datadir
- /var/lib/mysql/datadir
- --default-authentication-plugin=mysql_native_password
image: mysql:8.3.0
imagePullPolicy: IfNotPresent
livenessProbe:
exec:
command:
- /bin/bash
- -c
- mysqladmin -u${MYSQL_USER} -p${MYSQL_ROOT_PASSWORD} ping
initialDelaySeconds: 15
periodSeconds: 10
timeoutSeconds: 5
name: mysql
ports:
- containerPort: 3306
protocol: TCP
readinessProbe:
exec:
command:
- /bin/bash
- -c
- mysql -D ${MYSQL_DATABASE} -u${MYSQL_USER} -p${MYSQL_ROOT_PASSWORD} -e 'SELECT 1'
initialDelaySeconds: 10
timeoutSeconds: 5
securityContext:
capabilities: {}
privileged: false
terminationMessagePath: /dev/termination-log
volumeMounts:
- mountPath: /var/lib/mysql
name: model-registry-db-data
dnsPolicy: ClusterFirst
restartPolicy: Always
volumes:
- name: model-registry-db-data
persistentVolumeClaim:
claimName: model-registry-db
- apiVersion: v1
kind: Secret
metadata:
labels:
app.kubernetes.io/name: model-registry-db
app.kubernetes.io/instance: model-registry-db
app.kubernetes.io/part-of: model-registry-db
app.kubernetes.io/managed-by: kustomize
annotations:
template.openshift.io/expose-database_name: '{.data[''database-name'']}'
template.openshift.io/expose-password: '{.data[''database-password'']}'
template.openshift.io/expose-username: '{.data[''database-user'']}'
name: model-registry-db
stringData:
database-name: "model_registry"
database-password: "TheBlurstOfTimes" # notsecret
database-user: "mlmduser" # notsecret
kind: List
metadata: {}
12 changes: 12 additions & 0 deletions docs/odh-subscription.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: opendatahub-operator
namespace: openshift-operators
spec:
channel: fast
installPlanApproval: Automatic
name: opendatahub-operator
source: community-operators
sourceNamespace: openshift-marketplace
startingCSV: opendatahub-operator.v2.18.1
Loading

0 comments on commit 36a15eb

Please sign in to comment.