Skip to content

Commit

Permalink
Ignore worker pods for gateway routing (#776)
Browse files Browse the repository at this point in the history
* Ignore worker pods for gateway routing
* ignore worker pods in UpdatePod as well
* use node worker as const

Signed-off-by: Varun Gupta <[email protected]>
  • Loading branch information
varungup90 authored Mar 3, 2025
1 parent e28c509 commit 6105dae
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions pkg/cache/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ type Block struct {

const (
modelIdentifier = "model.aibrix.ai/name"
nodeType = "ray.io/node-type"
nodeWorker = "worker"
podPort = 8000
defaultPodMetricRefreshIntervalInMS = 50
expireWriteRequestTraceIntervalInMins = 10
Expand Down Expand Up @@ -296,6 +298,12 @@ func (c *Cache) addPod(obj interface{}) {
if !ok {
return
}
// ignore worker pods
nodeType, ok := pod.Labels[nodeType]
if ok && nodeType == nodeWorker {
klog.InfoS("ignored ray worker pod", "name", pod.Name)
return
}

c.Pods[pod.Name] = pod
c.addPodAndModelMappingLocked(pod.Name, modelName)
Expand Down Expand Up @@ -323,6 +331,20 @@ func (c *Cache) updatePod(oldObj interface{}, newObj interface{}) {
c.deletePodAndModelMapping(oldPod.Name, oldModelName)
}

// ignore worker pods
nodeType, ok := oldPod.Labels[nodeType]
if ok && nodeType == nodeWorker {
klog.InfoS("ignored ray worker pod", "name", oldPod.Name)
return
}

// ignore worker pods
nodeType, ok = newPod.Labels[nodeType]
if ok && nodeType == nodeWorker {
klog.InfoS("ignored ray worker pod", "name", newPod.Name)
return
}

// Add new mappings if present
if newOk {
c.Pods[newPod.Name] = newPod
Expand Down

0 comments on commit 6105dae

Please sign in to comment.