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:consolemetadata.generation: 273390 kueue.x-k8s.io/raycluster-generation: "273389"A later read showed the same pattern:
consolemetadata.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:
yamlmetadata: annotations: kueue.x-k8s.io/elastic-job: "true" labels: kueue.x-k8s.io/queue-name: <local-queue>- Inspect the RayCluster generation and annotation repeatedly:
sh - Install Kueue v0.16.5 with
- Assistant
I'll start by exploring the repository structure and locating the RayCluster generation annotation logic described in the issue.
- Assistant
rg is not available, let me use grep instead.
- Assistant
Let me look at the raycluster common.go file, particularly the GetWorkloadslicingRayClusterCustomAnnotations function and how RayCluster uses GetCustomAnnotations.
- Assistant
Let me look at the GetCustomAnnotations in raycluster_controller.go and the GetWorkloadslicingRayClusterCustomAnnotations function.
- Assistant
Interesting — raycluster_controller doesn't seem to implement GetCustomAnnotations. Let me check how TempElasticJobs via workload slicing works for standalone RayClusters more carefully.
- Assistant
RayCluster doesn't seem to implement GetCustomAnnotations yet — I'll check common.go and related call sites more carefully.
- Assistant
The issue describes GetCustomAnnotations on standalone RayClusters, but it may be missing — I'll check RayJob, history, and how the generation annotation is used.
- Assistant
I need to find whether RayCluster already implements custom annotations elsewhere, or if the generation annotation is written through another path.
- Assistant
I'll check release history and issue #10160—the bug may only appear against a particular tag.
- Assistant
I'll inspect the existing tests and Rayservice usage for more clues about expected standalone RayCluster behavior.
- Assistant
I'll search more broadly and review how mergeAnnotations behaves—perhaps RayCluster implements this interface through another type.
- Assistant
There's a reference to RayCluster in the JobWithCustomAnnotations docs — I'll read that interface section in full.
- Assistant
I'll inspect git history related to this function and skim the CHANGELOG for RayCluster elastic-job details.
- Assistant
Let me examine the original PR that introduced the generation annotation for RayCluster-related types.
- Assistant
So RayCluster never got GetCustomAnnotations from that PR - only RayJob and RayService. Let me look at how rayjob gets podsets for elastic and how workloadslicing works for standalone RayCluster.
- Assistant
I'll search for any other writes of the generation annotation and skim AGENTS.md for guidance.
- Assistant
I'll inspect UpdatePodSets and elastic support paths to see what standalone RayCluster still needs.
- Assistant
I'll look for related PRs or mentions of elastic standalone RayClusters.
- Assistant
There's a PR about elastic RayCluster objects with the autoscaler — I'll inspect that next.
- Assistant
Let me look at how the current ray workload related names for standalone work. Also check mergeAnnotations - if annotation already exists and is different, it loops.
- Assistant
I'll checkar elasticRayCluster tests andsee whetherthey expect GetCustomAnnotations.
- Assistant
Let me look at reconcile path more carefully. Maybe there's another place that writes annotations. Let me also read mergeAnnotations. The issue is a self-referential annotation loop on standalone RayClusters. The root cause is in
GetWorkloadslicingRayClusterCustomAnnotations, which always returns the RayCluster's own generation as thekueue.x-k8s.io/raycluster-generationannotation. - Assistant
I'll inspect how theelasticworkload name is constructed and whether standaloneRayClusters need these hooks.
- Assistant
I'll find all goes uses of the podset-replica-sizes annotation next.
- Assistant
ParsePodSetReplicaSizes is only defined but not used outside tests? Let me check.
- Assistant
I'll inspect the full RayService implementation for the pattern RayCluster should follow.
- Assistant
I've identified the root cause: writing a RayCluster's own generation back onto itself creates a permanent reconcile loop. I'll fix
GetWorkloadslicingRayClusterCustomAnnotationsand ensure RayCluster properly implementsGetCustomAnnotations. - Assistant
Next I'll patch the common helper, then wire GetCustomAnnotations on RayCluster if needed.
- Assistant
Now I'll wire GetCustomAnnotations on the standalone RayCluster type, matching the issue description.
- Assistant
The replace needs those lines visible first — I'll jump to them and try again.
- Assistant
Good, now I can replace.
- Assistant
I'll add the GetCustomAnnotations and GetWorkloadNameExtraPart method at the end of the controller.
- Assistant
I'll add GetCustomAnnotations and GetWorkloadNameExtraPart after PodsReady, before SetupIndexes - matching RayJob structure.
- Assistant
I'll spell out a temporary verification script and run the related unit tests.
- Assistant
I need to set GOCACHE and related Go environment variables.
- Assistant
Tests passed. I'll remove my temporary test file and run the related packages next.
- Assistant
I'll review the diff one more time before submitting.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.