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
1 changed files with 2 additions and 4 deletions

View File

@ -37,8 +37,6 @@ const (
// kubernetesMetaLabelPrefix is the meta prefix used for all meta labels. // kubernetesMetaLabelPrefix is the meta prefix used for all meta labels.
// in this discovery. // in this discovery.
metaLabelPrefix = model.MetaLabelPrefix + "kubernetes_" 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 is the name for the label containing a target's service namespace.
serviceNamespaceLabel = metaLabelPrefix + "service_namespace" serviceNamespaceLabel = metaLabelPrefix + "service_namespace"
// serviceNameLabel is the name for the label containing a target's service name. // serviceNameLabel is the name for the label containing a target's service name.
@ -324,7 +322,7 @@ func (kd *Discovery) updateNodesTargetGroup() *config.TargetGroup {
t := model.LabelSet{ t := model.LabelSet{
model.AddressLabel: model.LabelValue(address), model.AddressLabel: model.LabelValue(address),
nodeLabel: model.LabelValue(nodeName), model.InstanceLabel: model.LabelValue(nodeName),
} }
for k, v := range node.ObjectMeta.Labels { for k, v := range node.ObjectMeta.Labels {
labelName := strutil.SanitizeLabelName(nodeLabelPrefix + k) labelName := strutil.SanitizeLabelName(nodeLabelPrefix + k)