Merge pull request #1162 from fabric8io/kubernetes-discovery

Kubernetes SD: Use node name as instance label
This commit is contained in:
Julius Volz 2015-10-13 15:00:52 -04:00
commit 28ba85c37a

View file

@ -37,8 +37,6 @@ const (
// kubernetesMetaLabelPrefix is the meta prefix used for all meta labels.
// in this discovery.
metaLabelPrefix = model.MetaLabelPrefix + "kubernetes_"
// nodeLabel is the name for the label containing a target's node name.
nodeLabel = metaLabelPrefix + "node"
// serviceNamespaceLabel is the name for the label containing a target's service namespace.
serviceNamespaceLabel = metaLabelPrefix + "service_namespace"
// serviceNameLabel is the name for the label containing a target's service name.
@ -323,8 +321,8 @@ func (kd *Discovery) updateNodesTargetGroup() *config.TargetGroup {
address := fmt.Sprintf("%s:%d", node.Status.Addresses[0].Address, kd.Conf.KubeletPort)
t := model.LabelSet{
model.AddressLabel: model.LabelValue(address),
nodeLabel: model.LabelValue(nodeName),
model.AddressLabel: model.LabelValue(address),
model.InstanceLabel: model.LabelValue(nodeName),
}
for k, v := range node.ObjectMeta.Labels {
labelName := strutil.SanitizeLabelName(nodeLabelPrefix + k)