Skip to content

Commit a099da3

Browse files
authored
[Helm] Use helm-docs to generate README for chart ray-cluster automatically (#3887)
Signed-off-by: win5923 <[email protected]>
1 parent 3df7818 commit a099da3

File tree

6 files changed

+282
-11
lines changed

6 files changed

+282
-11
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,6 @@ repos:
8989
# Make the tool search for charts only under the `helm-chart` directory
9090
- --chart-search-root=helm-chart
9191
- --chart-to-generate=helm-chart/kuberay-operator
92+
- --chart-to-generate=helm-chart/ray-cluster
9293
- --template-files=README.md.gotmpl
9394
- --sort-values-order=file

helm-chart/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ helm-lint: ## Run Helm chart lint test.
6363
.PHONY: helm-docs
6464
helm-docs: helm-docs-plugin ## Generates markdown documentation for Helm charts from requirements and values files.
6565
$(HELM_DOCS) --chart-search-root=$(WORKDIR) --chart-to-generate=$(KUBERAY_OPERATOR_CHART_PATH) --sort-values-order=file
66+
$(HELM_DOCS) --chart-search-root=$(WORKDIR) --chart-to-generate=$(RAY_CLUSTER_CHART_PATH) --sort-values-order=file
6667

6768
##@ Dependencies
6869

helm-chart/ray-cluster/Chart.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
apiVersion: v1
2-
description: A Helm chart for Kubernetes
2+
33
name: ray-cluster
4+
5+
description: A Helm chart for deploying the RayCluster with the kuberay operator.
6+
47
version: 1.1.0
8+
9+
home: https://github.com/ray-project/kuberay
10+
511
icon: https://github.com/ray-project/ray/raw/master/doc/source/images/ray_header_logo.png

helm-chart/ray-cluster/README.md

Lines changed: 105 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
# RayCluster
22

3-
RayCluster is a custom resource definition (CRD). **KubeRay operator** will listen to the resource
4-
events about RayCluster and create related Kubernetes resources (e.g. Pod & Service). Hence,
5-
**KubeRay operator** installation and **CRD** registration are required for this guide.
3+
![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square)
4+
5+
A Helm chart for deploying the RayCluster with the kuberay operator.
6+
7+
**Homepage:** <https://github.com/ray-project/kuberay>
8+
9+
## Introduction
10+
11+
RayCluster is a custom resource definition (CRD).
12+
KubeRay operator will listen to the resource events about RayCluster and create related Kubernetes resources
13+
(e.g. Pod & Service).
14+
Hence, KubeRay operator installation and CRD registration are required for this guide.
615

716
## Prerequisites
817

@@ -58,3 +67,96 @@ helm uninstall raycluster
5867
```
5968

6069
[kuberay-operator/README.md]: https://github.com/ray-project/kuberay/blob/master/helm-chart/kuberay-operator/README.md
70+
71+
## Values
72+
73+
| Key | Type | Default | Description |
74+
|-----|------|---------|-------------|
75+
| image.repository | string | `"rayproject/ray"` | Image repository. |
76+
| image.tag | string | `"2.46.0"` | Image tag. |
77+
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy. |
78+
| nameOverride | string | `"kuberay"` | String to partially override release name. |
79+
| fullnameOverride | string | `""` | String to fully override release name. |
80+
| imagePullSecrets | list | `[]` | Secrets with credentials to pull images from a private registry |
81+
| common.containerEnv | list | `[]` | containerEnv specifies environment variables for the Ray head and worker containers. Follows standard K8s container env schema. |
82+
| head.initContainers | list | `[]` | Init containers to add to the head pod |
83+
| head.labels | object | `{}` | Labels for the head pod |
84+
| head.serviceAccountName | string | `""` | |
85+
| head.restartPolicy | string | `""` | |
86+
| head.containerEnv | list | `[]` | |
87+
| head.envFrom | list | `[]` | envFrom to pass to head pod |
88+
| head.resources.limits.cpu | string | `"1"` | |
89+
| head.resources.limits.memory | string | `"2G"` | |
90+
| head.resources.requests.cpu | string | `"1"` | |
91+
| head.resources.requests.memory | string | `"2G"` | |
92+
| head.annotations | object | `{}` | Extra annotations for head pod |
93+
| head.nodeSelector | object | `{}` | Node labels for head pod assignment |
94+
| head.tolerations | list | `[]` | Node tolerations for head pod scheduling to nodes with taints |
95+
| head.affinity | object | `{}` | Head pod affinity |
96+
| head.podSecurityContext | object | `{}` | Head pod security context. |
97+
| head.securityContext | object | `{}` | Ray container security context. |
98+
| head.volumes[0].name | string | `"log-volume"` | |
99+
| head.volumes[0].emptyDir | object | `{}` | |
100+
| head.volumeMounts[0].mountPath | string | `"/tmp/ray"` | |
101+
| head.volumeMounts[0].name | string | `"log-volume"` | |
102+
| head.sidecarContainers | list | `[]` | |
103+
| head.command | list | `[]` | |
104+
| head.args | list | `[]` | |
105+
| head.headService | object | `{}` | |
106+
| head.topologySpreadConstraints | list | `[]` | |
107+
| worker.groupName | string | `"workergroup"` | The name of the workergroup |
108+
| worker.replicas | int | `1` | The number of replicas for the worker pod |
109+
| worker.minReplicas | int | `1` | The minimum number of replicas for the worker pod |
110+
| worker.maxReplicas | int | `3` | The maximum number of replicas for the worker pod |
111+
| worker.labels | object | `{}` | Labels for the worker pod |
112+
| worker.serviceAccountName | string | `""` | |
113+
| worker.restartPolicy | string | `""` | |
114+
| worker.initContainers | list | `[]` | Init containers to add to the worker pod |
115+
| worker.containerEnv | list | `[]` | |
116+
| worker.envFrom | list | `[]` | envFrom to pass to worker pod |
117+
| worker.resources.limits.cpu | string | `"1"` | |
118+
| worker.resources.limits.memory | string | `"1G"` | |
119+
| worker.resources.requests.cpu | string | `"1"` | |
120+
| worker.resources.requests.memory | string | `"1G"` | |
121+
| worker.annotations | object | `{}` | Extra annotations for worker pod |
122+
| worker.nodeSelector | object | `{}` | Node labels for worker pod assignment |
123+
| worker.tolerations | list | `[]` | Node tolerations for worker pod scheduling to nodes with taints |
124+
| worker.affinity | object | `{}` | Worker pod affinity |
125+
| worker.podSecurityContext | object | `{}` | Worker pod security context. |
126+
| worker.securityContext | object | `{}` | Ray container security context. |
127+
| worker.volumes[0].name | string | `"log-volume"` | |
128+
| worker.volumes[0].emptyDir | object | `{}` | |
129+
| worker.volumeMounts[0].mountPath | string | `"/tmp/ray"` | |
130+
| worker.volumeMounts[0].name | string | `"log-volume"` | |
131+
| worker.sidecarContainers | list | `[]` | |
132+
| worker.command | list | `[]` | |
133+
| worker.args | list | `[]` | |
134+
| worker.topologySpreadConstraints | list | `[]` | |
135+
| additionalWorkerGroups.smallGroup.disabled | bool | `true` | |
136+
| additionalWorkerGroups.smallGroup.replicas | int | `0` | The number of replicas for the additional worker pod |
137+
| additionalWorkerGroups.smallGroup.minReplicas | int | `0` | The minimum number of replicas for the additional worker pod |
138+
| additionalWorkerGroups.smallGroup.maxReplicas | int | `3` | The maximum number of replicas for the additional worker pod |
139+
| additionalWorkerGroups.smallGroup.labels | object | `{}` | Labels for the additional worker pod |
140+
| additionalWorkerGroups.smallGroup.serviceAccountName | string | `""` | |
141+
| additionalWorkerGroups.smallGroup.restartPolicy | string | `""` | |
142+
| additionalWorkerGroups.smallGroup.containerEnv | list | `[]` | |
143+
| additionalWorkerGroups.smallGroup.envFrom | list | `[]` | envFrom to pass to additional worker pod |
144+
| additionalWorkerGroups.smallGroup.resources.limits.cpu | int | `1` | |
145+
| additionalWorkerGroups.smallGroup.resources.limits.memory | string | `"1G"` | |
146+
| additionalWorkerGroups.smallGroup.resources.requests.cpu | int | `1` | |
147+
| additionalWorkerGroups.smallGroup.resources.requests.memory | string | `"1G"` | |
148+
| additionalWorkerGroups.smallGroup.annotations | object | `{}` | Extra annotations for additional worker pod |
149+
| additionalWorkerGroups.smallGroup.nodeSelector | object | `{}` | Node labels for additional worker pod assignment |
150+
| additionalWorkerGroups.smallGroup.tolerations | list | `[]` | Node tolerations for additional worker pod scheduling to nodes with taints |
151+
| additionalWorkerGroups.smallGroup.affinity | object | `{}` | Additional worker pod affinity |
152+
| additionalWorkerGroups.smallGroup.podSecurityContext | object | `{}` | Additional worker pod security context. |
153+
| additionalWorkerGroups.smallGroup.securityContext | object | `{}` | Ray container security context. |
154+
| additionalWorkerGroups.smallGroup.volumes[0].name | string | `"log-volume"` | |
155+
| additionalWorkerGroups.smallGroup.volumes[0].emptyDir | object | `{}` | |
156+
| additionalWorkerGroups.smallGroup.volumeMounts[0].mountPath | string | `"/tmp/ray"` | |
157+
| additionalWorkerGroups.smallGroup.volumeMounts[0].name | string | `"log-volume"` | |
158+
| additionalWorkerGroups.smallGroup.sidecarContainers | list | `[]` | |
159+
| additionalWorkerGroups.smallGroup.command | list | `[]` | |
160+
| additionalWorkerGroups.smallGroup.args | list | `[]` | |
161+
| additionalWorkerGroups.smallGroup.topologySpreadConstraints | list | `[]` | |
162+
| service.type | string | `"ClusterIP"` | |
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# RayCluster
2+
3+
{{ template "chart.deprecationWarning" . }}
4+
5+
{{ template "chart.badgesSection" . }}
6+
7+
{{ template "chart.description" . }}
8+
9+
{{ template "chart.homepageLine" . }}
10+
11+
## Introduction
12+
13+
RayCluster is a custom resource definition (CRD).
14+
KubeRay operator will listen to the resource events about RayCluster and create related Kubernetes resources
15+
(e.g. Pod & Service).
16+
Hence, KubeRay operator installation and CRD registration are required for this guide.
17+
18+
## Prerequisites
19+
20+
See [kuberay-operator/README.md] for more details.
21+
22+
* Helm
23+
* Install custom resource definition and KubeRay operator (covered by the following end-to-end
24+
example.)
25+
26+
## End-to-end example
27+
28+
```sh
29+
# Step 1: Create a KinD cluster
30+
kind create cluster
31+
32+
# Step 2: Register a Helm chart repo
33+
helm repo add kuberay https://ray-project.github.io/kuberay-helm/
34+
35+
# Step 3: Install both CRDs and KubeRay operator v1.1.0.
36+
helm install kuberay-operator kuberay/kuberay-operator --version 1.1.0
37+
38+
# Step 4: Install a RayCluster custom resource
39+
# (For x86_64 users)
40+
helm install raycluster kuberay/ray-cluster --version 1.1.0
41+
# (For arm64 users, e.g. Mac M1)
42+
# See here for all available arm64 images: https://hub.docker.com/r/rayproject/ray/tags?page=1&name=aarch64
43+
helm install raycluster kuberay/ray-cluster --version 1.1.0 --set image.tag=nightly-aarch64
44+
45+
# Step 5: Verify the installation of KubeRay operator and RayCluster
46+
kubectl get pods
47+
# NAME READY STATUS RESTARTS AGE
48+
# kuberay-operator-6fcbb94f64-gkpc9 1/1 Running 0 89s
49+
# raycluster-kuberay-head-qp9f4 1/1 Running 0 66s
50+
# raycluster-kuberay-worker-workergroup-2jckt 1/1 Running 0 66s
51+
52+
# Step 6: Forward the port of Dashboard
53+
kubectl port-forward svc/raycluster-kuberay-head-svc 8265:8265
54+
55+
# Step 7: Check 127.0.0.1:8265 for the Dashboard
56+
57+
# Step 8: Log in to Ray head Pod and execute a job.
58+
kubectl exec -it ${RAYCLUSTER_HEAD_POD} -- bash
59+
python -c "import ray; ray.init(); print(ray.cluster_resources())" # (in Ray head Pod)
60+
61+
# Step 9: Check 127.0.0.1:8265/#/job. The status of the job should be "SUCCEEDED".
62+
63+
# Step 10: Uninstall RayCluster
64+
helm uninstall raycluster
65+
66+
# Step 11: Verify that RayCluster has been removed successfully
67+
# NAME READY STATUS RESTARTS AGE
68+
# kuberay-operator-6fcbb94f64-gkpc9 1/1 Running 0 9m57s
69+
```
70+
71+
[kuberay-operator/README.md]: https://github.com/ray-project/kuberay/blob/master/helm-chart/kuberay-operator/README.md
72+
73+
{{ template "chart.valuesSection" . }}

0 commit comments

Comments
 (0)