@@ -239,13 +239,13 @@ func (ds *datastore) ModelRewriteGetAll() []*v1alpha2.InferenceModelRewrite {
239239// /// Pods/endpoints APIs ///
240240// TODO: add a flag for callers to specify the staleness threshold for metrics.
241241// ref: https://github.com/kubernetes-sigs/gateway-api-inference-extension/pull/1046#discussion_r2246351694
242- func (ds * datastore ) PodList (predicate func (backendmetrics. PodMetrics ) bool ) []backendmetrics. PodMetrics {
243- res := []backendmetrics. PodMetrics {}
242+ func (ds * datastore ) PodList (predicate func (datalayer. Endpoint ) bool ) []datalayer. Endpoint {
243+ res := []datalayer. Endpoint {}
244244
245245 ds .pods .Range (func (k , v any ) bool {
246- pm := v .(backendmetrics. PodMetrics )
247- if predicate (pm ) {
248- res = append (res , pm )
246+ ep := v .(datalayer. Endpoint )
247+ if predicate (ep ) {
248+ res = append (res , ep )
249249 }
250250 return true
251251 })
@@ -267,14 +267,14 @@ func (ds *datastore) PodUpdateOrAddIfNotExist(pod *corev1.Pod) bool {
267267 if len (ds .pool .TargetPorts ) == 1 {
268268 modelServerMetricsPort = int (ds .modelServerMetricsPort )
269269 }
270- pods := []* datalayer.PodInfo {}
270+ pods := []* datalayer.EndpointMetadata {}
271271 for idx , port := range ds .pool .TargetPorts {
272272 metricsPort := modelServerMetricsPort
273273 if metricsPort == 0 {
274274 metricsPort = port
275275 }
276276 pods = append (pods ,
277- & datalayer.PodInfo {
277+ & datalayer.EndpointMetadata {
278278 NamespacedName : types.NamespacedName {
279279 Name : pod .Name + "-rank-" + strconv .Itoa (idx ),
280280 Namespace : pod .Namespace ,
@@ -288,28 +288,28 @@ func (ds *datastore) PodUpdateOrAddIfNotExist(pod *corev1.Pod) bool {
288288 }
289289
290290 result := true
291- for _ , podInfo := range pods {
292- var pm backendmetrics. PodMetrics
293- existing , ok := ds .pods .Load (podInfo .NamespacedName )
291+ for _ , endpointMetadata := range pods {
292+ var ep datalayer. Endpoint
293+ existing , ok := ds .pods .Load (endpointMetadata .NamespacedName )
294294 if ! ok {
295- pm = ds .epf .NewEndpoint (ds .parentCtx , podInfo , ds )
296- ds .pods .Store (podInfo .NamespacedName , pm )
295+ ep = ds .epf .NewEndpoint (ds .parentCtx , endpointMetadata , ds )
296+ ds .pods .Store (endpointMetadata .NamespacedName , ep )
297297 result = false
298298 } else {
299- pm = existing .(backendmetrics.PodMetrics )
299+ ep = existing .(backendmetrics.PodMetrics )
300300 }
301- // Update pod properties if anything changed.
302- pm . UpdatePod ( podInfo )
301+ // Update endpoint properties if anything changed.
302+ ep . UpdateMetadata ( endpointMetadata )
303303 }
304304 return result
305305}
306306
307307func (ds * datastore ) PodDelete (podName string ) {
308308 ds .pods .Range (func (k , v any ) bool {
309- pm := v .(backendmetrics. PodMetrics )
310- if pm . GetPod ().PodName == podName {
309+ ep := v .(datalayer. Endpoint )
310+ if ep . GetMetadata ().PodName == podName {
311311 ds .pods .Delete (k )
312- ds .epf .ReleaseEndpoint (pm )
312+ ds .epf .ReleaseEndpoint (ep )
313313 }
314314 return true
315315 })
@@ -341,10 +341,10 @@ func (ds *datastore) podResyncAll(ctx context.Context, reader client.Reader) err
341341
342342 // Remove pods that don't belong to the pool or not ready any more.
343343 ds .pods .Range (func (k , v any ) bool {
344- pm := v .(backendmetrics. PodMetrics )
345- if exist := activePods [pm . GetPod ().PodName ]; ! exist {
346- logger .V (logutil .VERBOSE ).Info ("Removing pod" , "pod" , pm . GetPod ())
347- ds .PodDelete (pm . GetPod ().PodName )
344+ ep := v .(datalayer. Endpoint )
345+ if exist := activePods [ep . GetMetadata ().PodName ]; ! exist {
346+ logger .V (logutil .VERBOSE ).Info ("Removing pod" , "pod" , ep . GetMetadata ())
347+ ds .PodDelete (ep . GetMetadata ().PodName )
348348 }
349349 return true
350350 })
0 commit comments