-
Notifications
You must be signed in to change notification settings - Fork 9
Add playground build and deployment #1
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
apiVersion: image.openshift.io/v1 | ||
kind: ImageStream | ||
metadata: | ||
name: playground | ||
spec: | ||
lookupPolicy: | ||
local: false | ||
--- | ||
apiVersion: image.openshift.io/v1 | ||
kind: ImageStream | ||
metadata: | ||
name: python-312 | ||
spec: | ||
lookupPolicy: | ||
local: false | ||
tags: | ||
- annotations: | ||
from: | ||
kind: DockerImage | ||
name: registry.redhat.io/ubi8/python-312 | ||
generation: 1 | ||
importPolicy: | ||
importMode: Legacy | ||
name: latest | ||
referencePolicy: | ||
type: Source | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
apiVersion: build.openshift.io/v1 | ||
kind: BuildConfig | ||
metadata: | ||
name: playground | ||
spec: | ||
failedBuildsHistoryLimit: 5 | ||
nodeSelector: | ||
output: | ||
to: | ||
kind: ImageStreamTag | ||
name: playground:latest | ||
postCommit: {} | ||
resources: {} | ||
runPolicy: Serial | ||
source: | ||
contextDir: llama_stack/distribution/ui | ||
git: | ||
ref: main | ||
uri: https://github.com/meta-llama/llama-stack.git | ||
type: Git | ||
strategy: | ||
sourceStrategy: | ||
from: | ||
kind: ImageStreamTag | ||
name: python-312:1-40.1747189120 | ||
namespace: llamastack | ||
type: Source | ||
successfulBuildsHistoryLimit: 5 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: playground | ||
spec: | ||
progressDeadlineSeconds: 600 | ||
replicas: 1 | ||
revisionHistoryLimit: 10 | ||
selector: | ||
matchLabels: | ||
deployment: playground | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 25% | ||
maxUnavailable: 25% | ||
type: RollingUpdate | ||
template: | ||
metadata: | ||
annotations: | ||
openshift.io/generated-by: OpenShiftNewApp | ||
creationTimestamp: | ||
labels: | ||
deployment: playground | ||
spec: | ||
containers: | ||
- command: | ||
- streamlit | ||
- run | ||
- app.py | ||
- "--server.port=8501" | ||
- "--server.address=0.0.0.0" | ||
env: | ||
- name: LLAMA_STACK_ENDPOINT | ||
value: http://llama-test-milvus-service-llamastack.apps.rosa.akram.vsil.p3.openshiftapps.com | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like your own private cluster address should we instead provide a generic |
||
image: image-registry.openshift-image-registry.svc:5000/llamastack/playground@sha256:00a3008aa70832bc679513b21cacc4e2ae5e875ee648dfbd60264a8b2b42d65b | ||
imagePullPolicy: IfNotPresent | ||
name: playground | ||
ports: | ||
- containerPort: 8501 | ||
protocol: TCP | ||
resources: {} | ||
terminationMessagePath: "/dev/termination-log" | ||
terminationMessagePolicy: File | ||
Comment on lines
+26
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion No security context, probes or resource limits – fails basic hardening policies Static analysis flags privilege escalation & root user. Also missing liveness/readiness probes, which Streamlit readily supports via Minimal hardened snippet: resources:
- {}
+ limits:
+ memory: "512Mi"
+ cpu: "500m"
+ requests:
+ memory: "256Mi"
+ cpu: "100m"
+ securityContext:
+ allowPrivilegeEscalation: false
+ runAsNonRoot: true
+ seccompProfile:
+ type: RuntimeDefault
+ livenessProbe:
+ httpGet:
+ path: /_stcore/health
+ port: 8501
+ initialDelaySeconds: 30
+ periodSeconds: 10
+ readinessProbe:
+ httpGet:
+ path: /_stcore/health
+ port: 8501
+ initialDelaySeconds: 5
+ periodSeconds: 10 🤖 Prompt for AI Agents
|
||
dnsPolicy: ClusterFirst | ||
restartPolicy: Always | ||
schedulerName: default-scheduler | ||
securityContext: {} | ||
terminationGracePeriodSeconds: 30 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: playground | ||
spec: | ||
internalTrafficPolicy: Cluster | ||
ipFamilies: | ||
- IPv4 | ||
ipFamilyPolicy: SingleStack | ||
ports: | ||
- name: http | ||
port: 8501 | ||
protocol: TCP | ||
targetPort: 8501 | ||
selector: | ||
deployment: playground | ||
sessionAffinity: None | ||
type: ClusterIP |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
apiVersion: route.openshift.io/v1 | ||
kind: Route | ||
metadata: | ||
name: playground | ||
spec: | ||
port: | ||
targetPort: http | ||
to: | ||
kind: Service | ||
name: playground | ||
weight: 100 | ||
wildcardPolicy: None | ||
Comment on lines
+6
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion ❓ Verification inconclusiveRoute lacks TLS termination and explicit host – external access will default to HTTP on a generated hostname Add an explicit host (or parameterise it) and enable edge termination: to:
kind: Service
name: playground
weight: 100
+ tls:
+ termination: edge # or re-encrypt/passthrough
+ insecureEdgeTerminationPolicy: Redirect
+ host: playground.example.com # 👉 make this configurable in overlays / Helm values Confirm whether the cluster is front-ended by a load balancer that injects TLS automatically; if not, the above is required. Route lacks TLS termination and explicit host – external access will default to HTTP on a generated hostname Add an explicit host (or parameterise it) and enable edge termination: to:
kind: Service
name: playground
weight: 100
+ tls:
+ termination: edge # or re-encrypt/passthrough
+ insecureEdgeTerminationPolicy: Redirect
+ host: playground.example.com # 👉 make this configurable in overlays / Helm values Confirm whether the cluster is front-ended by a load balancer that injects TLS automatically; if not, the above is required. 🤖 Prompt for AI Agents
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,55 @@ | ||||||||||||||||||||||||||||||||
# Deploying llamastack playground ui on OpenShift | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
## Clone llamastack | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||
git clone https://github.com/meta-llama/llama-stack.git | ||||||||||||||||||||||||||||||||
cd llama_stack/distribution/ui | ||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
## Building image | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||
oc import-image ubi8/python-312 --from=registry.redhat.io/ubi8/python-312 --confirm | ||||||||||||||||||||||||||||||||
oc new-app --name=playground . --image-stream="python-312" --context-dir=llama_stack/distribution/ui | ||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
## Configuring, patching and deploying | ||||||||||||||||||||||||||||||||
Set llamastack endpoint route | ||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||
LS_ROUTE=$(oc get route llamastack -ojsonpath={.spec.host}) | ||||||||||||||||||||||||||||||||
oc set env deployment/playground LLAMA_STACK_ENDPOINT=http://$LS_ROUTE | ||||||||||||||||||||||||||||||||
Comment on lines
+20
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Quote the Unquoted -LS_ROUTE=$(oc get route llamastack -ojsonpath={.spec.host})
+LS_ROUTE=$(oc get route llamastack -o jsonpath='{.spec.host}') Keeps the command POSIX-portable and immune to globbing. 📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
Change: | ||||||||||||||||||||||||||||||||
- entrypoint to `streamlit` as openshift python image will use app.py only instead. | ||||||||||||||||||||||||||||||||
- port to 8501 as python image uses 8080 instead | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||
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"}]}]}}}}' | ||||||||||||||||||||||||||||||||
oc patch svc playground -p '{"spec":{"ports":[{"port":8501,"targetPort":8501,"protocol":"TCP","name":"http"}]}}' | ||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
Expose `service` through a route and patch it | ||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||
oc expose svc playground | ||||||||||||||||||||||||||||||||
oc patch route playground -p '{"spec":{"port":{"targetPort":"http"}}}' | ||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
## Getting manifests | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||
oc eksporter is > 01-is.yaml | ||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hi @Ygnas , it is a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks it makes sense now There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we mention about it in the README? |
||||||||||||||||||||||||||||||||
oc eksporter bc playground --drop spec.triggers > 02-bc.yaml | ||||||||||||||||||||||||||||||||
oc eksporter deployment playground > 03-dc.yaml | ||||||||||||||||||||||||||||||||
oc eksporter svc playground --drop spec.clusterIPs > 04-svc.yaml | ||||||||||||||||||||||||||||||||
oc eksporter route playground --drop spec.host > 05-route.yaml | ||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||
Comment on lines
+42
to
+48
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Document the Previous feedback asked for clarification, but the README still assumes the plugin exists. Add installation instructions or an alternative ( +# Prerequisite
+kubectl krew install eksporter # https://github.com/…/eksporter Without this, newcomers hit “command not found”. 📝 Committable suggestion
Suggested change
🧰 Tools🪛 markdownlint-cli2 (0.17.2)42-42: Fenced code blocks should have a language specified (MD040, fenced-code-language) 🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
## Installing everything using manifests | ||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||
oc create -f . | ||||||||||||||||||||||||||||||||
``` | ||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,7 @@ | ||||||||||||||||||||||||||||
oc eksporter is > 01-is.yaml | ||||||||||||||||||||||||||||
oc eksporter bc playground --drop spec.triggers > 02-bc.yaml | ||||||||||||||||||||||||||||
oc eksporter deployment playground > 03-dc.yaml | ||||||||||||||||||||||||||||
oc eksporter svc playground --drop spec.clusterIPs > 04-svc.yaml | ||||||||||||||||||||||||||||
oc eksporter route playground --drop spec.host > 05-route.yaml | ||||||||||||||||||||||||||||
Comment on lines
+1
to
+5
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Missing shebang and defensive flags – script fails
+#!/usr/bin/env bash
+set -euo pipefail
+
oc eksporter is > 01-is.yaml
oc eksporter bc playground --drop spec.triggers > 02-bc.yaml
oc eksporter deployment playground > 03-dc.yaml
oc eksporter svc playground --drop spec.clusterIPs > 04-svc.yaml
oc eksporter route playground --drop spec.host > 05-route.yaml 📝 Committable suggestion
Suggested change
🧰 Tools🪛 Shellcheck (0.10.0)[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. (SC2148) 🤖 Prompt for AI Agents
|
||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Pin the base image by digest for deterministic builds
Tagging
registry.redhat.io/ubi8/python-312:latest
means every rebuild may silently pick up a newer image, breaking reproducibility and SBOM requirements. Prefer an immutable digest:Importing by digest still lets you tag it as
latest
locally while ensuring provenance.📝 Committable suggestion
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 18-18: trailing spaces
(trailing-spaces)
🤖 Prompt for AI Agents