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.
This commit is contained in:
parent
039107e837
commit
d4f190e995
1 changed files with 5 additions and 1 deletions
|
@ -268,7 +268,11 @@ func (provider *Kubernetes) loadIngresses(k8sClient k8s.Client) (*types.Configur
|
||||||
for _, subset := range endpoints.Subsets {
|
for _, subset := range endpoints.Subsets {
|
||||||
for _, address := range subset.Addresses {
|
for _, address := range subset.Addresses {
|
||||||
url := protocol + "://" + address.IP + ":" + strconv.Itoa(endpointPortNumber(port, subset.Ports))
|
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,
|
URL: url,
|
||||||
Weight: 1,
|
Weight: 1,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue