Skip to content

router: refresh ModelRoute indexes on update - #1333

Merged
volcano-sh-bot merged 1 commit into
volcano-sh:mainfrom
avinxshKD:fix/modelroute-index-refresh
Aug 10, 2026
Merged

router: refresh ModelRoute indexes on update#1333
volcano-sh-bot merged 1 commit into
volcano-sh:mainfrom
avinxshKD:fix/modelroute-index-refresh

Conversation

@avinxshKD

Copy link
Copy Markdown
Contributor

What type of PR is this?

/kind bug

What this PR does / why we need it:

Refreshes ModelRoute indexes before storing an updated route.

Without this, updating a ModelRoute can leave stale entries in the old model, LoRA, or gateway indexes. A removed LoRA adapter or old parentRef may still match after the route has been updated.

Which issue(s) this PR fixes:
Fixes #N/A

Special notes for your reviewer:

Adds regression coverage for updating LoRA adapters and gateway parentRefs on the same ModelRoute.

Does this PR introduce a user-facing change?:

NONE

Copilot AI lite review requested due to automatic review settings July 10, 2026 05:41

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@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 refactors the model route deletion logic by extracting index removal into a helper method, 'removeModelRouteFromIndexesLocked', and uses it in 'AddOrUpdateModelRoute' to clean up old indexes during updates. It also adds unit tests to verify that updating a model route correctly updates LoRA and gateway routes. The review feedback correctly identifies a critical issue where ignoring the return values of 'removeModelRouteFromIndexesLocked' in 'AddOrUpdateModelRoute' leads to a goroutine leak, as unreferenced request queues are never closed. A code suggestion is provided to properly clean up and close these queues.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread pkg/kthena-router/datastore/store.go Outdated
@avinxshKD

Copy link
Copy Markdown
Contributor Author

@hzxuzhonghu @LiZhenCheng9527 ptal, found this while at ModelRoute update paths..... the store was adding new indexes without clearing the old ones first. Let me know if further changes req

@avinxshKD
avinxshKD force-pushed the fix/modelroute-index-refresh branch from 1d1adc8 to 4984aff Compare July 10, 2026 05:50
Copilot AI review requested due to automatic review settings July 10, 2026 05:50

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Comment thread pkg/kthena-router/datastore/store.go
@avinxshKD
avinxshKD force-pushed the fix/modelroute-index-refresh branch from 4984aff to fb903f5 Compare July 10, 2026 10:13
Copilot AI review requested due to automatic review settings July 10, 2026 10:13

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@avinxshKD

Copy link
Copy Markdown
Contributor Author

ptal @hzxuzhonghu, updated the queue cleanup path to reject new pushes after shutdown and wake any drained waiters, including the semaphore-mode stop path

@hzxuzhonghu

Copy link
Copy Markdown
Member

/assign @YaoZengzeng

@avinxshKD
avinxshKD force-pushed the fix/modelroute-index-refresh branch from fb903f5 to a3e6d4d Compare July 24, 2026 10:30
Copilot AI review requested due to automatic review settings July 24, 2026 10:30

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@avinxshKD

Copy link
Copy Markdown
Contributor Author

@YaoZengzeng ptal when get chance

@avinxshKD

Copy link
Copy Markdown
Contributor Author

@YaoZengzeng ptal when get chance, and lmk if changes needed

Comment thread pkg/kthena-router/datastore/store.go Outdated
Copilot AI review requested due to automatic review settings August 10, 2026 09:15
@avinxshKD
avinxshKD force-pushed the fix/modelroute-index-refresh branch from a3e6d4d to 4636fe8 Compare August 10, 2026 09:15

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Signed-off-by: Avinash Kumar Deepak <avinash8655279@gmail.com>
@avinxshKD
avinxshKD force-pushed the fix/modelroute-index-refresh branch from 4636fe8 to 30b9ee4 Compare August 10, 2026 09:47
Copilot AI review requested due to automatic review settings August 10, 2026 09:47

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@avinxshKD

Copy link
Copy Markdown
Contributor Author

@LiZhenCheng9527 renamed it to queueCleanupCandidates as suggested. PTAL.

var deletedRoute *aiv1alpha1.ModelRoute
// Collect all model/lora names that may have associated queues (for cleanup after unlock)
var namesToCleanQueue []string
var queueCleanupCandidates []string

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.

suggest modelsToClean

@hzxuzhonghu hzxuzhonghu left a comment

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.

/lgtm

@volcano-sh-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hzxuzhonghu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@volcano-sh-bot
volcano-sh-bot merged commit 339e814 into volcano-sh:main Aug 10, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants