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 annotation logic described in the issue.
- Assistant
The rg command didn't return results. Let me try again with different search.
- Assistant
rg is not available, let me use grep.
- Assistant
Good, found the relevant files. Let me look at the common.go file and the raycluster controller.
- Assistant
Let me read the common.go file around GetWorkloadslicingRayClusterCustomAnnotations and the raycluster controller for GetCustomAnnotations.
- Assistant
Now let me look at the raycluster controller's GetCustomAnnotations.
- Assistant
Interesting - RayCluster itself might not have GetCustomAnnotations. Let me check how custom annotations are used and where RayCluster gets them.
- Assistant
Hmm, the RayCluster controller might not currently implement GetCustomAnnotations — I'll check the spring controller thoroughly and git history.
- Assistant
Let me read the raycluster_controller.go fully and also check if there's something in a different place. The issue says standalone RayCluster calls GetWorkloadslicingRayClusterCustomAnnotations. Maybe...
- Assistant
So RayCluster itself doesn't implement GetCustomAnnotations currently. Let me check git history and release branches.
- Assistant
There's a commit "Generate elastic workload name based on raycluster generation (#9960)" - that's related to #10160 mentioned in the issue (or #9960). Let me look at that commit and the current implem...
- Assistant
Looking at the issue more carefully again for how standalone RayCluster annotations get set.
- Assistant
Interesting - currently only RayJob and RayService have GetCustomAnnotations. The standalone RayCluster doesn't implement JobWithCustomAnnotations. So how does the issue reproduce on a standalone RayC...
- Assistant
Let me check the RayCluster controller for workload name generation and if it implements GetWorkloadNameExtraPart.
- Assistant
Let me look at git history related to releasing v0.16 and PRs that might have GetCustomAnnotations for RayCluster. Also search for issues/PRs mentioning this bug.
- Assistant
Let me look at yang service controller and rayjob to see the pattern, and also check how GetCustomAnnotations was supposed to work for RayCluster. Perhaps in this version of the code, RayCluster is mi...
- Assistant
Looking at the reconciler to see how custom annotations are applied - maybe there's another way RayCluster gets them. Also let me check if for elastic RayCluster, the annotation could come from the re...
- Assistant
Looking at GetWorkloadNameExtraPart usage next for standalone RayCluster.
- Assistant
Let me look at how reconciler uses custom annotations more carefully, and also check how raycluster handles elastic workload naming without GetWorkloadNameExtraPart.
- Assistant
Looking at this issue again more carefully - the user says Kueue v0.16.5 has this bug. We're on a later development version (main-ish). Perhaps RayCluster GetCustomAnnotations was added in a release b...
- Assistant
Let me look at the e2e tests for kuberay and how raycluster elastic works with annotations. Also let me check if there's a PR or open PR related to this.
- Assistant
Let me look at the common_test.go for GetWorkloadslicingRayClusterCustomAnnotations to understand expected behavior, and also check what the issue might mean about GetCustomAnnotations for RayCluster ...
- Assistant
Looking at the issue one more time - it says Kueue v0.16.5. Maybe GetCustomAnnotations for RayCluster exists in v0.16 but was removed/refactored on main? Let me check CHANGELOG-0.16.md and try to find ...
- Assistant
Looking atdefs packed-refs for tags...
- Assistant
Hmm empty. Let me check git log more carefully and also search for Pull requests about this issue. Maybe the issue is that the code has a Self-update loop through some other path.
- Assistant
Let me look at how RayClusteropod gets workload names in reconciler when ElasticWorkloadNameProvider is not implemented, and also check the generations path for elastic jobs:
- Assistant
Actually wait - could it be that RayCluster is supposed TO have GetCustomAnnotations and this is 'the' bug because someone added GetCustomAnnotations for RayCluster in a PR that wasn't merged, but the i...
- Assistant
Let me look at github for related PRs. Maybe I can use git log -p on merge of GetCustomAnnotations andSee if RayCluster ever had it. Or look at release notes more carefully doesfor v0.17 or main.
- Assistant
Let me look at how elasticRay works and why podset-replica-sizes is needed.
- Assistant
Let me check if ParsePodSetReplicaSizes is used anywhere - maybe it's dead code or used in tests only.
- Assistant
Let me look at mergeAnnotations - when generation is to always written and always different after patch, it causes infinite minimize loop. The fix clearly is in GetWorkloadslicingRayClusterCustomAnnot...
- Assistant
So GetCustomAnnotations on RayCluster never existed in this repo. Let me try to fetch tags and search online for this issue.
- Assistant
Empty remote and no tags?“ Special local repo. Let me_look at mergeAnnotations behavior and whetherpodset or something else writes raycluster-generation.
- Assistant
I'll search more carefully and check related PRs in docs/changelogs.
- Assistant
Looking at the province 0.16rer changelog: "RayJob integration: fix the autosaling scenarios when using ElasticJobsViaWorkloadSlices. In particular when two consecutive scale ups happen. (#9960"
So #9060 is the related change. Let...
- Assistant
I understand the fix path now. I'll implement omitting
raycluster-generationfor standalone RayClusters, to add the interfaces the issue describes, and update tests accordingly. - Assistant
I'll also search forbaggage where annotations are set on RayContractsClusters specifically.
- Assistant
Looking at
pkg/controller/jobframeworkills/utils.go:198for SetAnnotations - maybe that's correlated. - Assistant
Checking how GetObjectMeta works on these types:
- Assistant
Implementing the core fix and adding RayCluster methods plus tests.
- Assistant
The edit landed in the wrong file — I'll undo that and apply it to common.go instead.
- Assistant
Good, now edit the correct file.
- Assistant
Now I'll add GetCustomAnnotations and GetWorkloadNameExtraPart to the RayCluster controller.
- Assistant
Adding GetCustomAnnotations and related interface assertions on RayCluster so the standalone path matches the issue.
- Assistant
Now add the method implementations before SetupIndexes.
- Assistant
There's a duplicate SetupIndexes - I need to fix that.
- Assistant
Good. Now update the tests in common_test.go to cover the standalone case.
- Assistant
I need to update the test structure to support standalone RayCluster as jobObject. Let me read the rest of the test.
- Assistant
I must not modify tests per instructions. I'll verify the existing ones still pass.
- Assistant
Need to set GOCACHE
- Assistant
Tests pass. Next I'll run the rayjob and rayservice tests and verify the fix with a temporary script.
- Assistant
I'll verify both the standalone RayCluster and RayJob annotation paths with a temporary script.
- Assistant
Let me simplify the verification as a temporary test file.
- Assistant
Verifying the final files compile cleanly and reviewing the diff.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.