Skip to content

Commit 2bcb297

Browse files
committed
epp: read endpoint type through an attribute, not the metadata field
Publish the discovered endpoint type as an endpoint attribute at creation and read it through EndpointTypeOf, so multi-cluster-aware plugins query the attribute map while every other consumer is unaffected. Only EPP is stamped; absence reads as engine. The metadata Type field stays as the discovery transport but no longer participates in Equal, since type is a trait rather than identity. Signed-off-by: Sam Batschelet <sbatsche@redhat.com>
1 parent 61ddbdb commit 2bcb297

4 files changed

Lines changed: 50 additions & 8 deletions

File tree

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ func NewEndpoint(meta *EndpointMetadata, metrics *Metrics) *ModelServer {
6161
}
6262
ep.UpdateMetadata(meta)
6363
ep.UpdateMetrics(metrics)
64+
// Discovery carries the type on metadata. Publish EPP as an attribute that
65+
// consumers read through EndpointTypeOf. Absence reads as engine.
66+
if meta.Type == EndpointTypeEPP {
67+
SetEndpointType(ep, meta.Type)
68+
}
6469
return ep
6570
}
6671

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ type EndpointMetadata struct {
5858
Port string
5959
MetricsHost string
6060
Labels map[string]string
61-
Type EndpointType
61+
// Type carries the discovered endpoint type to endpoint creation, where it is
62+
// published as an attribute. Read it through EndpointTypeOf, not this field.
63+
Type EndpointType
6264
// RankIndex is this endpoint's position in the pool's TargetPorts,
6365
// identifying the pod-local rank in multi-port deployments.
6466
RankIndex int
@@ -108,7 +110,6 @@ func (epm *EndpointMetadata) Equal(other *EndpointMetadata) bool {
108110
epm.NodeAddress == other.NodeAddress &&
109111
epm.Port == other.Port &&
110112
epm.MetricsHost == other.MetricsHost &&
111-
epm.Type == other.Type &&
112113
epm.RankIndex == other.RankIndex &&
113114
maps.Equal(epm.Labels, other.Labels)
114115
}

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,6 @@ func TestEndpointMetadataEqual(t *testing.T) {
129129
meta.Labels["app"] = "sglang"
130130
},
131131
},
132-
{
133-
name: "type",
134-
mutate: func(meta *EndpointMetadata) {
135-
meta.Type = EndpointTypeEPP
136-
},
137-
},
138132
{
139133
name: "rank index",
140134
mutate: func(meta *EndpointMetadata) {
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
Copyright 2026 The Kubernetes Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package datalayer
18+
19+
// EndpointTypeAttrKey is the attribute under which an endpoint's type is stored.
20+
// Type is carried as an attribute rather than a first-class identity field so the
21+
// contract stays loose while the concept settles.
22+
const EndpointTypeAttrKey = "llm-d.ai/endpoint-type"
23+
24+
// endpointTypeAttr is the Cloneable stored under EndpointTypeAttrKey.
25+
type endpointTypeAttr EndpointType
26+
27+
func (t endpointTypeAttr) Clone() Cloneable { return t }
28+
29+
// SetEndpointType records an endpoint's type in its attributes.
30+
func SetEndpointType(ep Endpoint, t EndpointType) {
31+
ep.GetAttributes().Put(EndpointTypeAttrKey, endpointTypeAttr(t))
32+
}
33+
34+
// EndpointTypeOf returns an endpoint's type, defaulting to engine when unset.
35+
func EndpointTypeOf(ep Endpoint) EndpointType {
36+
if v, ok := ep.GetAttributes().Get(EndpointTypeAttrKey); ok {
37+
if t, ok := v.(endpointTypeAttr); ok {
38+
return EndpointType(t)
39+
}
40+
}
41+
return EndpointTypeEngine
42+
}

0 commit comments

Comments
 (0)