Skip to content

[Cleanup] Remove no-op WorkersToDelete resets in the RayCluster controller #5206

Description

@win5923

Search before asking

  • I searched the issues and found no similar issues.

KubeRay Component

ray-operator

KubeRay Version

master

What happened

RayClusterReconciler contains three statements that attempt to clear ScaleStrategy.WorkersToDelete, but they are ineffective.

For example:

for _, worker := range instance.Spec.WorkerGroupSpecs {
    worker.ScaleStrategy.WorkersToDelete = []string{}
}

worker is a value copy of WorkerGroupSpec, so the assignment only modifies the local copy and does not update instance.Spec.

The same applies to reconcileMultiHostWorkerGroup. Additionally, the modified spec is never written back to the API server, and one of the assignments is immediately followed by a return.

# Location
1 raycluster_controller.go#L1153
2 raycluster_controller.go#L1358
3 raycluster_controller.go#L1362

The operator never clears the field, and that is intentional — the field is owned by the Ray Autoscaler.
See cleanUpWorkersToDelete in suite_helpers_test.go, a test helper that exists precisely to simulate the autoscaler doing it:

// Updating WorkersToDelete is the responsibility of the Ray Autoscaler. In this function,
// we simulate the behavior of the Ray Autoscaler after the scaling process has finished.

Expected behavior

These statements should not appear to clear WorkersToDelete when they have no effect.

WorkersToDelete is currently cleared by the Ray Autoscaler, and whether the operator should also clear it is being discussed in #733.

Proposal

Remove the three statements.

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions