Skip to content

[Doc] Add kuberay autoscaler command overwrite#63627

Open
fscnick wants to merge 8 commits into
ray-project:masterfrom
fscnick:feat/add-autoscaler-container-command-overwrite-doc
Open

[Doc] Add kuberay autoscaler command overwrite#63627
fscnick wants to merge 8 commits into
ray-project:masterfrom
fscnick:feat/add-autoscaler-container-command-overwrite-doc

Conversation

@fscnick

@fscnick fscnick commented May 25, 2026

Copy link
Copy Markdown
Contributor

Description

In ray-project/kuberay#4835, the autoscaler command overwrite is added. This document describes how to use this feature.

Related issues

Related to ray-project/kuberay#4835

Additional information

Signed-off-by: fscnick <fscnick.dev@gmail.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new user guide for specifying custom container commands and arguments for the KubeRay autoscaler using autoscalerOptions. The documentation explains how to override the default start command and utilize the KUBERAY_GEN_AUTOSCALER_START_CMD environment variable. Review feedback suggests improving the documentation's structure by removing unnecessary section numbering and enhancing the provided kubectl examples to be more robust when multiple clusters are present by using specific labels and jsonpath for pod name retrieval.

Sometimes, you may want to execute certain commands either before or instead of the generated autoscaler start command.
This document shows you how to do that using the `command` and `args` fields in `autoscalerOptions`.

## Part 1: Specify a custom autoscaler command

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The heading "Part 1" implies that there are subsequent parts in this document. Since this guide currently only covers one main topic, it is better to use a more descriptive heading without the part number to avoid confusion.

Suggested change
## Part 1: Specify a custom autoscaler command
## Specify a custom autoscaler command

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed at a3c1f9e.

kubectl get pod -l ray.io/node-type=head

# Check the autoscaler container's command and args inside the head Pod.
export RAYCLUSTER_HEAD_POD=$(kubectl get pods --selector=ray.io/node-type=head -o custom-columns=POD:metadata.name --no-headers)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The kubectl command used to retrieve the pod name can be made more robust. By adding the ray.io/cluster-name label to the selector, you ensure that the command correctly identifies the pod even if multiple RayClusters are running in the same namespace. Additionally, using jsonpath to select the first item is more reliable for variable assignment than custom-columns.

Suggested change
export RAYCLUSTER_HEAD_POD=$(kubectl get pods --selector=ray.io/node-type=head -o custom-columns=POD:metadata.name --no-headers)
export RAYCLUSTER_HEAD_POD=$(kubectl get pods --selector=ray.io/cluster-name=raycluster-autoscaler-overwrite-cmd,ray.io/node-type=head -o jsonpath='{.items[0].metadata.name}')

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed at d107cfe.

fscnick added 2 commits May 25, 2026 22:21
Signed-off-by: fscnick <fscnick.dev@gmail.com>
Signed-off-by: fscnick <fscnick.dev@gmail.com>
@fscnick fscnick marked this pull request as ready for review May 26, 2026 00:42
@fscnick fscnick requested a review from a team as a code owner May 26, 2026 00:42
@ray-gardener ray-gardener Bot added docs An issue or change related to documentation core Issues that should be addressed in Ray Core community-contribution Contributed by the community labels May 26, 2026
@Future-Outlier Future-Outlier added the go add ONLY when ready to merge, run all tests label May 26, 2026

@AndySung320 AndySung320 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM.


# The autoscaler container's args will look like:
# Command: ["/bin/bash","-lc","--"]
# Args: ["echo 'Starting autoscaler...'; $KUBERAY_GEN_AUTOSCALER_START_CMD"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we merge this doc into kuberay-autoscaling?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed at 5c565eb

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

move to configuring-autoscaling.md. 40fc784

fscnick added 3 commits May 29, 2026 22:16
Signed-off-by: fscnick <fscnick.dev@gmail.com>
This reverts commit 5c565eb.

Signed-off-by: fscnick <fscnick.dev@gmail.com>
Signed-off-by: fscnick <fscnick.dev@gmail.com>
Comment on lines +322 to +323
These fields override the autoscaler container's entrypoint and arguments.
When either field is set, KubeRay uses those values directly instead of generating the autoscaler start command.

@win5923 win5923 Jun 20, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
These fields override the autoscaler container's entrypoint and arguments.
When either field is set, KubeRay uses those values directly instead of generating the autoscaler start command.
These fields independently override the autoscaler container's `command` and `args`.

Nit: instead of generating the autoscaler start command is a little bit misleading. KubeRay always generates it and injects it as the KUBERAY_GEN_AUTOSCALER_START_CMD env var.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed at d32c0b7.

fscnick added 2 commits June 20, 2026 23:50
Signed-off-by: fscnick <fscnick.dev@gmail.com>
…er-container-command-overwrite-doc

Signed-off-by: fscnick <fscnick.dev@gmail.com>
@fscnick fscnick requested a review from andrewsykim as a code owner June 20, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-contribution Contributed by the community core Issues that should be addressed in Ray Core docs An issue or change related to documentation go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants