Skip to content

Commit

Permalink
Merge pull request #648 from jcmoraisjr/jm-fix-track-ingress
Browse files Browse the repository at this point in the history
Fix sigsegv tracking added ingress
  • Loading branch information
jcmoraisjr authored Aug 27, 2020
2 parents 1718579 + 7b4e379 commit 3688c4a
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions pkg/converters/ingress/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,15 +300,17 @@ func (c *converter) trackAddedIngress() {
name := ing.Namespace + "/" + ing.Name
for _, rule := range ing.Spec.Rules {
c.tracker.TrackHostname(convtypes.IngressType, name, rule.Host)
for _, path := range rule.HTTP.Paths {
svcName, svcPort := readServiceNamePort(&path.Backend)
fullSvcName := ing.Namespace + "/" + svcName
if svc, err := c.cache.GetService(fullSvcName); err == nil {
port := convutils.FindServicePort(svc, svcPort)
if port != nil {
backend := c.haproxy.Backends().FindBackend(ing.Namespace, svcName, port.TargetPort.String())
if backend != nil {
c.tracker.TrackBackend(convtypes.IngressType, name, backend.BackendID())
if rule.HTTP != nil {
for _, path := range rule.HTTP.Paths {
svcName, svcPort := readServiceNamePort(&path.Backend)
fullSvcName := ing.Namespace + "/" + svcName
if svc, err := c.cache.GetService(fullSvcName); err == nil {
port := convutils.FindServicePort(svc, svcPort)
if port != nil {
backend := c.haproxy.Backends().FindBackend(ing.Namespace, svcName, port.TargetPort.String())
if backend != nil {
c.tracker.TrackBackend(convtypes.IngressType, name, backend.BackendID())
}
}
}
}
Expand Down

0 comments on commit 3688c4a

Please sign in to comment.