diff --git a/pkg/api/types.go b/pkg/api/types.go index d402a3376f2..ac1b282bf39 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -1889,6 +1889,8 @@ type EndpointAddress struct { // Optional: Hostname of this endpoint // Meant to be used by DNS servers etc. Hostname string `json:"hostname,omitempty"` + // Optional: Node hosting this endpoint. This can be used to determine endpoints local to a node. + NodeName *string `json:"nodeName,omitempty"` // Optional: The kubernetes object related to the entry point. TargetRef *ObjectReference } diff --git a/pkg/api/v1/types.go b/pkg/api/v1/types.go index aacbda695f8..064eed7f385 100644 --- a/pkg/api/v1/types.go +++ b/pkg/api/v1/types.go @@ -2279,6 +2279,8 @@ type EndpointAddress struct { IP string `json:"ip" protobuf:"bytes,1,opt,name=ip"` // The Hostname of this endpoint Hostname string `json:"hostname,omitempty" protobuf:"bytes,3,opt,name=hostname"` + // Optional: Node hosting this endpoint. This can be used to determine endpoints local to a node. + NodeName *string `json:"nodeName,omitempty" protobuf:"bytes,4,opt,name=nodeName"` // Reference to object providing the endpoint. TargetRef *ObjectReference `json:"targetRef,omitempty" protobuf:"bytes,2,opt,name=targetRef"` } diff --git a/pkg/controller/endpoint/endpoints_controller.go b/pkg/controller/endpoint/endpoints_controller.go index 8a1f5c44a97..af996ad3e92 100644 --- a/pkg/controller/endpoint/endpoints_controller.go +++ b/pkg/controller/endpoint/endpoints_controller.go @@ -404,7 +404,8 @@ func (e *EndpointController) syncService(key string) { epp := api.EndpointPort{Name: portName, Port: int32(portNum), Protocol: portProto} epa := api.EndpointAddress{ - IP: pod.Status.PodIP, + IP: pod.Status.PodIP, + NodeName: pod.Spec.NodeName, TargetRef: &api.ObjectReference{ Kind: "Pod", Namespace: pod.ObjectMeta.Namespace,