Fix nginx ingress variables for definitions with Backend

This commit is contained in:
Manuel Alejandro de Brito Fontes 2020-12-04 23:37:47 -03:00
parent 0b6d115236
commit 77234fcde0
3 changed files with 91 additions and 41 deletions

View file

@ -890,14 +890,21 @@ func getIngressInformation(i, h, p interface{}) *ingressInformation {
}
for _, rPath := range rule.HTTP.Paths {
if path == rPath.Path {
info.Service = rPath.Backend.ServiceName
if rPath.Backend.ServicePort.String() != "0" {
info.ServicePort = rPath.Backend.ServicePort.String()
}
if path != rPath.Path {
continue
}
if info.Service != "" && rPath.Backend.ServiceName == "" {
// empty rule. Only contains a Path and PathType
return info
}
info.Service = rPath.Backend.ServiceName
if rPath.Backend.ServicePort.String() != "0" {
info.ServicePort = rPath.Backend.ServicePort.String()
}
return info
}
}