@@ -240,13 +240,13 @@ func (ds *datastore) ModelRewriteGetAll() []*v1alpha2.InferenceModelRewrite {
240240// /// Pods/endpoints APIs ///
241241// TODO: add a flag for callers to specify the staleness threshold for metrics.
242242// ref: https://github.com/kubernetes-sigs/gateway-api-inference-extension/pull/1046#discussion_r2246351694
243- func (ds * datastore ) PodList (predicate func (backendmetrics. PodMetrics ) bool ) []backendmetrics. PodMetrics {
244- res := []backendmetrics. PodMetrics {}
243+ func (ds * datastore ) PodList (predicate func (datalayer. Endpoint ) bool ) []datalayer. Endpoint {
244+ res := []datalayer. Endpoint {}
245245
246246 ds .pods .Range (func (k , v any ) bool {
247- pm := v .(backendmetrics. PodMetrics )
248- if predicate (pm ) {
249- res = append (res , pm )
247+ ep := v .(datalayer. Endpoint )
248+ if predicate (ep ) {
249+ res = append (res , ep )
250250 }
251251 return true
252252 })
@@ -268,14 +268,14 @@ func (ds *datastore) PodUpdateOrAddIfNotExist(pod *corev1.Pod) bool {
268268 if len (ds .pool .TargetPorts ) == 1 {
269269 modelServerMetricsPort = int (ds .modelServerMetricsPort )
270270 }
271- pods := []* datalayer.PodInfo {}
271+ pods := []* datalayer.EndpointMetadata {}
272272 for idx , port := range ds .pool .TargetPorts {
273273 metricsPort := modelServerMetricsPort
274274 if metricsPort == 0 {
275275 metricsPort = port
276276 }
277277 pods = append (pods ,
278- & datalayer.PodInfo {
278+ & datalayer.EndpointMetadata {
279279 NamespacedName : types.NamespacedName {
280280 Name : pod .Name + "-rank-" + strconv .Itoa (idx ),
281281 Namespace : pod .Namespace ,
@@ -289,28 +289,28 @@ func (ds *datastore) PodUpdateOrAddIfNotExist(pod *corev1.Pod) bool {
289289 }
290290
291291 result := true
292- for _ , podInfo := range pods {
293- var pm backendmetrics. PodMetrics
294- existing , ok := ds .pods .Load (podInfo .NamespacedName )
292+ for _ , endpointMetadata := range pods {
293+ var ep datalayer. Endpoint
294+ existing , ok := ds .pods .Load (endpointMetadata .NamespacedName )
295295 if ! ok {
296- pm = ds .epf .NewEndpoint (ds .parentCtx , podInfo , ds )
297- ds .pods .Store (podInfo .NamespacedName , pm )
296+ ep = ds .epf .NewEndpoint (ds .parentCtx , endpointMetadata , ds )
297+ ds .pods .Store (endpointMetadata .NamespacedName , ep )
298298 result = false
299299 } else {
300- pm = existing .(backendmetrics.PodMetrics )
300+ ep = existing .(backendmetrics.PodMetrics )
301301 }
302- // Update pod properties if anything changed.
303- pm . UpdatePod ( podInfo )
302+ // Update endpoint properties if anything changed.
303+ ep . UpdateMetadata ( endpointMetadata )
304304 }
305305 return result
306306}
307307
308308func (ds * datastore ) PodDelete (podName string ) {
309309 ds .pods .Range (func (k , v any ) bool {
310- pm := v .(backendmetrics. PodMetrics )
311- if pm . GetPod ().PodName == podName {
310+ ep := v .(datalayer. Endpoint )
311+ if ep . GetMetadata ().PodName == podName {
312312 ds .pods .Delete (k )
313- ds .epf .ReleaseEndpoint (pm )
313+ ds .epf .ReleaseEndpoint (ep )
314314 }
315315 return true
316316 })
@@ -342,10 +342,10 @@ func (ds *datastore) podResyncAll(ctx context.Context, reader client.Reader) err
342342
343343 // Remove pods that don't belong to the pool or not ready any more.
344344 ds .pods .Range (func (k , v any ) bool {
345- pm := v .(backendmetrics. PodMetrics )
346- if exist := activePods [pm . GetPod ().PodName ]; ! exist {
347- logger .V (logutil .VERBOSE ).Info ("Removing pod" , "pod" , pm . GetPod ())
348- ds .PodDelete (pm . GetPod ().PodName )
345+ ep := v .(datalayer. Endpoint )
346+ if exist := activePods [ep . GetMetadata ().PodName ]; ! exist {
347+ logger .V (logutil .VERBOSE ).Info ("Removing pod" , "pod" , ep . GetMetadata ())
348+ ds .PodDelete (ep . GetMetadata ().PodName )
349349 }
350350 return true
351351 })
0 commit comments