Update Server Alias Annotation with Review Changes
Updates the Server-Alias annotation to create another server containing the same configuration as the current server, but with the name provided in the annotation.
This commit is contained in:
parent
ac504bdbc0
commit
62fea9aa01
4 changed files with 220 additions and 219 deletions
|
|
@ -1062,21 +1062,9 @@ func (ic *GenericController) createServers(data []interface{},
|
|||
continue
|
||||
}
|
||||
|
||||
// setup server-aliases based on annotations
|
||||
aliasMap := map[string]string{}
|
||||
// setup server-alias based on annotations
|
||||
aliasAnnotation := ic.annotations.Alias(ing)
|
||||
|
||||
// Here we parse the annotation string in the following format:
|
||||
// ingress.kubernetes.io/server-alias: "host_0:alias_0;...;host_n:alias_n"
|
||||
aliases := strings.Split(aliasAnnotation, ";")
|
||||
for _, alias := range aliases {
|
||||
aliasParts := strings.Split(alias, ":")
|
||||
if len(aliasParts) == 2 {
|
||||
// aliasMap[host] = alias
|
||||
aliasMap[aliasParts[0]] = aliasParts[1]
|
||||
}
|
||||
}
|
||||
|
||||
for _, rule := range ing.Spec.Rules {
|
||||
host := rule.Host
|
||||
if host == "" {
|
||||
|
|
@ -1084,7 +1072,7 @@ func (ic *GenericController) createServers(data []interface{},
|
|||
}
|
||||
|
||||
// setup server aliases
|
||||
servers[host].Alias = aliasMap[host]
|
||||
servers[host].Alias = aliasAnnotation
|
||||
|
||||
// only add a certificate if the server does not have one previously configured
|
||||
if len(ing.Spec.TLS) == 0 || servers[host].SSLCertificate != "" {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue