@@ -1143,14 +1143,15 @@ func (r *RayClusterReconciler) buildWorkerPod(ctx context.Context, instance rayv
1143
1143
func (r * RayClusterReconciler ) buildRedisCleanupJob (ctx context.Context , instance rayv1.RayCluster ) batchv1.Job {
1144
1144
logger := ctrl .LoggerFrom (ctx )
1145
1145
1146
+ // Build the head pod
1146
1147
pod := r .buildHeadPod (ctx , instance )
1147
1148
pod .Labels [utils .RayNodeTypeLabelKey ] = string (rayv1 .RedisCleanupNode )
1148
1149
1149
1150
// Only keep the Ray container in the Redis cleanup Job.
1150
1151
pod .Spec .Containers = []corev1.Container {pod .Spec .Containers [utils .RayContainerIndex ]}
1151
1152
pod .Spec .Containers [utils .RayContainerIndex ].Command = []string {"/bin/bash" , "-lc" , "--" }
1152
1153
pod .Spec .Containers [utils .RayContainerIndex ].Args = []string {
1153
- "echo \" To get more information about manually delete the storage namespace in Redis and remove the RayCluster's finalizer, please check https://docs.ray.io/en/master/cluster/kubernetes/user-guides/kuberay-gcs-ft.html for more details.\" && " +
1154
+ "echo \" To get more information about manually deleting the storage namespace in Redis and removing the RayCluster's finalizer, please check https://docs.ray.io/en/master/cluster/kubernetes/user-guides/kuberay-gcs-ft.html for more details.\" && " +
1154
1155
"python -c " +
1155
1156
"\" from ray._private.gcs_utils import cleanup_redis_storage; " +
1156
1157
"from urllib.parse import urlparse; " +
@@ -1180,8 +1181,8 @@ func (r *RayClusterReconciler) buildRedisCleanupJob(ctx context.Context, instanc
1180
1181
Value : "500" ,
1181
1182
})
1182
1183
1183
- // The container's resource consumption remains constant. so hard -coding the resources is acceptable.
1184
- // In addition, avoid using the GPU for the Redis cleanup Job.
1184
+ // The container's resource consumption remains constant. Hard -coding the resources is acceptable.
1185
+ // Avoid using the GPU for the Redis cleanup Job.
1185
1186
pod .Spec .Containers [utils .RayContainerIndex ].Resources = corev1.ResourceRequirements {
1186
1187
Limits : corev1.ResourceList {
1187
1188
corev1 .ResourceCPU : resource .MustParse ("200m" ),
@@ -1196,9 +1197,12 @@ func (r *RayClusterReconciler) buildRedisCleanupJob(ctx context.Context, instanc
1196
1197
// For Kubernetes Job, the valid values for Pod's `RestartPolicy` are `Never` and `OnFailure`.
1197
1198
pod .Spec .RestartPolicy = corev1 .RestartPolicyNever
1198
1199
1200
+ // Trim the job name to ensure it is within the 63-character limit.
1201
+ jobName := utils .TrimJobName (fmt .Sprintf ("%s-%s" , instance .Name , "redis-cleanup" ))
1202
+
1199
1203
redisCleanupJob := batchv1.Job {
1200
1204
ObjectMeta : metav1.ObjectMeta {
1201
- Name : fmt . Sprintf ( "%s-%s" , instance . Name , "redis-cleanup" ) ,
1205
+ Name : jobName ,
1202
1206
Namespace : instance .Namespace ,
1203
1207
Labels : pod .Labels ,
1204
1208
Annotations : pod .Annotations ,
@@ -1209,7 +1213,7 @@ func (r *RayClusterReconciler) buildRedisCleanupJob(ctx context.Context, instanc
1209
1213
ObjectMeta : pod .ObjectMeta ,
1210
1214
Spec : pod .Spec ,
1211
1215
},
1212
- // make this job be best-effort only for 5 minutes.
1216
+ // Make this job best-effort only for 5 minutes.
1213
1217
ActiveDeadlineSeconds : ptr.To [int64 ](300 ),
1214
1218
},
1215
1219
}
0 commit comments