Skip to content

Commit 28d07c9

Browse files
Expose entire head pod Service to the user (#1040)
Expose entire head pod Service to the user
1 parent 0cabd14 commit 28d07c9

File tree

12 files changed

+2254
-66
lines changed

12 files changed

+2254
-66
lines changed

helm-chart/kuberay-operator/crds/ray.io_rayclusters.yaml

Lines changed: 304 additions & 0 deletions
Large diffs are not rendered by default.

helm-chart/kuberay-operator/crds/ray.io_rayjobs.yaml

Lines changed: 317 additions & 0 deletions
Large diffs are not rendered by default.

helm-chart/kuberay-operator/crds/ray.io_rayservices.yaml

Lines changed: 317 additions & 0 deletions
Large diffs are not rendered by default.

helm-chart/ray-cluster/templates/raycluster-cluster.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ spec:
1818
autoscalerOptions: {{- toYaml .Values.head.autoscalerOptions | nindent 4 }}
1919
{{- end }}
2020
headGroupSpec:
21+
{{- if .Values.head.headService }}
22+
headService: {{- toYaml .Values.head.headService | nindent 6 }}
23+
{{- end }}
2124
serviceType: {{ .Values.service.type }}
2225
rayStartParams:
2326
{{- if and (not .Values.head.rayStartParams) (not .Values.head.initArgs) }}

helm-chart/ray-cluster/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,6 @@ additionalWorkerGroups:
216216
service:
217217
# This is optional, and the default is ClusterIP.
218218
type: ClusterIP
219+
# Optional, for the user to provide any additional fields to the service.
220+
# See https://pkg.go.dev/k8s.io/Kubernetes/pkg/api/v1#Service
221+
headService: {}

ray-operator/apis/ray/v1alpha1/raycluster_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ type RayClusterSpec struct {
2929
type HeadGroupSpec struct {
3030
// ServiceType is Kubernetes service type of the head service. it will be used by the workers to connect to the head pod
3131
ServiceType v1.ServiceType `json:"serviceType,omitempty"`
32+
// HeadService is the Kubernetes service of the head pod.
33+
HeadService *v1.Service `json:"headService,omitempty"`
3234
// EnableIngress indicates whether operator should create ingress object for head service or not.
3335
EnableIngress *bool `json:"enableIngress,omitempty"`
3436
// HeadGroupSpec.Replicas is deprecated and ignored; there can only be one head pod per Ray cluster.

ray-operator/config/crd/bases/ray.io_rayclusters.yaml

Lines changed: 304 additions & 0 deletions
Large diffs are not rendered by default.

ray-operator/config/crd/bases/ray.io_rayjobs.yaml

Lines changed: 317 additions & 0 deletions
Large diffs are not rendered by default.

ray-operator/config/crd/bases/ray.io_rayservices.yaml

Lines changed: 317 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# ray-service.custom-head-service.yaml: This sample YAML file demonstrates how to set up a custom head service
2+
# for a Ray cluster using the field spec.headGroupSpec.headService.
3+
# For examples with more realistic resource configuration, see
4+
# ray-cluster.complete.large.yaml and
5+
# ray-cluster.autoscaler.large.yaml.
6+
apiVersion: ray.io/v1alpha1
7+
kind: RayCluster
8+
metadata:
9+
labels:
10+
controller-tools.k8s.io: "1.0"
11+
# An unique identifier for the head node and workers of this cluster.
12+
name: raycluster-custom-head-service.yaml
13+
spec:
14+
rayVersion: '2.4.0' # should match the Ray version in the image of the containers
15+
# Ray head pod template
16+
headGroupSpec:
17+
# the following params are used to complete the ray start: ray start --head --block --redis-port=6379 ...
18+
rayStartParams:
19+
dashboard-host: '0.0.0.0'
20+
num-cpus: '1' # can be auto-completed from the limits
21+
headService:
22+
metadata:
23+
name: custom-ray-head-service-name
24+
labels:
25+
custom-label: custom-ray-head-service-label
26+
annotations:
27+
custom-annotation: custom-ray-head-service-annotation
28+
spec:
29+
type: LoadBalancer
30+
ports:
31+
- port: 12345
32+
targetPort: 12345
33+
name: custom-ray-head-service-port
34+
#pod template
35+
template:
36+
spec:
37+
containers:
38+
- name: ray-head
39+
image: rayproject/ray:2.4.0
40+
resources:
41+
limits:
42+
cpu: 1
43+
memory: 2Gi
44+
requests:
45+
cpu: 500m
46+
memory: 2Gi
47+
ports:
48+
- containerPort: 6379
49+
name: gcs-server
50+
- containerPort: 8265 # Ray dashboard
51+
name: dashboard
52+
- containerPort: 10001
53+
name: client

0 commit comments

Comments
 (0)