@@ -200,13 +200,13 @@ func (ds *datastore) ObjectiveGetAll() []*v1alpha2.InferenceObjective {
200200// /// Pods/endpoints APIs ///
201201// TODO: add a flag for callers to specify the staleness threshold for metrics.
202202// ref: https://github.com/kubernetes-sigs/gateway-api-inference-extension/pull/1046#discussion_r2246351694
203- func (ds * datastore ) PodList (predicate func (backendmetrics. PodMetrics ) bool ) []backendmetrics. PodMetrics {
204- res := []backendmetrics. PodMetrics {}
203+ func (ds * datastore ) PodList (predicate func (datalayer. Endpoint ) bool ) []datalayer. Endpoint {
204+ res := []datalayer. Endpoint {}
205205
206206 ds .pods .Range (func (k , v any ) bool {
207- pm := v .(backendmetrics. PodMetrics )
208- if predicate (pm ) {
209- res = append (res , pm )
207+ ep := v .(datalayer. Endpoint )
208+ if predicate (ep ) {
209+ res = append (res , ep )
210210 }
211211 return true
212212 })
@@ -228,14 +228,14 @@ func (ds *datastore) PodUpdateOrAddIfNotExist(pod *corev1.Pod) bool {
228228 if len (ds .pool .Spec .TargetPorts ) == 1 {
229229 modelServerMetricsPort = int (ds .modelServerMetricsPort )
230230 }
231- pods := []* datalayer.PodInfo {}
231+ pods := []* datalayer.EndpointMetadata {}
232232 for idx , port := range ds .pool .Spec .TargetPorts {
233233 metricsPort := modelServerMetricsPort
234234 if metricsPort == 0 {
235235 metricsPort = int (port .Number )
236236 }
237237 pods = append (pods ,
238- & datalayer.PodInfo {
238+ & datalayer.EndpointMetadata {
239239 NamespacedName : types.NamespacedName {
240240 Name : pod .Name + "-rank-" + strconv .Itoa (idx ),
241241 Namespace : pod .Namespace ,
@@ -249,28 +249,28 @@ func (ds *datastore) PodUpdateOrAddIfNotExist(pod *corev1.Pod) bool {
249249 }
250250
251251 result := true
252- for _ , podInfo := range pods {
253- var pm backendmetrics. PodMetrics
254- existing , ok := ds .pods .Load (podInfo .NamespacedName )
252+ for _ , endpointMetadata := range pods {
253+ var ep datalayer. Endpoint
254+ existing , ok := ds .pods .Load (endpointMetadata .NamespacedName )
255255 if ! ok {
256- pm = ds .epf .NewEndpoint (ds .parentCtx , podInfo , ds )
257- ds .pods .Store (podInfo .NamespacedName , pm )
256+ ep = ds .epf .NewEndpoint (ds .parentCtx , endpointMetadata , ds )
257+ ds .pods .Store (endpointMetadata .NamespacedName , ep )
258258 result = false
259259 } else {
260- pm = existing .(backendmetrics.PodMetrics )
260+ ep = existing .(backendmetrics.PodMetrics )
261261 }
262- // Update pod properties if anything changed.
263- pm . UpdatePod ( podInfo )
262+ // Update endpoint properties if anything changed.
263+ ep . UpdateMetadata ( endpointMetadata )
264264 }
265265 return result
266266}
267267
268268func (ds * datastore ) PodDelete (podName string ) {
269269 ds .pods .Range (func (k , v any ) bool {
270- pm := v .(backendmetrics. PodMetrics )
271- if pm . GetPod ().PodName == podName {
270+ ep := v .(datalayer. Endpoint )
271+ if ep . GetMetadata ().PodName == podName {
272272 ds .pods .Delete (k )
273- ds .epf .ReleaseEndpoint (pm )
273+ ds .epf .ReleaseEndpoint (ep )
274274 }
275275 return true
276276 })
@@ -302,10 +302,10 @@ func (ds *datastore) podResyncAll(ctx context.Context, reader client.Reader) err
302302
303303 // Remove pods that don't belong to the pool or not ready any more.
304304 ds .pods .Range (func (k , v any ) bool {
305- pm := v .(backendmetrics. PodMetrics )
306- if exist := activePods [pm . GetPod ().PodName ]; ! exist {
307- logger .V (logutil .VERBOSE ).Info ("Removing pod" , "pod" , pm . GetPod ())
308- ds .PodDelete (pm . GetPod ().PodName )
305+ ep := v .(datalayer. Endpoint )
306+ if exist := activePods [ep . GetMetadata ().PodName ]; ! exist {
307+ logger .V (logutil .VERBOSE ).Info ("Removing pod" , "pod" , ep . GetMetadata ())
308+ ds .PodDelete (ep . GetMetadata ().PodName )
309309 }
310310 return true
311311 })
0 commit comments