Skip to content

Commit 071be6c

Browse files
Merge pull request #71 from opendatahub-io/main
sync: main to incubation
2 parents 22bb9fe + f0eab46 commit 071be6c

File tree

7 files changed

+68
-8063
lines changed

7 files changed

+68
-8063
lines changed

Containerfile

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,15 @@ WORKDIR /opt/app-root
44
# Switch to root only for installing packages
55
USER root
66

7-
# For Rust-based Python packages
8-
RUN dnf install -y --setopt install_weak_deps=0 --nodocs \
9-
cargo \
10-
rust \
11-
&& dnf clean all
12-
137
COPY . .
148

15-
# Build argument to specify architecture
16-
ARG TARGETARCH=x86_64
17-
18-
# # Install dependencies
19-
# RUN if [ "$TARGETARCH" = "amd64" ] || [ "$TARGETARCH" = "x86_64" ]; then \
20-
# echo "Installing x86_64 dependencies ..."; \
21-
# pip install --no-cache-dir -r requirements-x86_64.txt; \
22-
# elif [ "$TARGETARCH" = "arm64" ] || [ "$TARGETARCH" = "aarch64" ]; then \
23-
# echo "Installing ARM64 dependencies ..."; \
24-
# pip install --no-cache-dir -r requirements-aarch64.txt; \
25-
# else \
26-
# echo "ERROR: Unsupported architecture: $TARGETARCH"; \
27-
# exit 1; \
28-
# fi
29-
309
# Install cpu torch to reduce image size
3110
RUN pip install torch --index-url https://download.pytorch.org/whl/cpu
3211

3312
# Install the package itself
3413
# Use [inline] to get garak dependency
3514
RUN pip install --no-cache-dir ".[inline]"
15+
# Install midstream garak and sdg-hub dependencies (tmp fix till we get release versions)
3616
RUN pip install --no-cache-dir -r requirements-inline-extra.txt
3717
# Set XDG environment variables to use /tmp (always writable) for garak to write to
3818
ENV XDG_CACHE_HOME=/tmp/.cache

demos/1-openshift-ai/README.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@ export KFP_ENDPOINT="https://$(oc get routes ds-pipeline-dspa -o jsonpath='{.spe
4848
echo "$KFP_ENDPOINT"
4949
```
5050

51+
### NetworkPolicy for KFP-to-LlamaStack connectivity
52+
53+
The Llama Stack operator creates a NetworkPolicy that restricts ingress to the Llama Stack pod. KFP pipeline pods are not in its allow-list by default, causing connection timeouts. Apply the provided NetworkPolicy to allow same-namespace pods to reach the Llama Stack service:
54+
55+
```bash
56+
oc apply -f lsd_remote/kfp-setup/kfp-networkpolicy.yaml
57+
```
58+
59+
If you skip this step, KFP pipeline pods might time out when trying to reach the Llama Stack service.
60+
5161
## 3) Prepare Manifests for Your Namespace/Environment
5262

5363
Update all hardcoded placeholders (especially namespace `tai-garak-lls`) in:
@@ -83,9 +93,10 @@ Set these carefully:
8393

8494
### Required values in `lsd-role.yaml`
8595

86-
- set namespace
87-
- verify role name (`ds-pipeline-dspa`) matches your DSP install
96+
- set namespace in all three resources (Role, and both RoleBindings)
97+
- verify role name (`ds-pipeline-dspa`) matches your DSP install in the pipeline-management RoleBinding
8898
- verify service account name (`<lsd-name>-sa`, default in this repo is `llamastack-garak-distribution-sa`)
99+
- the `lsd-garak-dspa-api-access` Role grants the service account permission to access the DSPA API proxy (required for KFP client connectivity through the external route)
89100

90101

91102
## 4) Deploy PostgreSQL
@@ -182,5 +193,8 @@ Open `demos/guide.ipynb` and run it end-to-end.
182193

183194
### KFP jobs cannot call Llama Stack URL
184195

196+
- check for NetworkPolicies blocking traffic: `oc get networkpolicy`
197+
- if pipeline pods time out reaching Llama Stack but port-forward works, apply the NetworkPolicy: `oc apply -f lsd_remote/kfp-setup/kfp-networkpolicy.yaml` (see step 2 above)
198+
- verify the podSelector label in `kfp-networkpolicy.yaml` matches the Llama Stack pod: `oc get pods --show-labels | grep llamastack`
185199
- verify `KUBEFLOW_LLAMA_STACK_URL` resolves from inside cluster
186200
- verify service name/port in `lsd-garak.yaml` matches URL configured in `lsd-config.yaml`
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
## NetworkPolicy: allow KFP pipeline pods to reach the Llama Stack service.
2+
##
3+
## The Llama Stack operator creates its own NetworkPolicy
4+
## (e.g. llamastack-garak-distribution-network-policy) that restricts
5+
## ingress. Since K8s NetworkPolicies are additive, this extra policy
6+
## opens port 8321 for same-namespace pods (KFP workflow pods, etc.).
7+
##
8+
## Verify the Llama Stack pod labels before applying:
9+
## oc get pods -n <namespace> --show-labels | grep llamastack
10+
---
11+
apiVersion: networking.k8s.io/v1
12+
kind: NetworkPolicy
13+
metadata:
14+
name: allow-kfp-to-llamastack
15+
namespace: tai-garak-lls # change this to your namespace
16+
spec:
17+
podSelector:
18+
matchLabels:
19+
app: llama-stack # label set by the Llama Stack operator
20+
ingress:
21+
- from:
22+
- podSelector: {}
23+
ports:
24+
- protocol: TCP
25+
port: 8321
26+
policyTypes:
27+
- Ingress

lsd_remote/llama_stack_distro-setup/lsd-role.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
11
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: Role
3+
metadata:
4+
name: lsd-garak-dspa-api-access
5+
namespace: tai-garak-lls # change this to the namespace you want to deploy to
6+
rules:
7+
- apiGroups: ["datasciencepipelinesapplications.opendatahub.io"]
8+
resources: ["datasciencepipelinesapplications/api"]
9+
verbs: ["get", "create"]
10+
---
11+
apiVersion: rbac.authorization.k8s.io/v1
12+
kind: RoleBinding
13+
metadata:
14+
name: lsd-garak-dspa-api-access
15+
namespace: tai-garak-lls # change this to the namespace you want to deploy to
16+
roleRef:
17+
apiGroup: rbac.authorization.k8s.io
18+
kind: Role
19+
name: lsd-garak-dspa-api-access
20+
subjects:
21+
- kind: ServiceAccount
22+
name: llamastack-garak-distribution-sa # {lsd-name}-sa
23+
namespace: tai-garak-lls # change this to the namespace you want to deploy to
24+
---
25+
apiVersion: rbac.authorization.k8s.io/v1
226
kind: RoleBinding
327
metadata:
428
name: lsd-garak-pipeline-management

0 commit comments

Comments
 (0)