Skip to content

Commit 5e05c2f

Browse files
[Test][KubeRay] Add doctest for RayCluster Quickstart doc (#51249)
Signed-off-by: Chi-Sheng Liu <chishengliu@chishengliu.com>
1 parent 1103bd1 commit 5e05c2f

File tree

11 files changed

+751
-232
lines changed

11 files changed

+751
-232
lines changed

.buildkite/kuberay.rayci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,20 @@ steps:
1919
- forge
2020
- raycpubase
2121

22+
- label: ":kubernetes: kuberay doc tests"
23+
tags:
24+
- python
25+
- docker
26+
instance_type: medium
27+
commands:
28+
- bash ci/k8s/run-kuberay-doc-tests.sh
29+
docker_network: "host"
30+
depends_on:
31+
- k8sbuild
32+
- manylinux
33+
- forge
34+
- raycpubase
35+
2236
- label: ":kubernetes: chaos {{matrix.workload}} under {{matrix.fault}}"
2337
key: kuberay_tests
2438
tags:

ci/k8s/prep-k8s-environment.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ set -x # Be more verbose now.
1212
# Delete dangling clusters
1313
kind delete clusters --all
1414

15-
# Create the cluster
15+
# Exit directly if SKIP_CREATE_KIND_CLUSTER is set
16+
if [[ -n "${SKIP_CREATE_KIND_CLUSTER:-}" ]]; then
17+
echo "SKIP_CREATE_KIND_CLUSTER is set. Skipping creating kind cluster."
18+
exit 0
19+
fi
1620
kind create cluster --wait 120s --config ci/k8s/kind.config.yaml
1721

1822
# Verify the kubectl works

ci/k8s/run-kuberay-doc-tests.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
echo "--- Setup k8s environment"
6+
SKIP_CREATE_KIND_CLUSTER=1 bash ci/k8s/prep-k8s-environment.sh
7+
8+
echo "--- Install Python dependencies"
9+
pip install -c python/requirements_compiled.txt pytest nbval bash_kernel
10+
python -m bash_kernel.install
11+
pip install "ray[default]==2.41.0"
12+
13+
echo "--- Run doc tests"
14+
cd doc/source/cluster/kubernetes
15+
py.test --nbval getting-started/raycluster-quick-start.ipynb --nbval-kernel-name bash --sanitize-with doc_sanitize.cfg
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[kuberay-operator-pod-name]
2+
regex: kuberay-operator-[a-z0-9]{10}-[a-z0-9]{5}
3+
replace: KUBERAY-OPERATOR-POD-NAME
4+
5+
[raycluster-head-pod-name]
6+
regex: raycluster-kuberay-workergroup-worker-[a-z0-9]{5}
7+
replace: RAYCLUSTER-HEAD-POD-NAME
8+
9+
[raycluster-worker-pod-name]
10+
regex: raycluster-kuberay-head-[a-z0-9]{5}
11+
replace: RAYCLUSTER-WORKER-POD-NAME
12+
13+
[rayjob-submit-name]
14+
regex: raysubmit_[a-zA-Z0-9]{16}
15+
replace: RAYJOB-SUBMIT-NAME
16+
17+
[time-duration]
18+
regex: \d+m\d+s|\d+m|\d+s
19+
replace: TIME-DURATION
20+
21+
[python-logger-prefix]
22+
regex: \d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2},\d{3}\s+[A-Z]+\s+[\w\.]+:\d+\s+--
23+
replace: PYTHON-LOGGER-PREFIX
24+
25+
[ray-cluster-resources-object-store-memory]
26+
regex: 'object_store_memory'\s*:\s*\d+(?:\.\d+)?\}
27+
replace: RAY-CLUSTER-RESOURCES-OBJECT-STORE-MEMORY

doc/source/cluster/kubernetes/getting-started.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
```{toctree}
66
:hidden:
77
8+
getting-started/kuberay-operator-installation
89
getting-started/raycluster-quick-start
910
getting-started/rayjob-quick-start
1011
getting-started/rayservice-quick-start
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
(kuberay-operator-deploy)=
2+
3+
# KubeRay Operator Installation
4+
5+
## Step 1: Create a Kubernetes cluster
6+
7+
This step creates a local Kubernetes cluster using [Kind](https://kind.sigs.k8s.io/). If you already have a Kubernetes cluster, you can skip this step.
8+
9+
```sh
10+
kind create cluster --image=kindest/node:v1.26.0
11+
```
12+
13+
## Step 2: Install KubeRay operator
14+
15+
### Method 1: Helm (Recommended)
16+
17+
```sh
18+
helm repo add kuberay https://ray-project.github.io/kuberay-helm/
19+
helm repo update
20+
# Install both CRDs and KubeRay operator v1.3.0.
21+
helm install kuberay-operator kuberay/kuberay-operator --version 1.3.0
22+
```
23+
24+
### Method 2: Kustomize
25+
26+
```sh
27+
# Install CRD and KubeRay operator.
28+
kubectl create -k "github.com/ray-project/kuberay/ray-operator/config/default?ref=v1.3.0"
29+
```
30+
31+
## Step 3: Validate Installation
32+
33+
Confirm that the operator is running in the namespace `default`.
34+
35+
```sh
36+
kubectl get pods
37+
```
38+
39+
```text
40+
NAME READY STATUS RESTARTS AGE
41+
kuberay-operator-6bc45dd644-gwtqv 1/1 Running 0 24s
42+
```

0 commit comments

Comments
 (0)