Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add manifests dir to define K8s resources for the UI #356

Merged
merged 1 commit into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions clients/ui/bff/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,4 @@ USER 65532:65532
# Expose port 4000
EXPOSE 4000

# Define environment variables
ENV PORT 4001
ENV ENV development

ENTRYPOINT ["/bff"]
63 changes: 63 additions & 0 deletions clients/ui/manifests/base/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
[Model registry server set up]: ../../bff/docs/dev-guide.md

## Deploying the Model Registry UI in a local cluster

For this guide, we will be using kind for locally deploying our cluster. See
the [Model registry server set up] guide for prerequisites on setting up kind
and deploying the model registry server.

### Setup
#### 1. Create a kind cluster
Create a local cluster for running the MR UI using the following command:
```shell
kind create cluster
```

#### 2. Create kubeflow namespace
Create a namespace for model registry to run in, by default this is kubeflow, run:
```shell
kubectl create namespace kubeflow
```

#### 3. Deploy Model Registry UI to cluster
You can now deploy the UI and BFF to your newly created cluster using the kustomize configs in this directory:
```shell
cd clients/ui

kubectl apply -k manifests/base/ -n kubeflow
```

After a few seconds you should see 2 pods running (1 for BFF and 1 for UI):
```shell
kubectl get pods -n kubeflow
```
```
NAME READY STATUS RESTARTS AGE
model-registry-bff-746f674b99-bfvgs 1/1 Running 0 11s
model-registry-ui-58755c4754-zdrnr 1/1 Running 0 11s
```

#### 4. Access the Model Registry UI running in the cluster
Now that the pods are up and running you can access the UI.

First you will need to port-forward the UI service by running the following in it's own terminal:
```shell
kubectl port-forward service/model-registry-ui-service 8080:8080 -n kubeflow
```

You can then access the UI running in your cluster locally at http://localhost:8080/

To test the BFF separately you can also port-forward that service by running:
```shell
kubectl port-forward service/model-registry-bff-service 4000:4000 -n kubeflow
```

You can now make API requests to the BFF endpoints like:
```shell
curl http://localhost:4000/api/v1/model-registry
```
```
{
"model_registry": null
}
```
15 changes: 15 additions & 0 deletions clients/ui/manifests/base/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- model-registry-bff-role.yaml
- model-registry-bff-service.yaml
- model-registry-bff-deployment.yaml
- model-registry-ui-service.yaml
- model-registry-ui-deployment.yaml

images:
- name: model-registry-ui-image
newName: quay.io/gsulliva/mr-ui:latest
- name: model-registry-bff-image
newName: quay.io/gsulliva/mr-bff:latest
28 changes: 28 additions & 0 deletions clients/ui/manifests/base/model-registry-bff-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: model-registry-bff
labels:
app: model-registry-bff
spec:
replicas: 1
selector:
matchLabels:
app: model-registry-bff
template:
metadata:
labels:
app: model-registry-bff
spec:
containers:
- name: model-registry-bff
image: model-registry-bff-image
resources:
limits:
cpu: 500m
memory: 2Gi
requests:
cpu: 500m
memory: 2Gi
ports:
- containerPort: 4000
23 changes: 23 additions & 0 deletions clients/ui/manifests/base/model-registry-bff-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: bff-service-reader
rules:
- apiGroups: [""]
resources: ["services"]
verbs: ["get", "watch", "list"]

---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: bff-read-services
subjects:
- kind: ServiceAccount
name: default
namespace: kubeflow
roleRef:
kind: ClusterRole
name: bff-service-reader
apiGroup: rbac.authorization.k8s.io
11 changes: 11 additions & 0 deletions clients/ui/manifests/base/model-registry-bff-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: Service
metadata:
name: model-registry-bff-service
spec:
selector:
app: model-registry-bff
ports:
- protocol: TCP
port: 4000
targetPort: 4000
28 changes: 28 additions & 0 deletions clients/ui/manifests/base/model-registry-ui-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: model-registry-ui
labels:
app: model-registry-ui
spec:
replicas: 1
selector:
matchLabels:
app: model-registry-ui
template:
metadata:
labels:
app: model-registry-ui
spec:
containers:
- name: model-registry-ui
image: model-registry-ui-image
resources:
limits:
cpu: 500m
memory: 2Gi
requests:
cpu: 500m
memory: 2Gi
ports:
- containerPort: 8080
12 changes: 12 additions & 0 deletions clients/ui/manifests/base/model-registry-ui-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: model-registry-ui-service
spec:
selector:
app: model-registry-ui
ports:
- protocol: TCP
port: 8080
targetPort: 8080
name: http