|
| 1 | +# Demo Scripts |
| 2 | + |
| 3 | +One-click deployment script for batch-gateway on OpenShift with RHOAI/ODH. Supports `install`, `test`, and `uninstall` commands. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +**Prerequisites**: |
| 8 | + |
| 9 | +- **Tools**: `oc`, `kubectl`, `helm`, `jq`, `curl`. |
| 10 | +- **Cluster access**: You must be logged in to an OpenShift cluster. Use `oc whoami` to verify. |
| 11 | + |
| 12 | +## Usage |
| 13 | + |
| 14 | +### install |
| 15 | + |
| 16 | +```bash |
| 17 | +bash examples/deploy-demo/deploy-rhoai.sh install |
| 18 | +``` |
| 19 | + |
| 20 | +#### Components Installed |
| 21 | + |
| 22 | +| Component | Details | |
| 23 | +|-----------|---------| |
| 24 | +| cert-manager | TLS certificate management (OLM operator) | |
| 25 | +| LeaderWorkerSet | Pod group orchestration (OLM operator) | |
| 26 | +| GatewayClass + Gateway | OpenShift default gateway (auto-installs Service Mesh / Istio) | |
| 27 | +| Red Hat Connectivity Link | Productized Kuadrant — auth + rate limiting (OLM operator) | |
| 28 | +| RHOAI / ODH operator | DSCInitialization + DataScienceCluster (configurable via `OPERATOR_TYPE`) | |
| 29 | +| LLMInferenceService | KServe-managed model serving — CPU simulator (single model, default: facebook/opt-125m) | |
| 30 | +| Redis | Exchange backend (Bitnami Helm chart, configurable via `BATCH_EXCHANGE_CLIENT_TYPE`) | |
| 31 | +| PostgreSQL | Batch metadata store (Bitnami Helm chart) | |
| 32 | +| MinIO | S3-compatible file storage (when `BATCH_STORAGE_TYPE=s3`) | |
| 33 | +| Internal Gateway | ClusterIP gateway for batch processor → LLM inference (bypasses rate limits, preserves AuthPolicy) | |
| 34 | +| InferenceObjective | GIE flow control CRDs — priority-based dispatch (interactive=100, batch=-1). Enabled by default (`ENABLE_FLOW_CONTROL=true`) | |
| 35 | +| batch-gateway | apiserver + processor + gc (Helm chart) | |
| 36 | + |
| 37 | +#### Routing & Policies |
| 38 | + |
| 39 | +**External Gateway** (`openshift-ai-inference`, HTTPS:443): |
| 40 | + |
| 41 | +| HTTPRoute | Backend | Auth | Rate Limit | |
| 42 | +|-----------|---------|------|------------| |
| 43 | +| LLM route (auto-created by LLMInferenceService controller) | InferencePool (direct inference) | kubernetesTokenReview + SubjectAccessReview (model-level authz on LLMInferenceService) | 500 tokens/1min per user on `/v1/chat/completions` only (TokenRateLimitPolicy) | |
| 44 | +| `batch-route` | batch-gateway apiserver | kubernetesTokenReview only (no authz) | 20 req/1min per user (RateLimitPolicy) | |
| 45 | + |
| 46 | +**Internal Gateway** (`batch-internal-gateway`, ClusterIP, HTTP:80): |
| 47 | + |
| 48 | +| HTTPRoute | Backend | Auth | Rate Limit | |
| 49 | +|-----------|---------|------|------------| |
| 50 | +| `batch-llm-route` | InferencePool (batch processor access) | kubernetesTokenReview + SubjectAccessReview (model-level authz on LLMInferenceService) | — (none, by design) | |
| 51 | + |
| 52 | +Batch-route has no authorization — model-level authz is enforced downstream when the batch processor forwards requests through the Internal Gateway's `batch-llm-route`. |
| 53 | + |
| 54 | +#### Install Examples |
| 55 | + |
| 56 | +**Batch-gateway chart source** — controls where the batch-gateway Helm chart and images come from: |
| 57 | + |
| 58 | +| Mode | Command | |
| 59 | +|------|---------| |
| 60 | +| Local chart (default) | `bash examples/deploy-demo/deploy-rhoai.sh install` | |
| 61 | +| Specific commit | `BATCH_DEV_VERSION=1f925ff bash examples/deploy-demo/deploy-rhoai.sh install` | |
| 62 | +| Released OCI chart | `BATCH_RELEASE_VERSION=v0.1.0 bash examples/deploy-demo/deploy-rhoai.sh install` | |
| 63 | +| Specific batch-gateway images | `BATCH_IMAGE_TAG=rhoai-3.5-ea.2` <br> `BATCH_APISERVER_REPO=quay.io/rhoai/odh-llm-d-batch-gateway-apiserver-rhel9` <br> `BATCH_PROCESSOR_REPO=quay.io/rhoai/odh-llm-d-batch-gateway-processor-rhel9` <br> `BATCH_GC_REPO=quay.io/rhoai/odh-llm-d-batch-gateway-gc-rhel9` <br> `bash examples/deploy-demo/deploy-rhoai.sh install` | |
| 64 | + |
| 65 | +> `BATCH_RELEASE_VERSION` and `BATCH_DEV_VERSION` cannot be used together. |
| 66 | +
|
| 67 | +**RHOAI / ODH platform** — controls which AI platform operator is installed (orthogonal to batch-gateway chart source, can be combined): |
| 68 | + |
| 69 | +| Mode | Command | |
| 70 | +|------|---------| |
| 71 | +| Auto-detect latest RHOAI (default) | `bash examples/deploy-demo/deploy-rhoai.sh install` | |
| 72 | +| Specific RHOAI version | `RHOAI_VERSION=3.4 bash examples/deploy-demo/deploy-rhoai.sh install` | |
| 73 | +| Custom RHOAI catalog | `CUSTOM_CATALOG=quay.io/rhoai/rhoai-fbc-fragment:...` <br> `bash examples/deploy-demo/deploy-rhoai.sh install` | |
| 74 | +| ODH instead of RHOAI | `OPERATOR_TYPE=odh bash examples/deploy-demo/deploy-rhoai.sh install` | |
| 75 | + |
| 76 | +> See [Environment Variables](#environment-variables) for common parameters. |
| 77 | +
|
| 78 | +### test |
| 79 | + |
| 80 | +```bash |
| 81 | +bash examples/deploy-demo/deploy-rhoai.sh test |
| 82 | +``` |
| 83 | + |
| 84 | +Creates temporary ServiceAccounts (authorized + unauthorized) with short-lived tokens and runs the following test groups: |
| 85 | + |
| 86 | +| # | Test Group | What it verifies | |
| 87 | +|---|------------|------------------| |
| 88 | +| 1 | LLM Authn | Unauthenticated → 401, authenticated → 200 | |
| 89 | +| 2 | LLM Authz | Unauthorized → 403, authorized → 200 | |
| 90 | +| 3 | LLM Token Rate Limit | Repeated requests → 429 | |
| 91 | +| 4 | Batch Authn | Unauthenticated → 401, authenticated → 200 | |
| 92 | +| 5 | Batch Authz | Unauthorized user's batch → requests rejected with 403 by Internal Gateway | |
| 93 | +| 6 | Batch Lifecycle | File upload → batch create → poll → completed → download output | |
| 94 | +| 7 | Batch Request Rate Limit | Rapid requests → 429 | |
| 95 | +| 8 | Flow Control (if enabled) | EPP metrics: interactive requests at default priority (0, no InferenceObjective header), batch at priority -1, pool saturation metric present | |
| 96 | + |
| 97 | +Internal Gateway isolation is also verified before tests run (service type is ClusterIP, no Route/Ingress exposes it). |
| 98 | + |
| 99 | +### uninstall |
| 100 | + |
| 101 | +```bash |
| 102 | +bash examples/deploy-demo/deploy-rhoai.sh uninstall |
| 103 | +``` |
| 104 | + |
| 105 | +Default `uninstall` removes the batch-gateway footprint and associated gateway/policy resources: |
| 106 | + |
| 107 | +- Helm releases and CRs in `BATCH_NAMESPACE` (including all HTTPRoutes) |
| 108 | +- Both Gateways: `GATEWAY_NAME` and `BATCH_INTERNAL_GATEWAY_NAME` |
| 109 | +- DestinationRule `${BATCH_HELM_RELEASE}-backend-tls` |
| 110 | +- InferenceObjective resources in `LLM_NAMESPACE` |
| 111 | +- Internal Gateway resources (`batch-llm-route`, `batch-llm-route-auth`) in `LLM_NAMESPACE` |
| 112 | +- Kuadrant policies (`batch-route-auth`, `batch-ratelimit`, `inference-token-limit`) |
| 113 | +- Demo RBAC (test ServiceAccounts, Role, RoleBinding) in `LLM_NAMESPACE` |
| 114 | +- `BATCH_NAMESPACE` itself |
| 115 | + |
| 116 | +It does **not** remove RHOAI/ODH operators, Connectivity Link (Kuadrant), cert-manager, LeaderWorkerSet, GatewayClass, LLMInferenceService, or the `LLM_NAMESPACE`—so other teams' platform pieces stay. |
| 117 | + |
| 118 | +> **Note**: The default uninstall deletes the Gateway named `GATEWAY_NAME` (default: `openshift-ai-inference`). If this Gateway is shared with other teams, override `GATEWAY_NAME` or remove the Gateway deletion from the script before running. |
| 119 | +
|
| 120 | +**Do not use `UNINSTALL_ALL=1` on shared production or multi-team clusters** — that mode tears down operators and platform components others may depend on. |
| 121 | + |
| 122 | +**Full teardown** (throwaway / dedicated demo cluster only) — prefix the command with `UNINSTALL_ALL=1`: |
| 123 | + |
| 124 | +```bash |
| 125 | +UNINSTALL_ALL=1 bash examples/deploy-demo/deploy-rhoai.sh uninstall |
| 126 | +``` |
| 127 | + |
| 128 | +Use that only on **ephemeral or dedicated** demo clusters. See [issue #309](https://github.com/llm-d/llm-d-batch-gateway/issues/309) for background. |
| 129 | + |
| 130 | +## Environment Variables |
| 131 | + |
| 132 | +| Variable | Default | Scope | Description | |
| 133 | +|----------|---------|-------|-------------| |
| 134 | +| `BATCH_HELM_RELEASE` | `batch-gateway` | all | Helm release name | |
| 135 | +| `BATCH_RELEASE_VERSION` | — | all | Install from released OCI chart (e.g. `v1.0.0`). Cannot be used with `BATCH_DEV_VERSION` | |
| 136 | +| `BATCH_DEV_VERSION` | `local` | all | Image tag / commit SHA. `local` uses local chart + `latest` image. Cannot be used with `BATCH_RELEASE_VERSION` | |
| 137 | +| `BATCH_IMAGE_TAG` | — | all | Override image tag for all components. Takes precedence over `BATCH_RELEASE_VERSION` / `BATCH_DEV_VERSION` derived tags | |
| 138 | +| `BATCH_APISERVER_REPO` | — | all | Override apiserver image repository | |
| 139 | +| `BATCH_PROCESSOR_REPO` | — | all | Override processor image repository | |
| 140 | +| `BATCH_GC_REPO` | — | all | Override gc image repository | |
| 141 | +| `BATCH_DB_TYPE` | `postgresql` | all | Database backend: `postgresql` or `redis` | |
| 142 | +| `BATCH_STORAGE_TYPE` | `s3` | all | File storage: `fs` or `s3` | |
| 143 | +| `DEMO_TLS_INSECURE_SKIP_VERIFY` | `1` | all | Disables TLS certificate verification for processor → model gateway and Istio Gateway → batch apiserver (**demo/lab only**, [CWE-295](https://cwe.mitre.org/data/definitions/295.html)). Default `1` since demo scripts use self-signed certs. Set to `0` if you have trusted CA certs. | |
| 144 | +| `BATCH_NAMESPACE` | `batch-api` | all | Namespace for batch-gateway | |
| 145 | +| `LLM_NAMESPACE` | `llm` | all | Namespace for model serving | |
| 146 | +| `BATCH_EXCHANGE_CLIENT_TYPE` | `redis` | all | Exchange backend type (`redis` or `valkey`) | |
| 147 | +| `GW_REQUEST_TIMEOUT` | `5m` | all | Model gateway HTTP request timeout | |
| 148 | +| `GW_MAX_RETRIES` | `3` | all | Model gateway max retries | |
| 149 | +| `GW_INITIAL_BACKOFF` | `1s` | all | Model gateway initial retry backoff | |
| 150 | +| `GW_MAX_BACKOFF` | `60s` | all | Model gateway max retry backoff | |
| 151 | +| `OPERATOR_TYPE` | `rhoai` | rhoai | Operator type: `rhoai` or `odh` | |
| 152 | +| `CUSTOM_CATALOG` | — | rhoai | Custom catalog image for operator (creates CatalogSource) | |
| 153 | +| `RHOAI_VERSION` | (auto-detected) | rhoai | RHOAI version (e.g. `3.4`). Auto-detected from PackageManifest if not set | |
| 154 | +| `RHOAI_CHANNEL` | (auto-detected) | rhoai | RHOAI OLM channel (e.g. `stable-3.4`). Auto-detected if not set | |
| 155 | +| `ODH_CHANNEL` | `fast-3` | rhoai | ODH OLM channel (used when `OPERATOR_TYPE=odh`) | |
| 156 | +| `KUADRANT_NAMESPACE` | `kuadrant-system` | rhoai | Namespace for Connectivity Link (Kuadrant) | |
| 157 | +| `GATEWAY_CLASS_NAME` | `openshift-default` | rhoai | GatewayClass name | |
| 158 | +| `GATEWAY_NAME` | `openshift-ai-inference` | rhoai | Gateway resource name | |
| 159 | +| `GATEWAY_NAMESPACE` | `openshift-ingress` | rhoai | Gateway namespace | |
| 160 | +| `BATCH_INTERNAL_GATEWAY_NAME` | `batch-internal-gateway` | rhoai | Internal Gateway resource name | |
| 161 | +| `BATCH_INTERNAL_GATEWAY_NAMESPACE` | `${GATEWAY_NAMESPACE}` | rhoai | Internal Gateway namespace | |
| 162 | +| `MODEL_NAME` | `facebook/opt-125m` | rhoai | Model name for routing | |
| 163 | +| `MODEL_URI` | `hf://sshleifer/tiny-gpt2` | rhoai | Model URI for LLMInferenceService | |
| 164 | +| `MODEL_REPLICAS` | `1` | rhoai | Number of model replicas | |
| 165 | +| `SIM_IMAGE` | `ghcr.io/llm-d/llm-d-inference-sim:v0.7.1` | rhoai | Simulator container image | |
| 166 | +| `ENABLE_FLOW_CONTROL` | `true` | rhoai | Enable GIE priority-based flow control | |
| 167 | +| `INTERACTIVE_FLOW_CONTROL_OBJECTIVE` | `interactive-default` | rhoai | InferenceObjective name for interactive requests (priority 100) | |
| 168 | +| `BATCH_FLOW_CONTROL_OBJECTIVE` | `batch-sheddable` | rhoai | InferenceObjective name for batch requests (priority -1) | |
| 169 | +| `UNINSTALL_ALL` | `0` | all | Set to `1` to remove RHOAI operators, Kuadrant, cert-manager, etc. (ephemeral clusters only) | |
0 commit comments