Skip to content

Commit 9e8e699

Browse files
committed
epp: generalize endpoint identity
Rename EndpointMetadata.PodName to Name. The endpoint model is not Kubernetes-only: file-discovered endpoints have no pod, and NamespacedName is the identity. Name is always set, so an endpoint has a name regardless of discovery source. Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
1 parent 44828e2 commit 9e8e699

17 files changed

Lines changed: 40 additions & 40 deletions

File tree

docs/discovery.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ type DiscoveryNotifier interface {
115115
| Field | Type | Description |
116116
|---|---|---|
117117
| `NamespacedName` | `types.NamespacedName` | Unique identity of the endpoint. |
118-
| `PodName` | `string` | Logical name (used in metrics). |
118+
| `Name` | `string` | Name of the workload behind the endpoint. |
119119
| `Address` | `string` | IP address of the inference server. |
120120
| `Port` | `string` | Port as a string (e.g. `"8000"`). |
121121
| `MetricsHost` | `string` | `host:port` for metrics scraping. Defaults to `address:port` if empty. |

pkg/epp/controller/pod_reconciler_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ func TestPodReconciler(t *testing.T) {
219219
gotPods := make([]*corev1.Pod, len(podList))
220220
for idx, pm := range podList {
221221
gotPods[idx] = &corev1.Pod{
222-
ObjectMeta: metav1.ObjectMeta{Name: pm.GetMetadata().PodName, Namespace: pm.GetMetadata().NamespacedName.Namespace},
222+
ObjectMeta: metav1.ObjectMeta{Name: pm.GetMetadata().Name, Namespace: pm.GetMetadata().NamespacedName.Namespace},
223223
Status: corev1.PodStatus{PodIP: pm.GetMetadata().GetIPAddress()},
224224
}
225225
}

pkg/epp/datalayer/logger/logger_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ func TestLogger(t *testing.T) {
8484

8585
logOutput := b.read()
8686
assert.Contains(t, logOutput, "Refreshing Prometheus Metrics {\"ReadyPods\": 2}")
87-
assert.Contains(t, logOutput, "Current Pods and metrics gathered {\"Fresh metrics\": \"[Metadata: {NamespacedName:default/pod1 PodName: Address:1.2.3.4:5678")
87+
assert.Contains(t, logOutput, "Current Pods and metrics gathered {\"Fresh metrics\": \"[Metadata: {NamespacedName:default/pod1 Name: Address:1.2.3.4:5678")
8888
assert.Contains(t, logOutput, "Metrics: {ActiveModels:map[modelA:1] WaitingModels:map[modelB:2] MaxActiveModels:5")
8989
assert.Contains(t, logOutput, "RunningRequestsSize:3 WaitingQueueSize:7 KVCacheUsagePercent:42.5 KvCacheMaxTokenCapacity:2048")
90-
assert.Contains(t, logOutput, "Metadata: {NamespacedName:default/pod2 PodName: Address:1.2.3.4:5679")
90+
assert.Contains(t, logOutput, "Metadata: {NamespacedName:default/pod2 Name: Address:1.2.3.4:5679")
9191
assert.Contains(t, logOutput, "\"Stale metrics\": \"[]\"")
9292
}
9393

pkg/epp/datastore/datastore.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ func (ds *datastore) podUpdateOrAddIfNotExist(ctx context.Context, pod *corev1.P
336336
pods = append(pods,
337337
&fwkdl.EndpointMetadata{
338338
NamespacedName: createEndpointNamespacedName(pod, idx),
339-
PodName: pod.Name,
339+
Name: pod.Name,
340340
Address: pod.Status.PodIP,
341341
NodeAddress: pod.Status.HostIP,
342342
Port: strconv.Itoa(port),
@@ -394,7 +394,7 @@ func (ds *datastore) podUpdateOrAddIfNotExist(ctx context.Context, pod *corev1.P
394394
func (ds *datastore) PodDelete(podName string) {
395395
ds.pods.Range(func(k, v any) bool {
396396
ep := v.(fwkdl.Endpoint)
397-
if ep.GetMetadata().PodName == podName {
397+
if ep.GetMetadata().Name == podName {
398398
ds.pods.Delete(k)
399399
ds.epf.ReleaseEndpoint(ep)
400400
}

pkg/epp/datastore/datastore_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ func TestPods(t *testing.T) {
514514
gotPods := make([]*corev1.Pod, len(podList))
515515
for idx, pm := range podList {
516516
gotPods[idx] = &corev1.Pod{
517-
ObjectMeta: metav1.ObjectMeta{Name: pm.GetMetadata().PodName, Namespace: pm.GetMetadata().NamespacedName.Namespace},
517+
ObjectMeta: metav1.ObjectMeta{Name: pm.GetMetadata().Name, Namespace: pm.GetMetadata().NamespacedName.Namespace},
518518
Status: corev1.PodStatus{
519519
PodIP: pm.GetMetadata().GetIPAddress(),
520520
HostIP: pm.GetMetadata().GetNodeAddress(),
@@ -659,7 +659,7 @@ func TestEndpointMetadata(t *testing.T) {
659659
Namespace: pod1.Namespace,
660660
},
661661

662-
PodName: pod1.Name,
662+
Name: pod1.Name,
663663
Address: pod1.Status.PodIP,
664664
NodeAddress: pod1.Status.HostIP,
665665
Port: inferencePoolTargetPort,
@@ -682,7 +682,7 @@ func TestEndpointMetadata(t *testing.T) {
682682
Namespace: pod1.Namespace,
683683
},
684684

685-
PodName: pod1.Name,
685+
Name: pod1.Name,
686686
Address: pod1.Status.PodIP,
687687
NodeAddress: pod1.Status.HostIP,
688688
Port: inferencePoolMultiTargetPort0,
@@ -695,7 +695,7 @@ func TestEndpointMetadata(t *testing.T) {
695695
Namespace: pod1.Namespace,
696696
},
697697

698-
PodName: pod1.Name,
698+
Name: pod1.Name,
699699
Address: pod1.Status.PodIP,
700700
NodeAddress: pod1.Status.HostIP,
701701
Port: inferencePoolMultiTargetPort1,
@@ -719,7 +719,7 @@ func TestEndpointMetadata(t *testing.T) {
719719
Namespace: pod1.Namespace,
720720
},
721721

722-
PodName: pod1.Name,
722+
Name: pod1.Name,
723723
Address: pod1.Status.PodIP,
724724
NodeAddress: pod1.Status.HostIP,
725725
Port: inferencePoolMultiTargetPort0,
@@ -732,7 +732,7 @@ func TestEndpointMetadata(t *testing.T) {
732732
Namespace: pod1.Namespace,
733733
},
734734

735-
PodName: pod1.Name,
735+
Name: pod1.Name,
736736
Address: pod1.Status.PodIP,
737737
NodeAddress: pod1.Status.HostIP,
738738
Port: inferencePoolMultiTargetPort1,
@@ -746,7 +746,7 @@ func TestEndpointMetadata(t *testing.T) {
746746
Namespace: pod2.Namespace,
747747
},
748748

749-
PodName: pod2.Name,
749+
Name: pod2.Name,
750750
Address: pod2.Status.PodIP,
751751
NodeAddress: pod2.Status.HostIP,
752752
Port: inferencePoolMultiTargetPort0,
@@ -759,7 +759,7 @@ func TestEndpointMetadata(t *testing.T) {
759759
Namespace: pod2.Namespace,
760760
},
761761

762-
PodName: pod2.Name,
762+
Name: pod2.Name,
763763
Address: pod2.Status.PodIP,
764764
NodeAddress: pod2.Status.HostIP,
765765
Port: inferencePoolMultiTargetPort1,
@@ -783,7 +783,7 @@ func TestEndpointMetadata(t *testing.T) {
783783
Namespace: pod1.Namespace,
784784
},
785785

786-
PodName: pod1.Name,
786+
Name: pod1.Name,
787787
Address: pod1.Status.PodIP,
788788
NodeAddress: pod1.Status.HostIP,
789789
Port: inferencePoolMultiTargetPort0,
@@ -796,7 +796,7 @@ func TestEndpointMetadata(t *testing.T) {
796796
Namespace: pod1.Namespace,
797797
},
798798

799-
PodName: pod1.Name,
799+
Name: pod1.Name,
800800
Address: pod1.Status.PodIP,
801801
NodeAddress: pod1.Status.HostIP,
802802
Port: inferencePoolMultiTargetPort1,

pkg/epp/framework/interface/datalayer/endpoint_metadata.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import (
2323
"k8s.io/apimachinery/pkg/types"
2424
)
2525

26-
// EndpointMetadata represents the relevant Kubernetes Pod state of an inference server.
26+
// EndpointMetadata describes an inference endpoint.
2727
type EndpointMetadata struct {
2828
NamespacedName types.NamespacedName
29-
PodName string
29+
Name string
3030
Address string
3131
// NodeAddress is the node IP hosting this pod (pod.Status.HostIP).
3232
// Empty for non-Kubernetes discovery sources (e.g. file discovery).
@@ -60,7 +60,7 @@ func (epm *EndpointMetadata) Clone() *EndpointMetadata {
6060
Name: epm.NamespacedName.Name,
6161
Namespace: epm.NamespacedName.Namespace,
6262
},
63-
PodName: epm.PodName,
63+
Name: epm.Name,
6464
Address: epm.Address,
6565
NodeAddress: epm.NodeAddress,
6666
Port: epm.Port,
@@ -77,7 +77,7 @@ func (epm *EndpointMetadata) Equal(other *EndpointMetadata) bool {
7777
return epm == other
7878
}
7979
return epm.NamespacedName == other.NamespacedName &&
80-
epm.PodName == other.PodName &&
80+
epm.Name == other.Name &&
8181
epm.Address == other.Address &&
8282
epm.NodeAddress == other.NodeAddress &&
8383
epm.Port == other.Port &&

pkg/epp/framework/interface/datalayer/endpoint_metadata_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func TestEndpointMetadataClone(t *testing.T) {
6969
func TestEndpointMetadataEqual(t *testing.T) {
7070
base := &EndpointMetadata{
7171
NamespacedName: types.NamespacedName{Name: "pod-a-rank-0", Namespace: "default"},
72-
PodName: "pod-a",
72+
Name: "pod-a",
7373
Address: "10.0.0.1",
7474
Port: "8000",
7575
MetricsHost: "10.0.0.1:9000",
@@ -99,9 +99,9 @@ func TestEndpointMetadataEqual(t *testing.T) {
9999
},
100100
},
101101
{
102-
name: "pod name",
102+
name: "endpoint name",
103103
mutate: func(meta *EndpointMetadata) {
104-
meta.PodName = "pod-b"
104+
meta.Name = "pod-b"
105105
},
106106
},
107107
{
@@ -151,7 +151,7 @@ func TestEndpointMetadataString(t *testing.T) {
151151
Name: pod.Name,
152152
Namespace: pod.Namespace,
153153
},
154-
PodName: pod.Name,
154+
Name: pod.Name,
155155
Address: pod.Status.PodIP,
156156
Port: "8000",
157157
MetricsHost: "127.0.0.1:8000",

pkg/epp/framework/interface/scheduling/types_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func (s cloneableString) Clone() fwkdl.Cloneable { return s }
3333
func newTestMetadata(name string) *fwkdl.EndpointMetadata {
3434
return &fwkdl.EndpointMetadata{
3535
NamespacedName: types.NamespacedName{Namespace: "ns", Name: name},
36-
PodName: name,
36+
Name: name,
3737
Address: "10.0.0.1",
3838
Port: "8000",
3939
MetricsHost: "10.0.0.1:9100",

pkg/epp/framework/plugins/datalayer/discovery/file/plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ func (f *FileDiscovery) load(notifier fwkdl.DiscoveryNotifier) error {
252252
}
253253
meta := &fwkdl.EndpointMetadata{
254254
NamespacedName: types.NamespacedName{Name: e.Name, Namespace: ns},
255-
PodName: e.Name,
255+
Name: e.Name,
256256
Address: e.Address,
257257
Port: e.Port,
258258
MetricsHost: net.JoinHostPort(e.Address, e.Port),

pkg/epp/framework/plugins/datalayer/extractor/dcgm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ GPU-aware filters and scorers.
1111
1. Receives the parsed Prometheus metric families forwarded by `dcgm-data-source`.
1212
2. Looks up the `DCGM_FI_DEV_GPU_UTIL` metric family.
1313
3. Keeps samples that belong to this endpoint:
14-
- If a sample has a `pod` label and the endpoint has a `PodName`, only
14+
- If a sample has a `pod` label and the endpoint has a `Name`, only
1515
matching samples are kept (DaemonSet multi-pod payloads).
1616
- If the sample has no `pod` label, it is kept (sidecar / unlabeled payloads).
1717
4. Aggregates matching samples using `max` (highest-utilized GPU for the pod).

0 commit comments

Comments
 (0)