@@ -11,22 +11,22 @@ import (
11
11
12
12
// RayClusterSpec defines the desired state of RayCluster
13
13
type RayClusterSpec struct {
14
+ // Suspend indicates whether a RayCluster should be suspended.
15
+ // A suspended RayCluster will have head pods and worker pods deleted.
16
+ Suspend * bool `json:"suspend,omitempty"`
17
+ // AutoscalerOptions specifies optional configuration for the Ray autoscaler.
18
+ AutoscalerOptions * AutoscalerOptions `json:"autoscalerOptions,omitempty"`
19
+ HeadServiceAnnotations map [string ]string `json:"headServiceAnnotations,omitempty"`
20
+ // EnableInTreeAutoscaling indicates whether operator should create in tree autoscaling configs
21
+ EnableInTreeAutoscaling * bool `json:"enableInTreeAutoscaling,omitempty"`
14
22
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
15
23
// Important: Run "make" to regenerate code after modifying this file
16
24
// HeadGroupSpecs are the spec for the head pod
17
25
HeadGroupSpec HeadGroupSpec `json:"headGroupSpec"`
18
- // WorkerGroupSpecs are the specs for the worker pods
19
- WorkerGroupSpecs []WorkerGroupSpec `json:"workerGroupSpecs,omitempty"`
20
26
// RayVersion is used to determine the command for the Kubernetes Job managed by RayJob
21
27
RayVersion string `json:"rayVersion,omitempty"`
22
- // EnableInTreeAutoscaling indicates whether operator should create in tree autoscaling configs
23
- EnableInTreeAutoscaling * bool `json:"enableInTreeAutoscaling,omitempty"`
24
- // AutoscalerOptions specifies optional configuration for the Ray autoscaler.
25
- AutoscalerOptions * AutoscalerOptions `json:"autoscalerOptions,omitempty"`
26
- HeadServiceAnnotations map [string ]string `json:"headServiceAnnotations,omitempty"`
27
- // Suspend indicates whether a RayCluster should be suspended.
28
- // A suspended RayCluster will have head pods and worker pods deleted.
29
- Suspend * bool `json:"suspend,omitempty"`
28
+ // WorkerGroupSpecs are the specs for the worker pods
29
+ WorkerGroupSpecs []WorkerGroupSpec `json:"workerGroupSpecs,omitempty"`
30
30
}
31
31
32
32
// HeadGroupSpec are the spec for the head pod
@@ -56,15 +56,15 @@ type WorkerGroupSpec struct {
56
56
// MaxReplicas denotes the maximum number of desired Pods for this worker group, and the default value is maxInt32.
57
57
// +kubebuilder:default:=2147483647
58
58
MaxReplicas * int32 `json:"maxReplicas"`
59
- // NumOfHosts denotes the number of hosts to create per replica. The default value is 1.
60
- // +kubebuilder:default:=1
61
- NumOfHosts int32 `json:"numOfHosts,omitempty"`
62
59
// RayStartParams are the params of the start command: address, object-store-memory, ...
63
60
RayStartParams map [string ]string `json:"rayStartParams"`
64
61
// Template is a pod template for the worker
65
62
Template corev1.PodTemplateSpec `json:"template"`
66
63
// ScaleStrategy defines which pods to remove
67
64
ScaleStrategy ScaleStrategy `json:"scaleStrategy,omitempty"`
65
+ // NumOfHosts denotes the number of hosts to create per replica. The default value is 1.
66
+ // +kubebuilder:default:=1
67
+ NumOfHosts int32 `json:"numOfHosts,omitempty"`
68
68
}
69
69
70
70
// ScaleStrategy to remove workers
@@ -82,12 +82,6 @@ type AutoscalerOptions struct {
82
82
Image * string `json:"image,omitempty"`
83
83
// ImagePullPolicy optionally overrides the autoscaler container's image pull policy. This override is for provided for autoscaler testing and development.
84
84
ImagePullPolicy * corev1.PullPolicy `json:"imagePullPolicy,omitempty"`
85
- // Optional list of environment variables to set in the autoscaler container.
86
- Env []corev1.EnvVar `json:"env,omitempty"`
87
- // Optional list of sources to populate environment variables in the autoscaler container.
88
- EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"`
89
- // Optional list of volumeMounts. This is needed for enabling TLS for the autoscaler container.
90
- VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
91
85
// SecurityContext defines the security options the container should be run with.
92
86
// If set, the fields of SecurityContext override the equivalent fields of PodSecurityContext.
93
87
// More info: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
@@ -101,6 +95,12 @@ type AutoscalerOptions struct {
101
95
// Aggressive: An alias for Default; upscaling is not rate-limited.
102
96
// It is not read by the KubeRay operator but by the Ray autoscaler.
103
97
UpscalingMode * UpscalingMode `json:"upscalingMode,omitempty"`
98
+ // Optional list of environment variables to set in the autoscaler container.
99
+ Env []corev1.EnvVar `json:"env,omitempty"`
100
+ // Optional list of sources to populate environment variables in the autoscaler container.
101
+ EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"`
102
+ // Optional list of volumeMounts. This is needed for enabling TLS for the autoscaler container.
103
+ VolumeMounts []corev1.VolumeMount `json:"volumeMounts,omitempty"`
104
104
}
105
105
106
106
// +kubebuilder:validation:Enum=Default;Aggressive;Conservative
@@ -121,16 +121,6 @@ type RayClusterStatus struct {
121
121
// Important: Run "make" to regenerate code after modifying this file
122
122
// Status reflects the status of the cluster
123
123
State ClusterState `json:"state,omitempty"`
124
- // ReadyWorkerReplicas indicates how many worker replicas are ready in the cluster
125
- ReadyWorkerReplicas int32 `json:"readyWorkerReplicas,omitempty"`
126
- // AvailableWorkerReplicas indicates how many replicas are available in the cluster
127
- AvailableWorkerReplicas int32 `json:"availableWorkerReplicas,omitempty"`
128
- // DesiredWorkerReplicas indicates overall desired replicas claimed by the user at the cluster level.
129
- DesiredWorkerReplicas int32 `json:"desiredWorkerReplicas,omitempty"`
130
- // MinWorkerReplicas indicates sum of minimum replicas of each node group.
131
- MinWorkerReplicas int32 `json:"minWorkerReplicas,omitempty"`
132
- // MaxWorkerReplicas indicates sum of maximum replicas of each node group.
133
- MaxWorkerReplicas int32 `json:"maxWorkerReplicas,omitempty"`
134
124
// DesiredCPU indicates total desired CPUs for the cluster
135
125
DesiredCPU resource.Quantity `json:"desiredCPU,omitempty"`
136
126
// DesiredMemory indicates total desired memory for the cluster
@@ -150,6 +140,16 @@ type RayClusterStatus struct {
150
140
Head HeadInfo `json:"head,omitempty"`
151
141
// Reason provides more information about current State
152
142
Reason string `json:"reason,omitempty"`
143
+ // ReadyWorkerReplicas indicates how many worker replicas are ready in the cluster
144
+ ReadyWorkerReplicas int32 `json:"readyWorkerReplicas,omitempty"`
145
+ // AvailableWorkerReplicas indicates how many replicas are available in the cluster
146
+ AvailableWorkerReplicas int32 `json:"availableWorkerReplicas,omitempty"`
147
+ // DesiredWorkerReplicas indicates overall desired replicas claimed by the user at the cluster level.
148
+ DesiredWorkerReplicas int32 `json:"desiredWorkerReplicas,omitempty"`
149
+ // MinWorkerReplicas indicates sum of minimum replicas of each node group.
150
+ MinWorkerReplicas int32 `json:"minWorkerReplicas,omitempty"`
151
+ // MaxWorkerReplicas indicates sum of maximum replicas of each node group.
152
+ MaxWorkerReplicas int32 `json:"maxWorkerReplicas,omitempty"`
153
153
// observedGeneration is the most recent generation observed for this RayCluster. It corresponds to the
154
154
// RayCluster's generation, which is updated on mutation by the API Server.
155
155
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
0 commit comments