Fix nginx variable service_port (nginx) (#4500)

This commit is contained in:
Manuel Alejandro de Brito Fontes 2019-08-31 11:24:01 -04:00 committed by GitHub
parent 72cb7f5e14
commit c7d2444cf4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 107 additions and 88 deletions

View file

@ -797,6 +797,7 @@ type ingressInformation struct {
Namespace string
Rule string
Service string
ServicePort string
Annotations map[string]string
}
@ -810,6 +811,9 @@ func (info *ingressInformation) Equal(other *ingressInformation) bool {
if info.Service != other.Service {
return false
}
if info.ServicePort != other.ServicePort {
return false
}
if !reflect.DeepEqual(info.Annotations, other.Annotations) {
return false
}
@ -848,6 +852,9 @@ func getIngressInformation(i, h, p interface{}) *ingressInformation {
if ing.Spec.Backend != nil {
info.Service = ing.Spec.Backend.ServiceName
if ing.Spec.Backend.ServicePort.String() != "0" {
info.ServicePort = ing.Spec.Backend.ServicePort.String()
}
}
for _, rule := range ing.Spec.Rules {
@ -862,6 +869,10 @@ 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()
}
return info
}
}