Browse Source

add endponits labels metadata

add endponits labels metadata

Signed-off-by: root <likerj@inspur.com>
pull/8273/head
fcddk 4 years ago committed by root
parent
commit
617c56f55a
  1. 8
      discovery/kubernetes/endpoints.go

8
discovery/kubernetes/endpoints.go

@ -199,6 +199,8 @@ func endpointsSourceFromNamespaceAndName(namespace, name string) string {
} }
const ( const (
endpointsLabelPrefix = metaLabelPrefix + "endpoints_label_"
endpointsLabelPresentPrefix = metaLabelPrefix + "endpoints_labelpresent_"
endpointsNameLabel = metaLabelPrefix + "endpoints_name" endpointsNameLabel = metaLabelPrefix + "endpoints_name"
endpointNodeName = metaLabelPrefix + "endpoint_node_name" endpointNodeName = metaLabelPrefix + "endpoint_node_name"
endpointHostname = metaLabelPrefix + "endpoint_hostname" endpointHostname = metaLabelPrefix + "endpoint_hostname"
@ -218,6 +220,12 @@ func (e *Endpoints) buildEndpoints(eps *apiv1.Endpoints) *targetgroup.Group {
endpointsNameLabel: lv(eps.Name), endpointsNameLabel: lv(eps.Name),
} }
e.addServiceLabels(eps.Namespace, eps.Name, tg) e.addServiceLabels(eps.Namespace, eps.Name, tg)
//add endponits labels metadata
for k, v := range eps.Labels {
ln := strutil.SanitizeLabelName(k)
tg.Labels[model.LabelName(endpointsLabelPrefix+ln)] = lv(v)
tg.Labels[model.LabelName(endpointsLabelPresentPrefix+ln)] = presentValue
}
type podEntry struct { type podEntry struct {
pod *apiv1.Pod pod *apiv1.Pod

Loading…
Cancel
Save