ISSUE DESCRIPTION Standalone elastic RayCluster self-updates raycluster-generation…
- User
ISSUE DESCRIPTION
Standalone elastic RayCluster self-updates raycluster-generation annotation What happened:
A standalone Kueue-managed elastic RayCluster is continuously updated by Kueue.
The
kueue.x-k8s.io/raycluster-generationannotation tracks the RayCluster's ownmetadata.generation, but remains one value behind. For example:metadata.generation: 273390 kueue.x-k8s.io/raycluster-generation: "273389"A later read showed the same pattern:
metadata.generation: 273462 kueue.x-k8s.io/raycluster-generation: "273461"Kueue logs showed repeated RayCluster reconciles followed by RayCluster update webhook calls from the Kueue controller manager.
This is a self-triggered loop in the RayCluster custom annotation path. For standalone RayClusters,
GetCustomAnnotationscallsGetWorkloadslicingRayClusterCustomAnnotations(ctx, c, j.Object(), podSets, j.Name). That helper fetches the same RayCluster and returns the fetched RayCluster generation as an annotation to write back onto the RayCluster. The metadata patch then advances the RayCluster generation, making the annotation stale again.What you expected to happen:
Kueue should not continuously patch a standalone elastic RayCluster when its replica counts have not changed.
The
raycluster-generationannotation is useful for RayJob and RayService, where the top-level object needs to account for an underlying RayCluster generation. A standalone RayCluster should not write its own generation back onto itself.How to reproduce it (as minimally and precisely as possible):
- Install Kueue v0.16.5 with
ElasticJobsViaWorkloadSlices=true. - Enable the RayCluster integration.
- Create a standalone RayCluster with:
metadata: annotations: kueue.x-k8s.io/elastic-job: "true" labels: kueue.x-k8s.io/queue-name: <local-queue>- Inspect the RayCluster generation and annotation repeatedly:
kubectl get raycluster.ray.io <name> -n <namespace> \ -o jsonpath='{.metadata.generation}{"\t"}{.metadata.annotations.kueue\.x-k8s\.io/raycluster-generation}{"\n"}'Anything else we need to know?:
This may be related to #10160, which added generation-based elastic workload names on the release-0.16 branch.
A fix is to omit
kueue.x-k8s.io/raycluster-generationwhen the is the same standalone RayCluster as . - Install Kueue v0.16.5 with
- Assistant
I'll start by exploring the repository structure and locating the code related to RayCluster custom annotations and the elastic job workload slicing path.
- Assistant
I'll search with grep for the relevant annotation helpers and RayCluster integration code.
- Assistant
Next I'll inspect the RayCluster controller and the shared helper that writes the generation annotation.
- Assistant
Need to use the recursive flag properly for grep.
- Assistant
Let me read the common.go file around GetWorkloadslicingRayClusterCustomAnnotations and the raycluster_controller.go for GetCustomAnnotations.
- Assistant
RayCluster may inherit GetCustomAnnotations elsewhere — I'll check the full controller and common helper remainder.
- Assistant
I’m looking for whether RayCluster implements GetCustomAnnotations, including on other branches or nearby packages.
- Assistant
RayCluster currently has no GetCustomAnnotations; I'll scan its controller and related tests for elastic-job handling next.
- Assistant
I'll inspect how RayJob and RayService implement GetCustomAnnotations and workload name extras.
- Assistant
The reported GetCustomAnnotations path is missing here, so I'll check history, tags, and related PRs next.
- Assistant
I'm reviewing the generation-based elastic workload naming commit and nearby history.
- Assistant
I'll search history and release notes for #10160 and RayCluster GetCustomAnnotations.
- Assistant
Checking elastic workload naming and annotation patch path for standalone RayClusters.
- Assistant
I'll inspect workload name generation and elastic RayCluster integration paths.
- Assistant
Inspecting UpdatePodSets and how RayCluster handles elastic autoscaling compared to RayJob.
- Assistant
Looking for uncommitted changes and any planned RayCluster GetCustomAnnotations support.
- Assistant
Let me search for how RayJob looks up ray cluster generation and also check if maybe RayCluster has GetCustomAnnotations somewhere in tests that tells us what's expected. Also check CHANGELOG 0.16 for...
- Assistant
Checking whether release-0.16 added RayCluster GetCustomAnnotations and how that path differs from main.
- Assistant
Inspecting #9960 changes and searching history for RayCluster GetCustomAnnotations.
- Assistant
I'll check the original podset-replica-sizes implementation and whether RayCluster was supposed to get matching hooks.
- Assistant
I'll inspect mergeAnnotations and how RayCluster names workloads during elastic scale.
- Assistant
I'll check how podset-replica-sizes is consumed and whether standalone RayClusters need it.
- Assistant
I'm checking prior usage of podset-replica-sizes and why RayCluster might call GetCustomAnnotations.
- Assistant
Checking the pre-refactor utils path and whether custom annotations were applied generically.
- Assistant
Searching for any GetCustomAnnotations usage or related unimplemented hooks on RayCluster.
- Assistant
Reading the CHANGELOG entry around #10160 for more context.
- Assistant
Implementing the fix in
GetWorkloadslicingRayClusterCustomAnnotations: omit the generation annotation when the job object is the standalone RayCluster. - Assistant
Checking the RayCluster webhook and any annotation-mutating paths.
- Assistant
I'll check whether tests or other packages expect RayCluster to implement GetCustomAnnotations.
- Assistant
Implementing the helper fix and a unit test for the standalone RayCluster case.
- Assistant
The issue describes RayCluster.GetCustomAnnotations; I'll add that method and clean up the comment typo.
- Assistant
Updating unit tests for the standalone RayCluster case.
- Assistant
I need to update the test1 to support standalone RayCluster as jobObject.
- Assistant
I won't touch the tests per the checklist. Running the existing unit tests.next.
- Assistant
Need to set GOCACHE
- Assistant
*RayClusterisn't a runtime.Object, so the type switch should only match*rayv1.RayCluster. - Assistant
Adding
GetCustomAnnotationson RayCluster as the issue describes, with the generation-omit fix take effect. - Assistant
Now add the GetCustomAnnotations method.
- Assistant
Reverting the
GetCustomAnnotationsaddition on RayCluster to keep the fix minimal to the helper only. - Assistant
Fixing the duplicate function declaration I introduced.
- Assistant
Restoring the missing blank line for formatting.
- Assistant
Restoring the controller file cleanly with git.
- Assistant
Re-adding RayCluster.GetCustomAnnotations, since the issue path depends on it.
- Assistant
Now add the method.
- Assistant
Fixing the formatting around PodsReady.
- Assistant
Writing a temporary script to verify standalone vs non-standalone annotation behavior.
- Assistant
I'll add a temporary unit test outside the tracked files to verify standalone behavior.
- Assistant
Cleaning up and rewriting the temporary test.
- Assistant
Running a broader suite for the Ray packages.
- Assistant
Checking elastic RayCluster e2e expectations around annotations.
- Assistant
Inspecting the elastic RayCluster integration test for annotation expectations.
- Assistant
Reverting GetCustomAnnotations — it could break elastic live-update workload identity due to extra generation bumps.
- Assistant
Returning nil for standalone RayClusters avoids self-annotation patches entirely.
- Assistant
I'll open the helper and apply the return-nil standalone path.
- Assistant
Checking how EnsureWorkloadSlices usesnames/generation for scale-down.
- Assistant
Let me read EnsureWorkloadSlices briefly.
- Assistant
GetCustomAnnotations can stay: matching counts reuse the existing slice. Adding it back.
- Assistant
Now add getcustomannotations method after PodsReady.
- Assistant
Let me add GetCustomAnnotations.
- Assistant
Verifying the final changes and running tests.
- Assistant
Reviewing the rest of the elastic scale-up integration test expectations.
- Assistant
Final review of the changed files, then submit.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.