From d4f190e995cf39a4d6c36fff4458b211b3ee9567 Mon Sep 17 00:00:00 2001 From: Ed Robinson Date: Thu, 4 Aug 2016 18:55:41 +0100 Subject: [PATCH] Name servers after thier pods The TargetRef contains information from the object referenced by the pod, unless the service has been set up with bare endpoints - i.e. not pointing at pods this information will be present. It just makes the information that we show in the web-ui a little more constent with that shown in kubectl and the kuberntes dashboard. --- provider/kubernetes.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/provider/kubernetes.go b/provider/kubernetes.go index d20a28743..6fde7f5f3 100644 --- a/provider/kubernetes.go +++ b/provider/kubernetes.go @@ -268,7 +268,11 @@ func (provider *Kubernetes) loadIngresses(k8sClient k8s.Client) (*types.Configur for _, subset := range endpoints.Subsets { for _, address := range subset.Addresses { url := protocol + "://" + address.IP + ":" + strconv.Itoa(endpointPortNumber(port, subset.Ports)) - templateObjects.Backends[r.Host+pa.Path].Servers[url] = types.Server{ + name := url + if address.TargetRef != nil && address.TargetRef.Name != "" { + name = address.TargetRef.Name + } + templateObjects.Backends[r.Host+pa.Path].Servers[name] = types.Server{ URL: url, Weight: 1, }