Only set alias if not already set

This commit is contained in:
Alex Rowley 2017-10-27 12:46:32 +01:00
parent a35edcd522
commit 3e51b0db44
No known key found for this signature in database
GPG key ID: C0A11F24C7F74F35

View file

@ -998,10 +998,15 @@ func (ic *GenericController) createServers(data []*extensions.Ingress,
}
// setup server aliases
servers[host].Alias = aliasAnnotation
if aliasAnnotation != "" {
if _, ok := aliases[aliasAnnotation]; !ok {
aliases[aliasAnnotation] = host
if servers[host].Alias == "" {
servers[host].Alias = aliasAnnotation
if _, ok := aliases[aliasAnnotation]; !ok {
aliases[aliasAnnotation] = host
}
} else {
glog.Warningf("ingress %v/%v for host %v contains an Alias but one has already been configured.",
ing.Namespace, ing.Name, host)
}
}