@@ -207,13 +207,13 @@ func (ds *datastore) ObjectiveGetAll() []*v1alpha2.InferenceObjective {
207207// /// Pods/endpoints APIs ///
208208// TODO: add a flag for callers to specify the staleness threshold for metrics.
209209// ref: https://github.com/kubernetes-sigs/gateway-api-inference-extension/pull/1046#discussion_r2246351694
210- func (ds * datastore ) PodList (predicate func (backendmetrics. PodMetrics ) bool ) []backendmetrics. PodMetrics {
211- res := []backendmetrics. PodMetrics {}
210+ func (ds * datastore ) PodList (predicate func (datalayer. Endpoint ) bool ) []datalayer. Endpoint {
211+ res := []datalayer. Endpoint {}
212212
213213 ds .pods .Range (func (k , v any ) bool {
214- pm := v .(backendmetrics. PodMetrics )
215- if predicate (pm ) {
216- res = append (res , pm )
214+ ep := v .(datalayer. Endpoint )
215+ if predicate (ep ) {
216+ res = append (res , ep )
217217 }
218218 return true
219219 })
@@ -235,14 +235,14 @@ func (ds *datastore) PodUpdateOrAddIfNotExist(pod *corev1.Pod) bool {
235235 if len (ds .pool .TargetPorts ) == 1 {
236236 modelServerMetricsPort = int (ds .modelServerMetricsPort )
237237 }
238- pods := []* datalayer.PodInfo {}
238+ pods := []* datalayer.EndpointMetadata {}
239239 for idx , port := range ds .pool .TargetPorts {
240240 metricsPort := modelServerMetricsPort
241241 if metricsPort == 0 {
242242 metricsPort = port
243243 }
244244 pods = append (pods ,
245- & datalayer.PodInfo {
245+ & datalayer.EndpointMetadata {
246246 NamespacedName : types.NamespacedName {
247247 Name : pod .Name + "-rank-" + strconv .Itoa (idx ),
248248 Namespace : pod .Namespace ,
@@ -256,28 +256,28 @@ func (ds *datastore) PodUpdateOrAddIfNotExist(pod *corev1.Pod) bool {
256256 }
257257
258258 result := true
259- for _ , podInfo := range pods {
260- var pm backendmetrics. PodMetrics
261- existing , ok := ds .pods .Load (podInfo .NamespacedName )
259+ for _ , endpointMetadata := range pods {
260+ var ep datalayer. Endpoint
261+ existing , ok := ds .pods .Load (endpointMetadata .NamespacedName )
262262 if ! ok {
263- pm = ds .epf .NewEndpoint (ds .parentCtx , podInfo , ds )
264- ds .pods .Store (podInfo .NamespacedName , pm )
263+ ep = ds .epf .NewEndpoint (ds .parentCtx , endpointMetadata , ds )
264+ ds .pods .Store (endpointMetadata .NamespacedName , ep )
265265 result = false
266266 } else {
267- pm = existing .(backendmetrics.PodMetrics )
267+ ep = existing .(backendmetrics.PodMetrics )
268268 }
269- // Update pod properties if anything changed.
270- pm . UpdatePod ( podInfo )
269+ // Update endpoint properties if anything changed.
270+ ep . UpdateMetadata ( endpointMetadata )
271271 }
272272 return result
273273}
274274
275275func (ds * datastore ) PodDelete (podName string ) {
276276 ds .pods .Range (func (k , v any ) bool {
277- pm := v .(backendmetrics. PodMetrics )
278- if pm . GetPod ().PodName == podName {
277+ ep := v .(datalayer. Endpoint )
278+ if ep . GetMetadata ().PodName == podName {
279279 ds .pods .Delete (k )
280- ds .epf .ReleaseEndpoint (pm )
280+ ds .epf .ReleaseEndpoint (ep )
281281 }
282282 return true
283283 })
@@ -309,10 +309,10 @@ func (ds *datastore) podResyncAll(ctx context.Context, reader client.Reader) err
309309
310310 // Remove pods that don't belong to the pool or not ready any more.
311311 ds .pods .Range (func (k , v any ) bool {
312- pm := v .(backendmetrics. PodMetrics )
313- if exist := activePods [pm . GetPod ().PodName ]; ! exist {
314- logger .V (logutil .VERBOSE ).Info ("Removing pod" , "pod" , pm . GetPod ())
315- ds .PodDelete (pm . GetPod ().PodName )
312+ ep := v .(datalayer. Endpoint )
313+ if exist := activePods [ep . GetMetadata ().PodName ]; ! exist {
314+ logger .V (logutil .VERBOSE ).Info ("Removing pod" , "pod" , ep . GetMetadata ())
315+ ds .PodDelete (ep . GetMetadata ().PodName )
316316 }
317317 return true
318318 })
0 commit comments