Skip to content

Conversation

@googs1025
Copy link
Collaborator

Pull Request Description

[Please provide a clear and concise description of your changes here]

Previously, the metaPods cache used only the name as the key, which could lead to
key collisions when Pods with the same name existed in different namespaces.

This pr updates cache to use namespace/name as the key, ensuring uniqueness
and avoiding potential conflicts. This aligns with Kubernetes' common practice of
using namespace/name to uniquely identify resources.

Related Issues

Resolves: #1008

Important: Before submitting, please complete the description above and review the checklist below.


Contribution Guidelines (Expand for Details)

We appreciate your contribution to aibrix! To ensure a smooth review process and maintain high code quality, please adhere to the following guidelines:

Pull Request Title Format

Your PR title should start with one of these prefixes to indicate the nature of the change:

  • [Bug]: Corrections to existing functionality
  • [CI]: Changes to build process or CI pipeline
  • [Docs]: Updates or additions to documentation
  • [API]: Modifications to aibrix's API or interface
  • [CLI]: Changes or additions to the Command Line Interface
  • [Misc]: For changes not covered above (use sparingly)

Note: For changes spanning multiple categories, use multiple prefixes in order of importance.

Submission Checklist

  • PR title includes appropriate prefix(es)
  • Changes are clearly explained in the PR description
  • New and existing tests pass successfully
  • Code adheres to project style and best practices
  • Documentation updated to reflect changes (if applicable)
  • Thorough testing completed, no regressions introduced

By submitting this PR, you confirm that you've read these guidelines and your changes align with the project's contribution standards.

@googs1025 googs1025 force-pushed the fix/cache branch 7 times, most recently from cc02721 to 1169792 Compare April 28, 2025 15:40
@varungup90 varungup90 requested a review from zhangjyr April 28, 2025 20:13
func (c *Store) GetPod(podName string) (*v1.Pod, error) {
metaPod, ok := c.metaPods.Load(podName)
func (c *Store) GetPod(podName, podNamespace string) (*v1.Pod, error) {
key := fmt.Sprintf("%s/%s", podNamespace, podName)
Copy link
Collaborator

@varungup90 varungup90 Apr 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Better to make a util method here.

  • Update error messages as well, for example fmt.Errorf("pod does not exist in the cache: %s", podName) -> fmt.Errorf("key does not exist in the cache: %s", key)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

applies to all methods.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add GeneratePodKey func in util package

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

c.metaPods.Range(func(podName string, metaPod *Pod) bool {
c.metaPods.Range(func(key string, metaPod *Pod) bool {
// Split the key into namespace and name
parts := strings.Split(key, "/")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can add a util method here as well to check if key is valid.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add ParsePodKey func in util package

@varungup90
Copy link
Collaborator

overall LGTM, couple of nits.

@googs1025 googs1025 force-pushed the fix/cache branch 3 times, most recently from ff30126 to af0984e Compare April 29, 2025 08:10
Copy link
Collaborator

@kerthcet kerthcet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also LGTM, I think namespaced Pod name is enough now, in kubernetes, we may sometimes use pid to avoid conflict.

@googs1025 googs1025 changed the title [Bug] fix: update metaPods cache to use as the key [Bug] fix: update metaPods cache to use namespace/name as the key Apr 29, 2025
@varungup90 varungup90 merged commit 193c5ec into vllm-project:main Apr 29, 2025
11 checks passed
Yaegaki1Erika pushed a commit to Yaegaki1Erika/aibrix that referenced this pull request Jul 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use namespaced name in cache

3 participants