Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PreStop configuration option #3170

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dayshah
Copy link

@dayshah dayshah commented Mar 10, 2025

Why are these changes needed?

Gives users an option to add a prestop hook which will drain the ray node when it's triggered.

Related issue number

#3185

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests
    • Manual tests
    • This PR is not tested :(

@dayshah dayshah requested a review from kevin85421 March 10, 2025 03:00
@dayshah dayshah marked this pull request as ready for review March 10, 2025 05:11
@dayshah dayshah requested a review from edoakes March 10, 2025 18:17
@dayshah dayshah changed the title Add DrainOnPreStop configuration option Add PreStop configuration option Mar 10, 2025
@@ -1095,6 +1098,9 @@ func (r *RayClusterReconciler) buildHeadPod(ctx context.Context, instance rayv1.
if len(r.headSidecarContainers) > 0 {
podConf.Spec.Containers = append(podConf.Spec.Containers, r.headSidecarContainers...)
}
if r.PreStopCommand != "" {
podConf.Spec.Containers[utils.RayContainerIndex].Lifecycle = createPreStopLifecycle(r.PreStopCommand)
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I have to check if there's already a lifecycle assigned here, or if there's some prestop / poststart commands already assigned that I have to add to? Or is it ok to assume there will no be lifecycle for this container at this point?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes I think we should check and only set it if not set by the user

@kevin85421
Copy link
Member

I will wait for @andrewsykim to review this PR since he is a user of this API. I will perform a final review later.

@kevin85421
Copy link
Member

@dayshah would you mind fixing the CI errors https://github.com/ray-project/kuberay/blob/master/ray-operator/DEVELOPMENT.md?

dayshah added 2 commits March 11, 2025 15:04
Signed-off-by: dayshah <dhyey2019@gmail.com>
Signed-off-by: dayshah <dhyey2019@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants