Skip to content

Commit fc87971

Browse files
committed
Add playground build and deployment
1 parent 4a000e2 commit fc87971

File tree

7 files changed

+199
-0
lines changed

7 files changed

+199
-0
lines changed

ui/01-is.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
apiVersion: image.openshift.io/v1
3+
kind: ImageStream
4+
metadata:
5+
name: playground
6+
spec:
7+
lookupPolicy:
8+
local: false
9+
---
10+
apiVersion: image.openshift.io/v1
11+
kind: ImageStream
12+
metadata:
13+
name: python-312
14+
spec:
15+
lookupPolicy:
16+
local: false
17+
tags:
18+
- annotations:
19+
from:
20+
kind: DockerImage
21+
name: registry.redhat.io/ubi8/python-312
22+
generation: 1
23+
importPolicy:
24+
importMode: Legacy
25+
name: latest
26+
referencePolicy:
27+
type: Source

ui/02-bc.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
apiVersion: build.openshift.io/v1
3+
kind: BuildConfig
4+
metadata:
5+
name: playground
6+
spec:
7+
failedBuildsHistoryLimit: 5
8+
nodeSelector:
9+
output:
10+
to:
11+
kind: ImageStreamTag
12+
name: playground:latest
13+
postCommit: {}
14+
resources: {}
15+
runPolicy: Serial
16+
source:
17+
contextDir: llama_stack/distribution/ui
18+
git:
19+
ref: main
20+
uri: https://github.com/meta-llama/llama-stack.git
21+
type: Git
22+
strategy:
23+
sourceStrategy:
24+
from:
25+
kind: ImageStreamTag
26+
name: python-312:1-40.1747189120
27+
namespace: llamastack
28+
type: Source
29+
successfulBuildsHistoryLimit: 5

ui/03-dc.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: playground
6+
spec:
7+
progressDeadlineSeconds: 600
8+
replicas: 1
9+
revisionHistoryLimit: 10
10+
selector:
11+
matchLabels:
12+
deployment: playground
13+
strategy:
14+
rollingUpdate:
15+
maxSurge: 25%
16+
maxUnavailable: 25%
17+
type: RollingUpdate
18+
template:
19+
metadata:
20+
annotations:
21+
openshift.io/generated-by: OpenShiftNewApp
22+
creationTimestamp:
23+
labels:
24+
deployment: playground
25+
spec:
26+
containers:
27+
- command:
28+
- streamlit
29+
- run
30+
- app.py
31+
- "--server.port=8501"
32+
- "--server.address=0.0.0.0"
33+
env:
34+
- name: LLAMA_STACK_ENDPOINT
35+
value: http://llama-test-milvus-service-llamastack.apps.rosa.akram.vsil.p3.openshiftapps.com
36+
image: image-registry.openshift-image-registry.svc:5000/llamastack/playground@sha256:00a3008aa70832bc679513b21cacc4e2ae5e875ee648dfbd60264a8b2b42d65b
37+
imagePullPolicy: IfNotPresent
38+
name: playground
39+
ports:
40+
- containerPort: 8501
41+
protocol: TCP
42+
resources: {}
43+
terminationMessagePath: "/dev/termination-log"
44+
terminationMessagePolicy: File
45+
dnsPolicy: ClusterFirst
46+
restartPolicy: Always
47+
schedulerName: default-scheduler
48+
securityContext: {}
49+
terminationGracePeriodSeconds: 30

ui/04-svc.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: playground
6+
spec:
7+
internalTrafficPolicy: Cluster
8+
ipFamilies:
9+
- IPv4
10+
ipFamilyPolicy: SingleStack
11+
ports:
12+
- name: http
13+
port: 8501
14+
protocol: TCP
15+
targetPort: 8501
16+
selector:
17+
deployment: playground
18+
sessionAffinity: None
19+
type: ClusterIP

ui/05-route.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
apiVersion: route.openshift.io/v1
3+
kind: Route
4+
metadata:
5+
name: playground
6+
spec:
7+
port:
8+
targetPort: http
9+
to:
10+
kind: Service
11+
name: playground
12+
weight: 100
13+
wildcardPolicy: None

ui/README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Deploying llamastack playground ui on OpenShift
2+
3+
## Clone llamastack
4+
5+
```
6+
git clone https://github.com/meta-llama/llama-stack.git
7+
cd llama_stack/distribution/ui
8+
```
9+
10+
## Building image
11+
12+
```
13+
oc import-image ubi8/python-312 --from=registry.redhat.io/ubi8/python-312 --confirm
14+
oc new-app --name=playground . --image-stream="python-312" --context-dir=llama_stack/distribution/ui
15+
```
16+
17+
## Configuring, patching and deploying
18+
Set llamastack endpoint route
19+
```
20+
LS_ROUTE=$(oc get route llamastack -ojsonpath={.spec.host})
21+
oc set env deployment/playground LLAMA_STACK_ENDPOINT=http://$LS_ROUTE
22+
```
23+
24+
Change:
25+
- entrypoint to `streamlit` as openshift python image will use app.py only instead.
26+
- port to 8501 as python image uses 8080 instead
27+
28+
```
29+
oc patch deployment playground -p '{"spec":{"template":{"spec":{"containers":[{"name":"playground","command":["streamlit","run","app.py","--server.port=8501","--server.address=0.0.0.0"],"ports":[{"containerPort":8501,"protocol":"TCP"}]}]}}}}'
30+
oc patch svc playground -p '{"spec":{"ports":[{"port":8501,"targetPort":8501,"protocol":"TCP","name":"http"}]}}'
31+
```
32+
33+
Expose `service` through a route and patch it
34+
```
35+
oc expose svc playground
36+
oc patch route playground -p '{"spec":{"port":{"targetPort":"http"}}}'
37+
```
38+
39+
40+
## Getting manifests
41+
42+
```
43+
oc eksporter is > 01-is.yaml
44+
oc eksporter bc playground --drop spec.triggers > 02-bc.yaml
45+
oc eksporter deployment playground > 03-dc.yaml
46+
oc eksporter svc playground --drop spec.clusterIPs > 04-svc.yaml
47+
oc eksporter route playground --drop spec.host > 05-route.yaml
48+
```
49+
50+
## Installing everything using manifests
51+
52+
```
53+
oc create -f .
54+
```
55+

ui/export-manifests.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
oc eksporter is > 01-is.yaml
2+
oc eksporter bc playground --drop spec.triggers > 02-bc.yaml
3+
oc eksporter deployment playground > 03-dc.yaml
4+
oc eksporter svc playground --drop spec.clusterIPs > 04-svc.yaml
5+
oc eksporter route playground --drop spec.host > 05-route.yaml
6+
7+

0 commit comments

Comments
 (0)